我正在努力为BeagleBoard开发。 因此我安装了CodeSourcery Sourcery_G ++ _ Lite工具链。
我想使用opencv库。所以我将源代码下载到我的Ubuntu devolepment系统,用gcc编译为共享库并安装了库。 当我为x86-Architecture构建helloworld应用程序时,一切都很好。
现在,我想用ARM架构的其他工具链编译相同的应用程序。
我在编译/链接时收到这些警告/错误:
john@ubuntu:~/Downloads/BeagleTest$ arm-none-linux-gnueabi-g++ -c ImageProcessing.cpp -o ImageProcessing.o -I/usr/local/include
cc1plus: warning: include location "/usr/local/include" is unsafe for cross-compilation
john@ubuntu:~/Downloads/BeagleTest$ arm-none-linux-gnueabi-g++ -c Main.cpp -o Main.o -I/usr/local/include
cc1plus: warning: include location "/usr/local/include" is unsafe for cross-compilation
john@ubuntu:~/Downloads/BeagleTest$ arm-none-linux-gnueabi-g++ -oApplication -L/usr/local/lib Main.o ImageProcessing.o -lopencv_core
/usr/local/CodeSourcery/Sourcery_G++_Lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.2.1/../../../../arm-none-linux-gnueabi/bin/ld: warning: library search path "/usr/local/lib" is unsafe for cross-compilation
/usr/local/CodeSourcery/Sourcery_G++_Lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.2.1/../../../../arm-none-linux-gnueabi/bin/ld: skipping incompatible /usr/local/lib/libopencv_core.so when searching for -lopencv_core
/usr/local/CodeSourcery/Sourcery_G++_Lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.2.1/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -lopencv_core
collect2: ld returned 1 exit status
显然,即时通讯使用相同的include-directories和库-pit,比如im用于x86-Architecture。这不起作用。但我该怎么办?我是否必须交叉编译opencv-library?
答案 0 :(得分:1)
库必须交叉编译,您必须确保在链接时找到正确的库。如果这不应该自动运行,您可能需要查看gcc的--sysroot
命令行开关。
答案 1 :(得分:0)
是。库是特定于架构的。