gcc编译动态库的时候提示 error adding symbols: 错误的值

问题:

/usr/bin/ld: base64.o: relocation R_X86_64_32S against `base' can not be used when making a shared object; recompile with -fPIC

base64.o: error adding symbols: 错误的值
collect2: error: ld returned 1 exit status


解决:

生成.o 文件的时候少加了参数-fPIC

gcc -fPIC -c -I"/usr/lib/jvm/jdk1.8.0_144/include" -I"/usr/lib/jvm/jdk1.8.0_144/"  base64.c

你可能感兴趣的:(gcc编译动态库的时候提示 error adding symbols: 错误的值)