在MacOS 10.9(Mavericks)上构建Boost.Python应用程序 [英] Building a Boost.Python application on MacOS 10.9 (Mavericks)

查看:410
本文介绍了在MacOS 10.9(Mavericks)上构建Boost.Python应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在连结过程中,我收到错误

 架构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 *))

我从macports使用g ++,特别是g ++ - mp-4.4。Clang不是我的选择项目,因为我的项目依赖于OpenMP,目前与Clang不兼容。



我没有使用C ++ 11运行时,但Boost.Python库

  otool -L libboost_python-mt.dylib 
libboost_python-mt.dylib:
/opt/local/lib/libboost_python-mt.dylib(兼容性版本0.0.0,当前版本0.0.0)
/ opt / local / Library / Frameworks / Python .framework / Versions / 2.7 / Python(兼容性版本2.7.0,当前版本2.7.0)
/usr/lib/libc++.1.dylib(兼容性版本1.0.0,当前版本120.0.0)
/usr/lib/libSystem.B.dylib(兼容性版本1.0.0,当前版本1197.1.1)


$ b b

这是我的问题的根源吗?



值得注意的是,运行:

  nm libboost_python-mt.dylib | c ++ filt | grep boost :: python :: objects :: function_object 

输出

  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 ::关键字const *,boost :: python :: detail: :keyword const *> const&)

它们有std :: __ 1个前缀,什么是未定义的符号错误...

解决方案

解决方案是通过安装和链接一个版本的Boost不是用c ++ 11编译的。 Macports提供的Boost版本显然使用C ++ 11构建了Boost.Python,尽管我特别将Macports编译器设置为g ++ - mp-4.4,但不能使用C ++ 11构建。 。



请注意,在编写本书时,很难安装通过Macports使用g ++编译的Boost库,我最终从源代码安装了Boost库。


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.

这篇关于在MacOS 10.9(Mavericks)上构建Boost.Python应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