我们在编译动态库的时候,会遇到如下错误:
/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