0

我正在尝试为 ARM 目标交叉编译 OpenCV 4.5.1。我的主机系统是 Linux 20.04(基于 Intel)。我正在使用 CMake 3.16.3。没有额外模块的编译工作正常。当我添加它们时,我在最后得到一个链接错误:

[ 86%] Building CXX object modules/gapi/CMakeFiles/opencv_gapi.dir/src/api/kernels_video.cpp.o
[ 86%] Linking CXX executable ../../../../bin/opencv_waldboost_detector
/home/alexis/Desktop/snapdragon/cross/lib/gcc/arm-linux-gnueabi/8.1.0/../../../../arm-linux-gnueabi/bin/ld: warning: libdl.so.2, needed by ../../../../lib/libopencv_core.so.4.5.1, not found (try using -rpath or -rpath-link)
/home/alexis/Desktop/snapdragon/cross/lib/gcc/arm-linux-gnueabi/8.1.0/../../../../arm-linux-gnueabi/bin/ld: warning: librt.so.1, needed by ../../../../lib/libopencv_core.so.4.5.1, not found (try using -rpath or -rpath-link)
../../../../lib/libopencv_core.so.4.5.1: undefined reference to `dladdr@GLIBC_2.4'
../../../../lib/libopencv_core.so.4.5.1: undefined reference to `dlclose@GLIBC_2.4'
../../../../lib/libopencv_core.so.4.5.1: undefined reference to `dlopen@GLIBC_2.4'
../../../../lib/libopencv_core.so.4.5.1: undefined reference to `dlsym@GLIBC_2.4'
../../../../lib/libopencv_core.so.4.5.1: undefined reference to `clock_gettime@GLIBC_2.4'
collect2: error: ld returned 1 exit status

我知道问题是因为找不到两个库libdllibrt。缺少的库位于非标准路径上。我试图将 LD_LIBRARY_PATH 设置为包含请求的库的文件夹,但没有运气。

不知道我还能尝试什么。错误消息说尝试使用 -rpath 或 -rpath-link,但我不知道该怎么做。

4

0 回答 0