opencv交叉编译库链接错误和链接

时间:2019-05-29 05:11:45

标签: embedded-linux

我正在尝试在主板上交叉编译opencv和ffmpeg。

环境和版本信息如下。 [环境] -ubuntu 14.04 LTS -cmake版本2.8.12.2(我使用的是cmake-gui) -opencv(2.4.12) -ffmpeg(3.0.1) -toolchain(arm-linux-gnueabihf-gcc版本4.9.3)

首先,我使用工具链编译了ffmpeg。

第二,我有cmake-gui opencv。 但这找不到ffmpeg库。

--     FFMPEG:                      YES
--       codec:                     NO
--       format:                    NO
--       util:                      NO
--       swscale:                   NO

我添加了如下路径。

$ export PKG_CONFIG_PATH = / home / me / usr / lib / pkgconfig

并发现它。

--     FFMPEG:                      YES
--       codec:                     YES (ver 57.24.102)
--       format:                    YES (ver 57.25.100)
--       util:                      YES (ver 55.17.103)
--       swscale:                   YES (ver 4.0.100)

然后,出现一个错误。 错误内容如下。

[ 97%] Building CXX object apps/haartraining/CMakeFiles/opencv_createsamples.dir/createsamples.cpp.o
Linking CXX executable ../../bin/opencv_createsamples
/root/gcc-linaro-4.9/bin/../lib/gcc/arm-linux-gnueabihf/4.9.3/../../../../arm-linux-gnueabihf/bin/ld: warning: libavcodec.so.57, needed by ../../lib/libopencv_highgui.so.2.4.12, not found (try using -rpath or -rpath-link)
/root/gcc-linaro-4.9/bin/../lib/gcc/arm-linux-gnueabihf/4.9.3/../../../../arm-linux-gnueabihf/bin/ld: warning: libavformat.so.57, needed by ../../lib/libopencv_highgui.so.2.4.12, not found (try using -rpath or -rpath-link)
/root/gcc-linaro-4.9/bin/../lib/gcc/arm-linux-gnueabihf/4.9.3/../../../../arm-linux-gnueabihf/bin/ld: warning: libavutil.so.55, needed by ../../lib/libopencv_highgui.so.2.4.12, not found (try using -rpath or -rpath-link)
/root/gcc-linaro-4.9/bin/../lib/gcc/arm-linux-gnueabihf/4.9.3/../../../../arm-linux-gnueabihf/bin/ld: warning: libswscale.so.4, needed by ../../lib/libopencv_highgui.so.2.4.12, not found (try using -rpath or -rpath-link)
../../lib/libopencv_highgui.so.2.4.12: undefined reference to `av_free_packet@LIBAVCODEC_57'
../../lib/libopencv_highgui.so.2.4.12: undefined reference to `av_write_frame@LIBAVFORMAT_57'

(Omit similar content)

collect2: error: ld returned 1 exit status
make[2]: *** [bin/opencv_createsamples] Error 1
make[1]: *** [apps/haartraining/CMakeFiles/opencv_createsamples.dir/all] Error 2
make: *** [all] Error 2

我认为这是一个库链接错误,因为 (警告:../../ lib / libopencv_highgui.so.2.4.12所需的libavcodec.so.57(尝试使用-rpath或-rpath-link)) 告诉。

1。 我不知道我做得好不好  我还将 libopencv_highgui.so.2.4.12 文件复制到 / usr / lib(默认路径)  链接链接

2。 我还添加了ld。

more /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
/usr/lib

3。 我还尝试设置LD_LIBRARY_PATH。

但是全部失败了。

如您所知,我是一个初学者,缺乏知识。

请给我有关如何解决此问题的建议。

谢谢

0 个答案:

没有答案
相关问题