问题描述
- 跪求cmake交叉编译出错原因!!!
-
Linking CXX shared library ../../lib/libopencv_core.so
/opt/EmbedSky/4.4.6/lib/gcc/arm-embedsky-linux-gnueabi/4.4.6/../../../../arm-embedsky-linux-gnueabi/bin/ld: ../../3rdparty/lib/libzlib.a(inflate.c.obj): relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
../../3rdparty/lib/libzlib.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: *** [lib/libopencv_core.so] 错误 1
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] 错误 2
make: *** [all] 错误 2
请问这是什么错误啊?
opencv路径及版本:/usr/local/ Opencv2.4.1
cmake路径及版本:/usr/local/ cmake-2.8.12.2-Linux-i386
用户:root
解决方案
进入opencv目录下的3rdparty的对应目录CMakeFiles/ *.dir下,打开flags.make,在C_FLAGS = 后添加-O3 -fPIC用来支持在64位机上编译
如../3rdparty/zlib/CMakeFiles/zlib.dir/flags.make
修改C_FLAGS =??-W -Wall 为 C_FLAGS =??-O3 -fPIC??-W -Wall
和
修改CXX_FLAGS =??-W -Wall 为 C_FLAGS =??-O3 -fPIC??-W -Wall
时间: 2024-10-23 20:59:51