标签:relocation r_x86_64_ recompile with -fpic 动态库
linux生成动态库时遇到了relocation R_X86_64_32 against `.rodata‘ can not be used when making a shared object; recompile with -fPIC错误。
由于我的系统是AMD64位的,所以需要在编译的时候添加 -fPIC选项
解决方法:
例如:
g++ -c -fPIC head.cpp 生成head.o
g++ -fpic -shared -o libfun.so head.o
linux 生成动态库时提示relocation R_X86_64_32 against `.rodata' can not be used when making a shared object;
标签:relocation r_x86_64_ recompile with -fpic 动态库
原文地址:http://blog.csdn.net/aspnet_lyc/article/details/37604833