Bug #617

Check CMake Boost Find Macro for MacOS Compatibility

Added by S. Wrede over 12 years ago. Updated over 12 years ago.

Status:ResolvedStart date:10/07/2011
Priority:LowDue date:
Assignee:-% Done:

100%

Category:Configuration
Target version:0.5

Description

If multiple types of the same boost library are installed (e.g. -d + -mt) it happens that RSB links under Snow Leopard against both boot libraries, resulting in undefined behavior at program startup.

If only a single boost variant is installed, everything works flawlessly except the linker still warning that it links against duplicate library entries.

Associated revisions

Revision 9f14ac04
Added by J. Wienke over 12 years ago

try to prevent double linking.

Does this work?

fixes #617

History

#1 Updated by J. Wienke over 12 years ago

  • Status changed from New to Feedback

This is probay an upstream bug in cmake as they provide the macro. the only thing i could imagine is that you compiled rsc with a different build type than rsb. under windows this causes troubles because cmake tries to find the boost version that matches the cmake build type and hence rsc would belinked against a different boost type than rsb itself.

#2 Updated by S. Wrede over 12 years ago

I just started reinstalling both library types (mt + d) to check if I can reproduce the problem. What I already get (probably independent of the other problem) at the level of RSC are warnings about duplicate library entries:

Linking CXX executable ../build/TypeStringTools
ld: warning: duplicate dylib /opt/local/lib/libboost_thread-mt-d.dylib
ld: warning: duplicate dylib /opt/local/lib/libboost_filesystem-mt-d.dylib
ld: warning: duplicate dylib /opt/local/lib/libboost_signals-mt-d.dylib
ld: warning: duplicate dylib /opt/local/lib/libboost_program_options-mt-d.dylib
ld: warning: duplicate dylib /opt/local/lib/libboost_system-mt-d.dylib
[ 70%] Built target TypeStringTools

#3 Updated by J. Wienke over 12 years ago

Can you post the linker command line (make VERBOSE=1)? and can yoz hav a look at what BOOST_LIBRARIES e.g. in the cmake cache? If there are no duplicate this is most likely an upstream bug.

#4 Updated by S. Wrede over 12 years ago

Linker command:

cd /Users/swrede/Workspace/RSC/build/examples && /opt/local/bin/cmake -E cmake_link_script CMakeFiles/TypeStringTools.dir/link.txt --verbose=1
/opt/local/bin/c++   -g -Wl,-search_paths_first -Wl,-headerpad_max_install_names  CMakeFiles/TypeStringTools.dir/TypeStringTools.cpp.o  -o ../build/TypeStringTools  -L/opt/local/lib /opt/local/lib/libboost_thread-mt-d.dylib /opt/local/lib/libboost_filesystem-mt-d.dylib /opt/local/lib/libboost_signals-mt-d.dylib /opt/local/lib/libboost_program_options-mt-d.dylib /opt/local/lib/libboost_system-mt-d.dylib ../build/librsc.0.5.0.dylib /opt/local/lib/libboost_thread-mt-d.dylib /opt/local/lib/libboost_filesystem-mt-d.dylib /opt/local/lib/libboost_signals-mt-d.dylib /opt/local/lib/libboost_program_options-mt-d.dylib /opt/local/lib/libboost_system-mt-d.dylib 
ld: warning: duplicate dylib /opt/local/lib/libboost_thread-mt-d.dylib
ld: warning: duplicate dylib /opt/local/lib/libboost_filesystem-mt-d.dylib
ld: warning: duplicate dylib /opt/local/lib/libboost_signals-mt-d.dylib
ld: warning: duplicate dylib /opt/local/lib/libboost_program_options-mt-d.dylib
ld: warning: duplicate dylib /opt/local/lib/libboost_system-mt-d.dylib
/opt/local/bin/cmake -E cmake_progress_report /Users/swrede/Workspace/RSC/build/CMakeFiles  4
[100%] Built target TypeStringTools
/opt/local/bin/cmake -E cmake_progress_start /Users/swrede/Workspace/RSC/build/CMakeFiles 0

In build/CMakeCache.txt, I couldn't find the BOOST_LIBRARIES variable. However, there is a variable rsc_dependencies which looks as follows:

//Dependencies for the target
rsc_LIB_DEPENDS:STATIC=optimized;/opt/local/lib/libboost_thread-mt.dylib;debug;/opt/local/lib/libboost_thread-mt-d.dylib;optimized;/opt/local/lib/libboost_filesystem-mt.dylib;debug;/opt/local/lib/libboost_filesystem-mt-d.dylib;optimized;/opt/local/lib/libboost_signals-mt.dylib;debug;/opt/local/lib/libboost_signals-mt-d.dylib;optimized;/opt/local/lib/libboost_program_options-mt.dylib;debug;/opt/local/lib/libboost_program_options-mt-d.dylib;optimized;/opt/local/lib/libboost_system-mt.dylib;debug;/opt/local/lib/libboost_system-mt-d.dylib;

#5 Updated by J. Wienke over 12 years ago

Ok, the same double linking also happens on linux, but GCC here is not that picky about it.

#6 Updated by J. Wienke over 12 years ago

Eh, but the linker command line you showed is from RSC... So there must be the same issue?

#7 Updated by J. Wienke over 12 years ago

  • Status changed from Feedback to Resolved
  • % Done changed from 0 to 100

Applied in changeset r2829.

#8 Updated by S. Wrede over 12 years ago

Yes, the same issue applied to RSC. Compiling RSB, I still got for instance the following warning:

[ 81%] Building CXX object test/CMakeFiles/rsbtest.dir/rsb/InformerTask.cpp.o
[ 81%] Building CXX object test/CMakeFiles/rsbtest_core.dir/rsb/EventIdTest.cpp.o
Linking CXX executable ../build/rsbtest
ld: warning: duplicate dylib /opt/local/lib/libboost_regex-mt-d.dylib
ld: warning: duplicate dylib /opt/local/lib/libboost_date_time-mt-d.dylib

#9 Updated by J. Moringen over 12 years ago

  • Target version changed from rsb-0.10 to 0.5

Also available in: Atom PDF