[英]Error when using python to wrap up my c++ code into *.so file
I have a small project wrote in c++, and now I am going to build it into *.so file. 我有一个用c ++编写的小项目,现在我将其构建为* .so文件。 it works fine in the building process, no errors and generate the *.so I want.
它在构建过程中工作正常,没有错误并生成了* .so,我想要。
file I use for building *.so file 我用于构建* .so文件的文件
module1 = Extension('classmod',
include_dirs=['/usr/lib/python2.7/dist-packages/numpy/','/home/******/OpenCV/opencv/release/include','/home/******/OpenCV/opencv/release/include/opencv','/home/******/OpenCV/opencv/release/include/opencv2','/home/******/modulepipe/eigen-eigen-b23437e61a07'],
library_dirs=['/usr/local/lib/'],
libraries=['opencv_calib3d','opencv_contrib','opencv_core','opencv_features2d','opencv_flann','opencv_gpu',
'opencv_highgui','opencv_imgproc','opencv_legacy','opencv_ml','opencv_nonfree','opencv_objdetect',
'opencv_photo','opencv_stitching','opencv_superres','opencv_ts','opencv_video','opencv_videostab'],
sources=['classmodule.cpp','patch_match.cpp','compute_jaccard.cpp','find_diff.cpp','refine_match.cpp','tps.cpp','book_pipeline_single.cpp','imgfeatures.c','kdtree.c','minpq.c','sift.c','utils.c'],
language='c++',
extra_compile_args=['-O3'])
setup(name='classmod',
version='1.0',
description='blah',
author='blah',
url='blah',
ext_modules=[module1]
)
However when I am trying to load this .so lib use lbb, it tells me about can not find several opencv *.so lib. 但是,当我尝试使用lbb加载此.so lib时,它告诉我大约找不到几个opencv * .so lib。
command I use for testing: 我用于测试的命令:
~/CDH/modulepipe$ ldd classmod.so
linux-gate.so.1 => (0xb77b4000)
libopencv_calib3d.so.2.4 => not found
libopencv_core.so.2.4 => not found
libopencv_features2d.so.2.4 => not found
libopencv_highgui.so.2.4 => not found
libopencv_imgproc.so.2.4 => not found
libopencv_nonfree.so.2.4 => not found
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb7690000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb7663000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb7645000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb762a000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb7480000)
/lib/ld-linux.so.2 (0xb77b5000)
This is the problem I have. 这是我的问题。 Can anyone help me on explaining this?
有人可以帮我解释一下吗?
I had this "lib not found problem" before, and it was in the build phase. 我以前遇到过“找不到库”的问题,它处于构建阶段。 But in this case, in the building process it passed, which means ldd could find *.so's it needed.
但是在这种情况下,它在构建过程中通过了,这意味着ldd可以找到* .so。 So how it happens that, when I am trying to run "ldd classmod.so", it could not find the *.so's.
因此,当我尝试运行“ ldd classmod.so”时,找不到* .so。
Your loader can't find those shared objects. 您的加载程序找不到这些共享库。 Either place them somewhere the loader expects to find them, modify the loader configuration (
man 8 ldconfig
) to look for shared objects where they are, or use one of the loader's environment variables ( man 8 ld.so
) to specify where to look for them. 可以将它们放置在装入程序希望找到它们的某个位置,修改装入程序配置(
man 8 ldconfig
)以查找它们所在的共享对象,或者使用装入程序的环境变量之一( man 8 ld.so
)指定要查找的位置。他们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.