Trouble linking with boost::program_options on OSX 10.7
Hi, I have boost 1.49 installed through homebrew on OSX 10.7. I'm attempting to compile a program making use of boost::program_options. I get the following error: Undefined symbols for architecture x86_64: "boost::program_options::detail::cmdline::get_canonical_option_prefix()", referenced from: boost::program_options::basic_command_line_parser<char>::run() in meanshift_clustering.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) I clearly remember that this used to compile in the past. In the meantime I had uninstalled and re-installed boost a few times. I double-checked the invocation though, the paths are correct: Ld Debug/meanshift_clustering normal x86_64 cd myproject setenv MACOSX_DEPLOYMENT_TARGET 10.7 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -Lmyproject/Debug -Fmyproject/Debug -filelist myproject/myproject.build/Debug/meanshift_clustering.build/Objects-normal/x86_64/meanshift_clustering.LinkFileList -mmacosx-version-min=10.7 -Wl,-search_paths_first -Wl, -headerpad_max_install_names myproject/Debug/libmyproject.dylib /usr/local/lib/libradolan.dylib /usr/local/lib/libnetcdf_c++.dylib /usr/local/lib/libnetcdf.dylib /usr/local/lib/libboost_system-mt.dylib /usr/local/lib/libboost_program_options-mt.dylib /usr/local/lib/libboost_thread-mt.dylib /usr/local/lib/libhdf5.dylib /usr/local/lib/libhdf5_hl.dylib -o myproject/Debug/meanshift_clustering I checked with nm if the symbol is in /usr/local/lib/libboost_program_options-mt.dylib and it is not. This makes me think it's some kind of problem with boost. I do not reference this symbol in my code directly, anywhere. -- View this message in context: http://boost.2283326.n4.nabble.com/Trouble-linking-with-boost-program-option... Sent from the Boost - Users mailing list archive at Nabble.com.
On 22.06.2012 20:45, Jürgen Simon wrote:
Hi,
I have boost 1.49 installed through homebrew on OSX 10.7. I'm attempting to compile a program making use of boost::program_options. I get the following error:
Undefined symbols for architecture x86_64: "boost::program_options::detail::cmdline::get_canonical_option_prefix()", referenced from: boost::program_options::basic_command_line_parser<char>::run() in meanshift_clustering.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
I clearly remember that this used to compile in the past. In the meantime I had uninstalled and re-installed boost a few times. I double-checked the invocation though, the paths are correct:
Ld Debug/meanshift_clustering normal x86_64 cd myproject setenv MACOSX_DEPLOYMENT_TARGET 10.7
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -Lmyproject/Debug -Fmyproject/Debug -filelist myproject/myproject.build/Debug/meanshift_clustering.build/Objects-normal/x86_64/meanshift_clustering.LinkFileList -mmacosx-version-min=10.7 -Wl,-search_paths_first -Wl, -headerpad_max_install_names myproject/Debug/libmyproject.dylib /usr/local/lib/libradolan.dylib /usr/local/lib/libnetcdf_c++.dylib /usr/local/lib/libnetcdf.dylib /usr/local/lib/libboost_system-mt.dylib /usr/local/lib/libboost_program_options-mt.dylib /usr/local/lib/libboost_thread-mt.dylib /usr/local/lib/libhdf5.dylib /usr/local/lib/libhdf5_hl.dylib -o myproject/Debug/meanshift_clustering
I checked with nm if the symbol is in /usr/local/lib/libboost_program_options-mt.dylib and it is not. This makes me think it's some kind of problem with boost. I do not reference this symbol in my code directly, anywhere.
Hi Jürgen, are you sure you are now using trunk header files, while linking to 1.49 library? To verify, you can compile meanshift_clustering.o with the -save-temps options, and look at .ii file. HTH, Volodya
participants (2)
-
Jürgen Simon
-
Vladimir Prus