I upgraded to Mavericks, and am now unable to build my application after much troubleshooting.
During linking, I receive the errors
Undefined symbols for architecture x86_64:
"boost::python::objects::function_object(boost::python::objects::py_function const&, std::pair<boost::python::detail::keyword const*, boost::python::detail::keyword const*> const&)
.
.
.
"boost::python::objects::register_dynamic_id_aux(boost::python::type_info, std::pair<void*, boost::python::type_info> (*)(void*))"
I am using g++ from macports, specifically g++-mp-4.4. Clang is not an option for my project, as my project depends upon OpenMP, which is currently incompatible with Clang.
I have not been using the C++11 runtime, but the Boost.Python library from macports (the one I am using during linking) is linked against it.
otool -L libboost_python-mt.dylib
libboost_python-mt.dylib:
/opt/local/lib/libboost_python-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
Is this the root of my problem? Compiling part of my project with Clang succeeds (and hurdles this linking error stage), yet as I mentioned, I required OpenMP.
Notably, running:
nm libboost_python-mt.dylib | c++filt | grep boost::python::objects::function_object
outputs
0000000000013d60 T boost::python::objects::function_object(boost::python::objects::py_function const&)
0000000000013d00 T boost::python::objects::function_object(boost::python::objects::py_function const&, std::__1::pair<boost::python::detail::keyword const*, boost::python::detail::keyword const*> const&)
which have std::__1 prefixes, which do not match what is expected in the undefined symbols errors...
The solution was achieved by installing and linking against a version of Boost that was not compiled with c++11. The version of Boost provided by Macports apparently built Boost.Python with C++11, despite the fact that I specifically set the Macports compiler to be g++-mp-4.4, which should not be able to build with C++11...
Note that at the time of writing, it is quite difficult to install Boost libraries compiled with g++ via Macports, and I eventually installed Boost libraries from source.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With