Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/125.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在MacOS X上设置install_name building boost 1.60.0?_Python_C++_Macos_Boost_Linker - Fatal编程技术网

Python 在MacOS X上设置install_name building boost 1.60.0?

Python 在MacOS X上设置install_name building boost 1.60.0?,python,c++,macos,boost,linker,Python,C++,Macos,Boost,Linker,使用标准: % ./bootstrap.sh % sudo ./b2 install 在MacOS 10.11.2上构建Boost v1.60.0,但是libboost*.dylib文件上的install_name条目是相对的,没有绝对路径: % otool -D /usr/local/lib/libboost_python.dylib 产生 /usr/local/lib/libboost_python.dylib: libboost_python.dylib 如果试图将libboost_

使用标准:

% ./bootstrap.sh
% sudo ./b2 install
在MacOS 10.11.2上构建Boost v1.60.0,但是libboost*.dylib文件上的install_name条目是相对的,没有绝对路径:

% otool -D /usr/local/lib/libboost_python.dylib
产生

/usr/local/lib/libboost_python.dylib:
libboost_python.dylib
如果试图将libboost_python.dylib与苹果的标准python结合使用,就会出现问题。苹果的标准python抱怨在使用Boost.python导入库时不安全地使用相对rpath:

% python
>>> import mylibrary

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/path/to/mylibrary.so, 2): Library not loaded: libboost_chrono.dylib
  Referenced from: /path/to/mylibrary.so
  Reason: unsafe use of relative rpath libboost_chrono.dylib in /path/to/mylibrary.so with restricted binary
几乎可以解决这一问题,除了从一个libboost_u库到另一个libboost_u库的引用(即链接到libboost_u原子的libboost_u线程)在编译boost期间保持相对状态,因此需要在编译期间运行install_name_u工具。或者,使用非标准Python也不会有任何问题。但我希望能够指定在构建Boost时正确生成的install_名称,理想情况下作为b2的参数,但还不能确定如何生成?我试过(无可否认,这是一次远大的尝试):

没有成功

sudo install_name_tool -id /usr/local/lib/libboost_chrono.dylib /usr/local/lib/libboost_chrono.dylib
sudo ./b2 dll-path=/usr/local/lib install