python - 未加载库:@rpath/libboost_thread.dylib
问题描述
我在 boost Jamroot 的帮助下构建了一个基于 boost python 的 .so 文件,以便在 Python 中使用 .so。当我在 Python 中导入库时,出现以下错误:
import vision_library
ImportError: dlopen(/../Vision/pyVision/python_scripts/vision_library.so, 2): Library not loaded: @rpath/libboost_thread.dylib
Referenced from: /../Vision/pyVision/python_scripts/vision_library.so
Reason: image not found
这是果酱:
# Copyright David Abrahams 2006. Distributed under the Boost
# Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
import option ;
import feature ;
import python ;
if ! [ python.configured ]
{
ECHO "notice: no Python configured in user-config.jam" ;
ECHO "notice: will use default configuration" ;
using python : 2.7 ;
}
# Platform architecture provided as an environment variable
import os ;
local ARCH = [ os.environ ARCH ] ;
# Specify the path to the Boost project. If you move this project,
# adjust this path to refer to the Boost root directory.
use-project boost
: ../../thirdparty/boost/boost_1_62_0 ;
alias boost_dependencies
: /boost/python//boost_python
/boost/thread//boost_thread
;
lib opencv_core : : <name>libopencv_core <search>../../thirdparty/opencv/build/lib/ ;
lib opencv_features2d : : <name>libopencv_features2d <search>../../thirdparty/opencv/build/lib/ ;
lib opencv_video : : <name>libopencv_video <search>../../thirdparty/opencv/build/lib/ ;
lib opencv_videoio : : <name>libopencv_videoio <search>../../thirdparty/opencv/build/lib/ ;
lib opencv_videostab : : <name>libopencv_videostab <search>../../thirdparty/opencv/build/lib/ ;
lib opencv_ml : : <name>libopencv_ml <search>../../thirdparty/opencv/build/lib/ ;
lib opencv_imgproc : : <name>libopencv_imgproc <search>../../thirdparty/opencv/build/lib/ ;
lib opencv_objdetect : : <name>libopencv_objdetect <search>../../thirdparty/opencv/build/lib/ ;
# Set up the project-wide requirements that everything uses the
# boost_python library from the project whose global ID is
# /boost/python.
project
: requirements <library>boost_dependencies
<include>../
<include>../../
<include>../../Common/include
<include>../../PythonShared/include
<include>../../Vision/include
<include>../../thirdparty/opencv/build/include
<include>/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include
: requirements <library>../../Common/build/$(ARCH)/lib/libCommon.a
<library>../../Vision/build/$(ARCH)/lib/libVision.a
<library-path>../../thirdparty/opencv/build/lib/
<linkflags>-lm
<linkflags>-lpthread
<linkflags>-lopencv_core
<linkflags>-lopencv_features2d
<linkflags>-lopencv_video
<linkflags>-lopencv_videoio
<linkflags>-lopencv_videostab
<linkflags>-lopencv_ml
<linkflags>-lopencv_imgproc
<linkflags>-lopencv_objdetect
;
# Declare the three extension modules. You can specify multiple
# source files after the colon separated by spaces.
python-extension vision_library : src/pyboost_cv3_converter.cpp
src/PythonBindings.cpp
src/PythonDocumentScanner.cpp
src/PythonFaceDetector.cpp
src/PythonModule.cpp
src/PythonMotionDetector.cpp
src/PythonMotionDetectorConfiguration.cpp
src/PythonMotionDetectorResult.cpp
src/PythonOfflineVideoStabilizer.cpp
src/PythonStreamingVideoStabilizer.cpp
src/PythonTimeLapser.cpp
src/Trace.cpp ;
install boost_libraries
: boost_dependencies
;
# A little "rule" (function) to clean up the syntax of declaring tests
# of these extension modules.
local rule run-test ( test-name : sources + )
{
import testing ;
testing.make-test run-pyd : $(sources) : : $(test-name) ;
}
# Declare test targets
# run-test hello : vision_library test.py ;
如何解决 rpath 问题?
解决方案
不确定它是否有帮助,但我通过删除以下内容解决了这个问题:
/boost/thread//boost_thread
推荐阅读
- node.js - if-else 无法在 Typescript 中输入检查
- android - 如何创建一个从多个列表中获取属性的小部件列表?
- python - Discord - 将消息从频道实时发送到我的网站
- reactjs - 带有 JSON 数据的 Redux Store 的初始状态?
- adblock - 如何仅过滤 youtube.com 页面而不是域的 Adblock?
- reactjs - 我怎么能等待我的回应 - 在我的模拟函数中的开玩笑测试
- apache-kafka - KafkaProducer - 订购保证
- reactjs - React 错误:对象作为 React 子级无效(找到:[object Promise])。如果您打算渲染一组孩子,请改用数组
- r - 如何根据配对向量中的值选择一行?
- ios - 如何在运行时更改 collectionveiw 标头中的标签文本位置?