arm平台编译动态库报 relocation R_ARM_MOVW_ABS_NC 错误解决

编译一个能在 arm 平台上用的动态库,结果报错如下:

relocation R_ARM_MOVW_ABS_NC against `a local symbol‘ can not be used when making a shared object; recompile with -fPIC
./obj/xxx.o: could not read symbols: Bad value
collect2: error: ld returned 1 exit status


其实错误信息已经给出解决办法了,加 -fPIC 参数从新编译(recompile with -fPIC)

所以如果是命令行,直接添加 -fPIC

如果是Makefile,添加编译选项:CFLAGS  +=  -fPIC

Done !

文章来自:http://blog.csdn.net/a_ran/article/details/41351273
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3