#1 2012-09-25 08:33:58

andzoff
Member
Registered: 2012-09-24
Posts: 7

Help to start

Hi sascha,
Congratulations for the good project, I'm very interested in C++ Micro Services.

I am a 10+ years C++ experience and now I'm playing with C++ Micro Service in order to figure out if it could be the solution for my project's problems.
So my target for now is running a simple example.
Well, I started by the Activator code snipplet (included in the downloaded package).

I built/installed the C++ Micro Services lib (and the other stuff) through the cmake, and all seems to be ok. I am in RHEL 5.4 with default gcc 4.1.2.
Then I went into the example directory (documentation/snippets/uServices-activator) where only the main.cpp file is present.
I compiled with the following command

gcc -I <my_path>/CppMicroServices/include -o ActivatorExe -L <my_path>/CppMicroServices/lib -l CppMicroServices main.cpp

I got an executable, Activator.exe. Then I launched the executable, and got the following message:

In GetSymbol_impl at <my_path>/CppMicroServices/src/module/usModuleUtils.cpp:74 : GetSymbol_impl() failed: <my_path>/CppMicroServices/lib/libCppMicroServices.so: undefined symbol: _us_module_activator_instance_CppMicroServices

I'm stuck, however I suppose this is a simple problem for you.
Thanks for your attention.

Andrea, Italy

Offline

#2 2012-09-25 16:15:32

sascha
Administrator
Registered: 2012-05-04
Posts: 45

Re: Help to start

gcc -I <my_path>/CppMicroServices/include -o ActivatorExe -L <my_path>/CppMicroServices/lib -l CppMicroServices main.cpp

Offline

#3 2012-09-25 18:03:35

andzoff
Member
Registered: 2012-09-24
Posts: 7

Re: Help to start

