Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error building Python bindings with boost-python 1.56 #87

Closed
beniz opened this issue Dec 19, 2014 · 8 comments
Closed

Error building Python bindings with boost-python 1.56 #87

beniz opened this issue Dec 19, 2014 · 8 comments

Comments

@beniz
Copy link
Collaborator

beniz commented Dec 19, 2014

The following error has been observed on OS X, more tests required to reproduce and fix:

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&)", referenced from:
      init_module_lcmaes()     in lcmaes.o
      boost::python::class_<libcmaes::CMAParameters<libcmaes::GenoPheno<libcmaes::NoBoundStrategy, libcmaes::NoScalingStrategy> >, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>::class_(char const*, char const*) in lcmaes.o
      boost::python::class_<libcmaes::CMAParameters<libcmaes::GenoPheno<libcmaes::NoBoundStrategy, libcmaes::NoScalingStrategy> >, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>& boost::python::class_<libcmaes::CMAParameters<libcmaes::GenoPheno<libcmaes::NoBoundStrategy, libcmaes::NoScalingStrategy> >, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>::def<void (libcmaes::CMAParameters<libcmaes::GenoPheno<libcmaes::NoBoundStrategy, libcmaes::NoScalingStrategy> >::*)()>(char const*, void (libcmaes::CMAParameters<libcmaes::GenoPheno<libcmaes::NoBoundStrategy, libcmaes::NoScalingStrategy> >::*)()) in lcmaes.o
      boost::python::class_<libcmaes::CMAParameters<libcmaes::GenoPheno<libcmaes::NoBoundStrategy, libcmaes::NoScalingStrategy> >, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>& boost::python::class_<libcmaes::CMAParameters<libcmaes::GenoPheno<libcmaes::NoBoundStrategy, libcmaes::NoScalingStrategy> >, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>::def<void (libcmaes::CMAParameters<libcmaes::GenoPheno<libcmaes::NoBoundStrategy, libcmaes::NoScalingStrategy> >::*)(int const&)>(char const*, void (libcmaes::CMAParameters<libcmaes::GenoPheno<libcmaes::NoBoundStrategy, libcmaes::NoScalingStrategy> >::*)(int const&)) in lcmaes.o
      boost::python::class_<libcmaes::CMAParameters<libcmaes::GenoPheno<libcmaes::NoBoundStrategy, libcmaes::NoScalingStrategy> >, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>& boost::python::class_<libcmaes::CMAParameters<libcmaes::GenoPheno<libcmaes::NoBoundStrategy, libcmaes::NoScalingStrategy> >, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>::def<void (libcmaes::Parameters<libcmaes::GenoPheno<libcmaes::NoBoundStrategy, libcmaes::NoScalingStrategy> >::*)(int const&)>(char const*, void (libcmaes::Parameters<libcmaes::GenoPheno<libcmaes::NoBoundStrategy, libcmaes::NoScalingStrategy> >::*)(int const&)) in lcmaes.o
      boost::python::class_<libcmaes::CMAParameters<libcmaes::GenoPheno<libcmaes::NoBoundStrategy, libcmaes::NoScalingStrategy> >, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>& boost::python::class_<libcmaes::CMAParameters<libcmaes::GenoPheno<libcmaes::NoBoundStrategy, libcmaes::NoScalingStrategy> >, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>::def<int (libcmaes::Parameters<libcmaes::GenoPheno<libcmaes::NoBoundStrategy, libcmaes::NoScalingStrategy> >::*)() const>(char const*, int (libcmaes::Parameters<libcmaes::GenoPheno<libcmaes::NoBoundStrategy, libcmaes::NoScalingStrategy> >::*)() const) in lcmaes.o
      boost::python::class_<libcmaes::CMAParameters<libcmaes::GenoPheno<libcmaes::NoBoundStrategy, libcmaes::NoScalingStrategy> >, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>& boost::python::class_<libcmaes::CMAParameters<libcmaes::GenoPheno<libcmaes::NoBoundStrategy, libcmaes::NoScalingStrategy> >, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>::def<void (libcmaes::Parameters<libcmaes::GenoPheno<libcmaes::NoBoundStrategy, libcmaes::NoScalingStrategy> >::*)(double const&)>(char const*, void (libcmaes::Parameters<libcmaes::GenoPheno<libcmaes::NoBoundStrategy, libcmaes::NoScalingStrategy> >::*)(double const&)) in lcmaes.o
      ...
  "boost::python::objects::register_dynamic_id_aux(boost::python::type_info, std::pair<void*, boost::python::type_info> (*)(void*))", referenced from:
      boost::python::class_<libcmaes::CMAParameters<libcmaes::GenoPheno<libcmaes::NoBoundStrategy, libcmaes::NoScalingStrategy> >, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>::class_(char const*, char const*) in lcmaes.o
      boost::python::class_<libcmaes::CMAParameters<libcmaes::GenoPheno<libcmaes::pwqBoundStrategy, libcmaes::NoScalingStrategy> >, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>::class_(char const*, char const*) in lcmaes.o
      boost::python::class_<libcmaes::CMAParameters<libcmaes::GenoPheno<libcmaes::NoBoundStrategy, libcmaes::linScalingStrategy> >, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>::class_(char const*, char const*) in lcmaes.o
      boost::python::class_<libcmaes::CMAParameters<libcmaes::GenoPheno<libcmaes::pwqBoundStrategy, libcmaes::linScalingStrategy> >, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>::class_(char const*, char const*) in lcmaes.o
      void def_function<double (boost::python::list const&, int const&)>(char const*, char const*) in lcmaes.o
      boost::python::class_<libcmaes::CMASolutions, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>::class_(char const*, char const*) in lcmaes.o
      boost::python::class_<libcmaes::Candidate, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>::class_(char const*, char const*) in lcmaes.o
