From 61ba985bc95290f6f29f70233ff345c8e15dbc09 Mon Sep 17 00:00:00 2001 From: "Daniel J. Hofmann" Date: Wed, 22 Jun 2016 11:43:30 +0200 Subject: [PATCH] Prevent linker from discarding TBB symbols we need, fixes #2557 We build `osrm_contract` (the library) linking in libtbb. We then build `osrm-contract` (the binary) linking in `osrm_contract` (the library). Because we're only using TBB's `parallel_invoke` in the code for the binary, it seems like the linker discards some symbols in the library. Therefore we have to link libtbb for the binary again. Even worse, the order now matters: if we first link in `osrm_contract` and then libtbb, we're still hitting the issue re. discarded symbols. Therefore we first link in all dependencies (libtbb, libboost*), and only then `osrm_contract`. Strictly speaking, we probably have to do this for all of our binary targets, or we will hit similar issues in the future. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2722a71d5..7789d42d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -320,7 +320,7 @@ include_directories(SYSTEM ${OSRM_INCLUDE_PATHS}) # Binaries target_link_libraries(osrm-datastore osrm_store ${Boost_LIBRARIES}) target_link_libraries(osrm-extract osrm_extract ${Boost_LIBRARIES}) -target_link_libraries(osrm-contract osrm_contract ${Boost_LIBRARIES}) +target_link_libraries(osrm-contract ${Boost_LIBRARIES} ${TBB_LIBRARIES} osrm_contract) target_link_libraries(osrm-routed osrm ${Boost_LIBRARIES} ${OPTIONAL_SOCKET_LIBS} ${ZLIB_LIBRARY}) set(EXTRACTOR_LIBRARIES