[arcgis93@immagination Unpack]$ make
Scanning dependencies of target CppMicroServices
[  1%] Building CXX object src/CMakeFiles/CppMicroServices.dir/util/usAny.cpp.o
[  3%] Building CXX object src/CMakeFiles/CppMicroServices.dir/util/usThreads.cpp.o
[  5%] Building CXX object src/CMakeFiles/CppMicroServices.dir/util/usUtils.cpp.o
[  7%] Building CXX object src/CMakeFiles/CppMicroServices.dir/service/usLDAPExpr.cpp.o
[  9%] Building CXX object src/CMakeFiles/CppMicroServices.dir/service/usLDAPFilter.cpp.o
[ 11%] Building CXX object src/CMakeFiles/CppMicroServices.dir/service/usServiceException.cpp.o
[ 13%] Building CXX object src/CMakeFiles/CppMicroServices.dir/service/usServiceEvent.cpp.o
[ 15%] Building CXX object src/CMakeFiles/CppMicroServices.dir/service/usServiceListenerEntry.cpp.o
[ 16%] Building CXX object src/CMakeFiles/CppMicroServices.dir/service/usServiceListeners.cpp.o
[ 18%] Building CXX object src/CMakeFiles/CppMicroServices.dir/service/usServiceProperties.cpp.o
[ 20%] Building CXX object src/CMakeFiles/CppMicroServices.dir/service/usServiceReference.cpp.o
[ 22%] Building CXX object src/CMakeFiles/CppMicroServices.dir/service/usServiceReferencePrivate.cpp.o
[ 24%] Building CXX object src/CMakeFiles/CppMicroServices.dir/service/usServiceRegistration.cpp.o
[ 26%] Building CXX object src/CMakeFiles/CppMicroServices.dir/service/usServiceRegistrationPrivate.cpp.o
[ 28%] Building CXX object src/CMakeFiles/CppMicroServices.dir/service/usServiceRegistry.cpp.o
[ 30%] Building CXX object src/CMakeFiles/CppMicroServices.dir/module/usCoreModuleContext.cpp.o
[ 32%] Building CXX object src/CMakeFiles/CppMicroServices.dir/module/usModuleContext.cpp.o
[ 33%] Building CXX object src/CMakeFiles/CppMicroServices.dir/module/usModule.cpp.o
[ 35%] Building CXX object src/CMakeFiles/CppMicroServices.dir/module/usModuleEvent.cpp.o
[ 37%] Building CXX object src/CMakeFiles/CppMicroServices.dir/module/usModuleInfo.cpp.o
[ 39%] Building CXX object src/CMakeFiles/CppMicroServices.dir/module/usModulePrivate.cpp.o
[ 41%] Building CXX object src/CMakeFiles/CppMicroServices.dir/module/usModuleRegistry.cpp.o
[ 43%] Building CXX object src/CMakeFiles/CppMicroServices.dir/module/usModuleUtils.cpp.o
[ 45%] Building CXX object src/CMakeFiles/CppMicroServices.dir/module/usModuleVersion.cpp.o
[ 47%] Building CXX object src/CMakeFiles/CppMicroServices.dir/CppMicroServices_init.cpp.o
Linking CXX shared library ../lib/libCppMicroServices.so
[ 47%] Built target CppMicroServices
Scanning dependencies of target TestModuleSL4
[ 49%] Building CXX object test/modules/libSL4/CMakeFiles/TestModuleSL4.dir/usActivatorSL4.cpp.o
[ 50%] Building CXX object test/modules/libSL4/CMakeFiles/TestModuleSL4.dir/TestModuleSL4_init.cpp.o
Linking CXX shared library ../../../lib/libTestModuleSL4.so
[ 50%] Built target TestModuleSL4
Scanning dependencies of target TestModuleA2
[ 52%] Building CXX object test/modules/libA2/CMakeFiles/TestModuleA2.dir/usTestModuleA2.cpp.o
[ 54%] Building CXX object test/modules/libA2/CMakeFiles/TestModuleA2.dir/TestModuleA2_init.cpp.o
Linking CXX shared library ../../../lib/libTestModuleA2.so
[ 54%] Built target TestModuleA2
Scanning dependencies of target TestModuleSL3
[ 56%] Building CXX object test/modules/libSL3/CMakeFiles/TestModuleSL3.dir/usActivatorSL3.cpp.o
cc1plus: warnings being treated as errors
/mnt/storage/Develop/projects_lab/CppMicroServices/Unpack/include/usTrackedServiceListener_p.h:35: warning: ‘struct us::TrackedServiceListener’ has virtual functions but non-virtual destructor
make[2]: *** [test/modules/libSL3/CMakeFiles/TestModuleSL3.dir/usActivatorSL3.cpp.o] Error 1
make[1]: *** [test/modules/libSL3/CMakeFiles/TestModuleSL3.dir/all] Error 2
make: *** [all] Error 2

Offline

#4 2012-09-25 23:08:01

sascha
Administrator
Registered: 2012-05-04
Posts: 45

Re: Help to start

Hi,

thank you for the provided information. Everything you did looks correct.

I can confirm the build errors with gcc 4.1 when US_BUILD_TESTING is ON and just pushed a fix for it to the GitHub repository.

Additionally, I had a look at the output you mentioned using a gcc 4.1 toolchain. The behaviour is correct and the message is not an error, but an informational message (although it looks like one, admittedly). The GNU linker in the gcc 4.1 toolchain adds the CppMicroServies library as a link dependency to the executable, whereas the linker in a gcc 4.6 toolchain (for example) doesn't (for the specific uServices-activator snippet, it can inline all symbols from the CppMicroServices library and throws away the linker dependency). This explains the slightly different behavior.

So again, the message just says that it couldn't find a certain symbol in the CppMicroServices library, which is expected because it doesn't define that symbol. The symbol look-up is done for every library containing special C++ Micro Services initialization code and if the symbol exists, it is used to create an "activator" class and calls "start()" on it. The CppMicorServices library itself does not provide an activator.

If you want to get rid of such messages, either compile the C++ Micro Services project in release mode (set CMAKE_BUILD_TYPE to "Release") or add "-DUS_NO_DEBUG_OUTPUT" to the CMAKE_CXX_FLAGS CMake variable.

Best,
Sascha

Offline

#5 2012-09-28 18:16:43

andzoff
Member
Registered: 2012-09-24
Posts: 7

Re: Help to start

Offline

Board footer

Powered by FluxBB