coraci
coraci
采纳率0%
2016-08-18 04:50 阅读 3.2k

ubuntu12.04下 opencv库交叉编译后 动态库找不到

ubuntu上我装了pc 和arm 两个版本的opencv2.4.9
目录分别是/usr/local/opencv2.4.9 和/opt/opencv2.4.9-for-arm

pc版本的库文件都在/usr/local/lib下
arm版本库文件在/opt/opencv2.4.9-for-arm/lib下
whereis libopencv___core 的时候,只列出的/usr/local/lib/libopencv_core.so

交叉编译器在/opt/Embedsky/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/tq-linaro-toolchain/bin下
我写一个opencv测试程序test.cpp 交叉编译出现警告

 # arm-linux-g++ -o test test.cpp -I /opt/opencv2.4.9-for-arm/lib/include -L /opt/opencv2.4.9-for-arm/lib -lopencv_core -lopencv_highgui -lpthread -lrt 
In file included from /opt/opencv2.4.9-for-arm/lib/include/opencv2/flann/kmeans_index.h:50:0,
                 from /opt/opencv2.4.9-for-arm/lib/include/opencv2/flann/all_indices.h:38,
                 from /opt/opencv2.4.9-for-arm/lib/include/opencv2/flann/flann_base.hpp:44,
                 from /opt/opencv2.4.9-for-arm/lib/include/opencv2/flann/flann.hpp:50,
                 from /opt/opencv2.4.9-for-arm/lib/include/opencv/cv.h:69,
                 from test.cpp:2:
/opt/opencv2.4.9-for-arm/lib/include/opencv2/flann/logger.h:73:9: note: the mangling of 'va_list' has changed in GCC 4.4
/opt/Embedsky/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/tq-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld: warning: ../../lib/libopencv_core.so, needed by /opt/opencv2.4.9-for-arm/lib/libopencv_highgui.so, not found (try using -rpath or -rpath-link)
/opt/Embedsky/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/tq-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld: warning: ../../lib/libopencv_imgproc.so, needed by /opt/opencv2.4.9-for-arm/lib/libopencv_highgui.so, not found (try using -rpath or -rpath-link)
root@tsie-All-Series:/home/tsie/nfs/test/opencv_test# whereis libopencv_core
libopencv_core: /usr/local/lib/libopencv_core.so

这里面好像用到交叉编译器的ld,找opencv的.so文件看提示是跑到交叉编译器所在文件夹里面的lib去找??
我也吧opencv的交叉库放到这个文件夹里面,再编译还是同样的问题

然后我尝试加上运行时库路径参数 -Wl,-rpath,/opt/opencv2.4.9-for-arm/lib,再编译,弹出来一样的信息。

然后,就没有然后了。我晕

这究竟谁什么问题啊 求各路大神给点思路

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • coraci coraci 2016-08-18 04:57

    这里test头文件包含的是 opencv/cv.h 和 opencv/highgui.h 用到的动态链接库应该是找到的了,没有出现错误提示函数没找到定义的情况
    问题应该是出现在动态库的依赖上 lib/libopencv_imgproc.so, needed by /opt/opencv2.4.9-for-arm/lib/libopencv_highgui.so, not found

    点赞 1 评论 复制链接分享

相关推荐