Bug #1145

Linking fails with undefined symbol on MacOS with boost 1.50

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

Status:ResolvedStart date:08/20/2012
Priority:NormalDue date:
Assignee:S. Wrede% Done:

100%

Category:-
Target version:Robotics Service Bus - rsb-0.9

Description

Next issue with boost 1.50:

Linking CXX shared library ../build/libregistry.dylib
Undefined symbols for architecture x86_64:
  "boost::system::generic_category()", referenced from:
      ___cxx_global_var_init1 in testRegistry.cpp.o
      ___cxx_global_var_init2 in testRegistry.cpp.o
  "boost::system::system_category()", referenced from:
      ___cxx_global_var_init3 in testRegistry.cpp.o
      boost::thread_exception::thread_exception(int, char const*) in testRegistry.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [build/libregistry.dylib] Error 1
make[1]: *** [test/CMakeFiles/registry.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

This error applies to head but also to earlier versions. Fixes should at least be applied also to the 0.7 branch as it is actively used on MacOS with homebrew (which installs boost 1.50).

Associated revisions

Revision 7ea1fe68
Added by S. Wrede over 11 years ago

added target link libraries to libregistry, refs #1145

Revision f915a2b2
Added by S. Wrede over 11 years ago

added target link libraries to libregistry, refs #1145

History

#1 Updated by S. Wrede over 11 years ago

  • Subject changed from Linking fails with undefined symbol on MacOS with boot 1.50 to Linking fails with undefined symbol on MacOS with boost 1.50

#2 Updated by S. Wrede over 11 years ago

Suspicion: it could be lacking boost_system:

Output of make VERBOSE=1:

cd /Users/swrede/Workspace/rsc/build/test && /usr/local/Cellar/cmake/2.8.9/bin/cmake -E cmake_link_script CMakeFiles/registry.dir/link.txt --verbose=1
/usr/bin/c++   -shared   -o ../build/libregistry.dylib -install_name /Users/swrede/Workspace/rsc/build/build/libregistry.dylib CMakeFiles/registry.dir/rsc/misc/testRegistry.cpp.o -L/usr/local/lib
Undefined symbols for architecture x86_64:
  "boost::system::generic_category()", referenced from:
      ___cxx_global_var_init1 in testRegistry.cpp.o
      ___cxx_global_var_init2 in testRegistry.cpp.o
  "boost::system::system_category()", referenced from:
      ___cxx_global_var_init3 in testRegistry.cpp.o
      boost::thread_exception::thread_exception(int, char const*) in testRegistry.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [build/libregistry.dylib] Error 1
make[1]: *** [test/CMakeFiles/registry.dir/all] Error 2
make: *** [all] Error 2

This (adding boost_system) instead seems to work:

device-07f5f8:test swrede$ /usr/bin/c++   -shared   -o ../build/libregistry.dylib -install_name /Users/swrede/Workspace/rsc/build/build/libregistry.dylib CMakeFiles/registry.dir/rsc/misc/testRegistry.cpp.o -L/usr/local/lib -lboost_system-mt

#3 Updated by S. Wrede over 11 years ago

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

Fixed with 7ea1fe68 on master and f915a2b2 on the 0.7 branch. Works for me on MacOS with homebrew.

@Jan, Johannes: Could somebody please review if the change makes sense?

Also available in: Atom PDF