@beniz
Copy link
Collaborator Author

beniz commented Dec 19, 2014

This cannot be reproduced on Ubuntu with boost_python 1.56, so it may very much be OSX specific, and maybe related to macports not providing a proper x86_64 build. Will continue investigations.

@beniz
Copy link
Collaborator Author

beniz commented Jan 7, 2015

This appears to be a problem with macport not providing a build of boost for gcc, affecting only some versions of OSX. The problem with clang #19 is now fixed, and libcmaes should compile fine without the need for gcc, thus avoiding this problem. Will wait til next release for closing this one though.

@nikohansen
Copy link
Collaborator

regarding the doc, python part, at https://github.com/beniz/libcmaes/wiki/Building-libcmaes-on-Mac-OSX:

I believe it assumes that python is/was installed via mac ports (while installing mac ports is the first point to do). I linked the python I am using

 sudo ln -s /Users/hansen/anaconda/bin/python /opt/local/bin/python 

and it seemed to work fine as well. I assume we need to have numpy installed which can be typically done by

pip install numpy

(hopefully for the currently active python installation). I still can only use the lib then by calling /opt/local/bin/python rather than python, I am trying to figure out a way around this.

@beniz
Copy link
Collaborator Author

beniz commented Jan 7, 2015

regarding the doc, python part, at https://github.com/beniz/libcmaes/wiki/Building-libcmaes-on-Mac-OSX:

I believe it assumes that python is/was installed via mac ports (while installing mac ports is the first point to do).

Yes you're right. I am still trying to get it to work with OSX's python (i.e. without the macports one), but boost-python, which bridges C++ with python seems to rely on the macport version. Still investigating (compilation is fine, with /usr/bin/python isn't).

@beniz
Copy link
Collaborator Author

beniz commented Jan 7, 2015

I still can only use the lib then by calling /opt/local/bin/python rather than python, I am trying to figure out a way around this.

maybe something like this can help:

export PATH=/opt/local/bin:$PATH

@nikohansen
Copy link
Collaborator

I believe I don't even have macports python installed (and I definitely deinstalled port's py-numpy), so for me it does work with anaconda python.

EDIT: I think I was wrong, it is still the Python from Macports, even though it gives an "Anaconda is brought to you by..." message on startup for some reason.

@beniz
Copy link
Collaborator Author

beniz commented Jan 7, 2015

OK great! I will report on whether I succeed with the original python version from OSX.

@beniz
Copy link
Collaborator Author

beniz commented Jan 20, 2015

I am not successful with OSX Python, but I believe this would be another ticket.

Closing this due to the fix with clang that makes the boost issue obsolete. But can reopen if it occurs again. My leading hypothesis still being a missing gcc-compiled boost version in last macports.

@beniz beniz closed this as completed Jan 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants