编译报错R_ARM_THM_MOVW_ABS_NC against `a local symbol

我们在编译动态库的时候,会遇到如下错误:

/opt/gcc-linaro-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.7.3/../../../../arm-linux-gnueabihf/bin/ld: adb.o: relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
adb.o: could not read symbols: Bad value
collect2: error: ld returned 1 exit status

relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC

意思是提示我们在编译的时候加上-fPIC选项即可。


CPPFLAGS+= -O2 -g  -fPIC -Wall -Wno-unused-parameter

阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页