繁体   English   中英

libboost_python3缺少与Python的动态链接?

[英]libboost_python3 missing dynamic link to Python?

我一直在挣扎了几天得到image_proc为ROS2去。 它链接到vision_opencv ,后者又链接到libboost_python3

现在尝试运行此命令,我熟悉了:

dyld: Symbol not found: _PyBaseObject_Type
  Referenced from: /usr/local/opt/boost-python3/lib/libboost_python37.dylib
  Expected in: flat namespace
 in /usr/local/opt/boost-python3/lib/libboost_python37.dylib

使用nm工具的进一步调查得出:

nm -u /usr/local/opt/boost-python3/lib/libboost_python37.dylib | grep _PyBaseObject_Type

_PyBaseObject_Type

_PyBaseObject_Type在libboost_python37确实是不确定的。

让我们看一下链接到libboost_python37的库:

otool -L /usr/local/opt/boost-python3/lib/libboost_python37.dylib

usr/local/opt/boost-python3/lib/libboost_python37.dylib:
    /usr/local/opt/boost-python3/lib/libboost_python37.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)

它缺少到Python的任何动态链接,这使我想到了第一个问题:

  • python应该链接到libboost_python37吗?

我在网上的其他地方看到过一个老问题,有人在其中发布了来自otool -L的输出(包括-mt文件,但我的mt也没有)。

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)

(它们的输出)

我的第二个问题:

  • 有谁知道问题是什么或如何解决?

由于我使用的是ROS2构建工具colcon ,而不仅仅是直接编译,因此事情变得更加复杂。

一些其他信息:有人建议通过将libboost_python37.dylib链接到libboost_python3.dylib来解决此错误,因为无法拾取它。 这不是问题,也无法解决。

我还安装了Brew的boost和boost-python3,并在两个地方自己编译。 Python命令是最新的python 3.7.3,它是python中的“默认” python --version提供3.7.3。

第一个问题:

python应该链接到libboost_python37吗?

似乎没有必要,如此处https://www.mail-archive.com/distutils-sig@python.org/msg23796.html和此处https://github.com/Cantera/cantera/issues/319所示

有些库链接,有些则没有。

有谁知道问题是什么或如何解决?

我找到了一个我根本不喜欢的解决方法,因为我仍然不知道根本原因是什么。

将您的Python3库添加到DYLD_INSERT_LIBRARIES env变量即可使其工作:

export DYLD_INSERT_LIBRARIES=/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/Python

警告 :这使Virtualenv / pipenv停止工作。

这确认它丢失了,并且从Brew安装时Mojave无法将其捡起。 希望别人确认这是Brew / Mojave / Boost或image_proc ROS2 CMakeLists.txt的问题。

归功于这个答案: https : //stackoverflow.com/a/1990844/1829511

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM