C++ 将OpenCV与OpenWRT交叉复制时出错

C++ 将OpenCV与OpenWRT交叉复制时出错,c++,linux,opencv,cross-compiling,openwrt,C++,Linux,Opencv,Cross Compiling,Openwrt,我在OpenCv交叉编译期间遇到了问题 (使用OpenWrt,释放姿态调整(12.09-rc1),平台ar71xx)。 似乎OpenWRt链接器找不到合适的库 [ 27%] Built target opencv_ts Linking CXX executable ../../bin/opencv_perf_core mips-openwrt-linux-uclibc-g++.bin: warning: environment variable 'STAGING_DIR' not defined

我在OpenCv交叉编译期间遇到了问题 (使用OpenWrt,释放姿态调整(12.09-rc1),平台ar71xx)。 似乎OpenWRt链接器找不到合适的库

[ 27%] Built target opencv_ts
Linking CXX executable ../../bin/opencv_perf_core
mips-openwrt-linux-uclibc-g++.bin: warning: environment variable 'STAGING_DIR' not defined
mips-openwrt-linux-uclibc-g++.bin: warning: environment variable 'STAGING_DIR' not defined
/home/pawel/openwrt/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin/../lib/gcc/mips-openwrt-linux-uclibc/4.6.3/../../../../mips-openwrt-linux-uclibc/bin/ld: skipping incompatible /usr/lib/gcc/i686-linux-gnu/4.8/libstdc++.so when searching for -lstdc++

/home/pawel/openwrt/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin/../lib/gcc/mips-openwrt-linux-uclibc/4.6.3/../../../../mips-openwrt-linux-uclibc/bin/ld: skipping incompatible /usr/lib/gcc/i686-linux-gnu/4.8/libstdc++.a when searching for -lstdc++

/home/pawel/openwrt/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin/../lib/gcc/mips-openwrt-linux-uclibc/4.6.3/../../../../mips-openwrt-linux-uclibc/bin/ld: cannot find -lv4l1

/home/pawel/openwrt/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin/../lib/gcc/mips-openwrt-linux-uclibc/4.6.3/../../../../mips-openwrt-linux-uclibc/bin/ld: cannot find -lavcodec

/home/pawel/openwrt/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin/../lib/gcc/mips-openwrt-linux-uclibc/4.6.3/../../../../mips-openwrt-linux-uclibc/bin/ld: cannot find -lavformat
/home/pawel/openwrt/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin/../lib/gcc/mips-openwrt-linux-uclibc/4.6.3/../../../../mips-openwrt-linux-uclibc/bin/ld: cannot find -lavutil

/home/pawel/openwrt/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin/../lib/gcc/mips-openwrt-linux-uclibc/4.6.3/../../../../mips-openwrt-linux-uclibc/bin/ld: cannot find -lswscale

/home/pawel/openwrt/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin/../lib/gcc/mips-openwrt-linux-uclibc/4.6.3/../../../../mips-openwrt-linux-uclibc/bin/ld: cannot find -lbz2

/home/pawel/openwrt/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin/../lib/gcc/mips-openwrt-linux-uclibc/4.6.3/../../../../mips-openwrt-linux-uclibc/bin/ld: cannot find -lz

/home/pawel/openwrt/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin/../lib/gcc/mips-openwrt-linux-uclibc/4.6.3/../../../../mips-openwrt-linux-uclibc/bin/ld: skipping incompatible /usr/lib/gcc/i686-linux-gnu/4.8/libstdc++.so when searching for -lstdc++

/home/pawel/openwrt/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin/../lib/gcc/mips-openwrt-linux-uclibc/4.6.3/../../../../mips-openwrt-linux-uclibc/bin/ld: skipping incompatible /usr/lib/gcc/i686-linux-gnu/4.8/libstdc++.a when searching for -lstdc++

collect2: ld returned 1 exit status
make[2]: *** [bin/opencv_perf_core] Błąd 1
make[1]: *** [modules/core/CMakeFiles/opencv_perf_core.dir/all] Błąd 2
make: *** [all] Błąd 2`
我堆积在这里,无法继续前进,因此我正在寻求帮助。 我不会用OpenWRT编译OpenCv,但当我试图从和使用libs时

我得到了以下错误:

Building target: misp
Invoking: Cross G++ Linker
mips-openwrt-linux-g++ -L/home/prog12/openwrtD/openwrt/opencv_libs/ar71xx-WR703N/debug/ -o "misp"  ./src/main.o   -lopencv_highgui -lopencv_core -lopencv_imgproc -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann
mips-openwrt-linux-uclibc-g++.bin: warning: environment variable 'STAGING_DIR' not defined
mips-openwrt-linux-uclibc-g++.bin: warning: environment variable 'STAGING_DIR' not defined

/home/prog12/openwrtD/openwrt/opencv_libs/ar71xx-WR703N/debug//libopencv_core.a(system.cpp.o): In function `cv::Mutex::Mutex()':
system.cpp:(.text._ZN2cv5MutexC2Ev+0x38): undefined reference to `pthread_spin_init'
system.cpp:(.text._ZN2cv5MutexC2Ev+0x40): undefined reference to `pthread_spin_init'

/home/prog12/openwrtD/openwrt/opencv_libs/ar71xx-WR703N/debug//libopencv_core.a(system.cpp.o): In function `cv::Mutex::~Mutex()':
system.cpp:(.text._ZN2cv5MutexD2Ev+0x78): undefined reference to `pthread_spin_destroy'
system.cpp:(.text._ZN2cv5MutexD2Ev+0x80): undefined reference to `pthread_spin_destroy'

/home/prog12/openwrtD/openwrt/opencv_libs/ar71xx-WR703N/debug//libopencv_core.a(system.cpp.o): In function `cv::Mutex::operator=(cv::Mutex const&)':
system.cpp:(.text._ZN2cv5MutexaSERKS0_+0xa4): undefined reference to `pthread_spin_destroy'
system.cpp:(.text._ZN2cv5MutexaSERKS0_+0xac): undefined reference to `pthread_spin_destroy'
有人能帮我吗

编辑:

在添加zlib(thx到旧ufo)时也面临问题


这是一个链接问题-您必须指定所有库,您已经使用了来自的函数。在本例中,-link还带有-lzlib-lpthread选项


对于所有类似的问题-谷歌函数,您会在其中得到一个错误,并找到它属于哪个库。然后链接到它。

这帮我找到第一个。谢谢!还有一个:/home/prog12/openwrtD/openwrt/opencv_libs/ar71xx-WR703N/debug//libopencv_core.a(persistence.cpp.o):在函数
icvget(CvFileStorage*,char*,int)”中:persistence.cpp:(.text.\u ZL7icvGetsP13CvFileStoragePci+0x130):未定义的引用
gzget'It(如前所述)存在链接问题-必须指定所有库,您使用了来自的函数。在本例中,-link还带有-lzlib选项。对于future-google函数,您可以在该函数上获得一个错误并找到它所属的库。然后链接到它。是的。。我知道,现在。但是那个链接器甚至normald都找不到zlib-我确实安装了zlibc zlib1g dev zlib1g你需要交叉编译,所以必须有一个版本不是为你的机器,而是为目的地。那么我应该用我的工具链编译zlib对吗?
Building target: misp
Invoking: Cross G++ Linker
mips-openwrt-linux-g++ -L/home/prog12/openwrtD/openwrt/opencv_libs/ar71xx-WR703N/debug/ -o "misp"  ./src/main.o   -lpthread -lzlib -lopencv_highgui -lopencv_core -lopencv_imgproc -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann
mips-openwrt-linux-uclibc-g++.bin: warning: environment variable 'STAGING_DIR' not defined
mips-openwrt-linux-uclibc-g++.bin: warning: environment variable 'STAGING_DIR' not defined
/home/prog12/openwrt/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin/../lib/gcc/mips-openwrt-linux-uclibc/4.6.3/../../../../mips-openwrt-linux-uclibc/bin/ld: cannot find -lzlib