#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: 46

Re: Help to start

Hi Andrea,

andzoff wrote:

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

Thank you for your interest in the C++ Micro Services project.

andzoff wrote:

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).

Please note that the snippet is so simple that it actually does not do anything. It only exists to make sure the code included in the doxygen documentation actually compiles.

andzoff wrote:

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.

While this message looks like an error, it actually isn't. The availability of this symbol is optional. However, I am wondering why the symbol is looked up in the first place so maybe you could answer the following questions:

1.) What is the CMake configuration you used to build the C++ Micro Services library? Especially the value of US_BUILD_SHARED_LIBS

2.) Did you also try enabling the US_BUILD_TESTING CMake variable and run the unit tests (by typing "ctest" in the build directory)?

3.) Do you get the same message when running

<my_path>/bin/snippets/uServices-activator

?

4.) Did you modify the main.cpp file and if yes could you post its contents?

If the answer to 3.) is "yes", could you please

5.) Add a breakpoint at <my_path>/CppMicroServices/src/module/usModuleUtils.cpp:74 and post the stack trace?

Thanks a lot,

Sascha

Offline

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

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

Re: Help to start

Hi,
thank you Sascha for answering me so quickly.
I apologize for my limited communication capabilities, but I'm not a native english speaker.
So, here are the answers for your questions:

1) I left the default configuration, so I suppose US_BUILD_SHARED_LIBS is on, 'cause in the CMakeCache.txt file I found:
us_cache_var(US_BUILD_SHARED_LIBS ON BOOL "Build shared libraries")
[I'm not experienced in cmake, but I started to learn it].

2) Initially, I left the default value:
us_cache_var(US_BUILD_TESTING OFF BOOL "Build tests")

3) I've no got the bin folder :-(

4) No modification to the main.cpp file

5) Tomorrow, with a collegue of mine I will try with the breakpoint

Well, after your message, I tried again, with the US_BUILD_TESTING set to ON in the CMakeCache.txt file.
I gave the following command:
cmake .
and then simply
make

During the compilation (make command) I got the following error:
[the entire make output is reported]

[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

now I've got the bin/snippets path, but is empty, 'cause the build was interrupted.
I add some information:

  • cmake version: 2.8.3

  • and I verified that without the US_BUILD_TESTING variable modification there is no compile error.

Thank you for your attention.

Offline

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

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

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

Hi Sascha and Hi everybody.
Well, now it's all ok.
I've compiled/built successfully on the following platform:

  • RHEL 5.4

  • CentOS 6.3

Now I've got binaries and examples.
I've a lot of stuff tu study!
Thank you for your support. If I would need further support, I'll open another thread.
Have a good weekend.

Andrea

Offline

Board footer

Powered by FluxBB