diff options
author | Lutz Bichler <Lutz.Bichler@bmw.de> | 2014-09-24 13:34:33 +0200 |
---|---|---|
committer | Lutz Bichler <Lutz.Bichler@bmw.de> | 2014-09-24 13:34:33 +0200 |
commit | aca8edf3e3d4180f94cbdaa75c1fd514ec0c8508 (patch) | |
tree | 1406b6bfb888f77d849d949e0f8ea4d526c5d5b4 | |
parent | f141e95605ac539d1d091d14b5308c10df7fd859 (diff) | |
download | vSomeIP-aca8edf3e3d4180f94cbdaa75c1fd514ec0c8508.tar.gz |
[PATCH 3/8] CMakeLists.txt: find and link Threads explicitly
When compile the sources with the bitbake/OpenEmbedded-Core tool
chain with versions bitbake: 1.23.1 and openembedded-core:
47d1fc9f5c38f3d092937c47bd4c2f45adaa7fe6, it fails when linking
with:
Linking CXX executable magic-cookies-test-client
/[...]/build/tmp-eglibc/sysroots/x86_64-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/4.9.1/ld: CMakeFiles/magic-cookies-test-client.dir/test/magic-cookies-test-client.cpp.o: undefined reference to symbol 'pthread_key_delete@@GLIBC_2.4'
/[...]/build/tmp-eglibc/sysroots/qemuarm/lib/libpthread.so.0: error adding symbols: DSO missing from command line
This commit resolves the failure by explicitly searching for the
Threads library and linking it against the executable. It has been
successfully tested on Ubuntu Linux 14.04 and the above mentioned
tool chain.
The CMake manuals mention that this solution should also work on
other platforms, e.g., Windows, BSD and Mac OS X. However, due to
the unavailability of development environments for the other
platforms, this commit was not tested on them. The linking problem
only occurs for the magic-cookies-test-client executable, but not
with the other executables. It is probably mostly related to the
setup of the tool chain and the specific way of linking for the one
executable. However, the deeper cause for this failure remains
unclear.
Signed-off-by: Lukas Bulwahn, BMW Car IT GmbH <Lukas.Bulwahn@bmw.de>
-rw-r--r-- | CMakeLists.txt | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e93f405..387da21 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,6 +56,8 @@ set (CMAKE_CXX_FLAGS "-D${OS} -DUSE_VSOMEIP_STATISTICS -DBOOST_LOG_DYN_LINK -g $ include_directories(
"interface"
)
+# Threads
+find_package(Threads REQUIRED)
# Boost
find_package( Boost 1.54 COMPONENTS system thread log REQUIRED )
@@ -100,7 +102,7 @@ add_executable(configuration-test test/configuration-test.cpp) target_link_libraries(configuration-test vsomeip ${Boost_LIBRARIES} ${DL_LIBRARY})
add_executable(magic-cookies-test-client test/magic-cookies-test-client.cpp)
-target_link_libraries(magic-cookies-test-client vsomeip ${Boost_LIBRARIES} ${DL_LIBRARY})
+target_link_libraries(magic-cookies-test-client vsomeip ${Boost_LIBRARIES} ${DL_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
###################################################################################################
|