如何解决 error adding symbols: Bad value 问题
来源:互联网 发布:蔡和森 知乎 编辑:程序博客网 时间:2024/06/07 04:04
//by sven
最近遇到一个关于动态库和静态库使用的一个问题。
我们都知道在生成一个动态库时需要指定-fPIC,这是创建动态库所要求的,共享库被加载是在内存中的位置是不固定的,是一个相对的位置。
那么在生成静态库时通常不指定-fPIC, 可是在64bit编译使用静态库就会提示需要-fPIC从新编译该库:
/opt/mipsel-openwrt-linux-4.8.3/mipsel-4.8.4/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/../lib/gcc/mipsel-openwrt-linux-uclibc/4.8.3/../../../../mipsel-openwrt-linux-uclibc/bin/ld: ../lib/libmad.a(stream.o):relocation R_MIPS_26 against `mad_bit_init' can not be used when making a shared object; recompile with -fPIC
../lib/libmad.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [libavio.so] Error 1
原因就是由于libmad编译静态库时,没有使用-fPIC选项,使得编译出来的静态库没有重定位能力。这样在64bit机器上编译出来的静态库如果不指定-fPIC选项几乎全部不能使用。
因此需要重新加上-fPIC从新编译libmad
这样就可以使用该静态库了,使用其他库类似问题同样适用。
转自:http://blog.csdn.net/sevenjoin/article/details/54645984
阅读全文
0 0
- 如何解决 error adding symbols: Bad value 问题
- 如何解决 error adding symbols: Bad value 问题
- python安装cryptography 报错: error adding symbols: Bad value
- 在Linux动态库Project中链接静态库时,遇到error adding symbols: Bad value的问题
- 交叉编译opencv2.4.13出错:libzlib.a: error adding symbols: Bad value
- make error: libneon.a: could not read symbols: Bad value
- 解决 liblog4cpp.a: could not read symbols: Bad value
- gcc编译error adding symbols错误
- 解决/usr/local/lib/libglog.so.0: error adding symbols: DSO missing from command line
- R_X86_64_32 & could not read symbols: Bad value
- TTserver 编译/usr/local/lib/libbz2.a: could not read symbols: Bad value解决
- error adding symbols: DSO missing from command line
- error adding symbols: DSO missing from command line
- error adding symbols: DSO missing from command line
- "GSL3680/gsl_point_id.a: error adding symbols: 文件格式错误" 解决办法
- R_X86_64_32 & could not read symbols: Bad value编译
- 解决 Error on adding indexing context central
- 如何解决XCODE中错误: Undefined symbols for architecture i386 error
- IO流之学习(—)
- Wannafly挑战赛1 A Treepath LCA
- Tomcat中出现Server Tomcat v9.0 Server at localhost failed to start.解决办法
- C语言知识__宏
- 文件上传allowedTypes和文件下载contentType(mimeType)
- 如何解决 error adding symbols: Bad value 问题
- angularJs按钮变化
- 1133: 单词个数统计
- R语言数据导出
- Shell 数组
- [bzoj1941][kd-tree]Hide and Seek
- BZOJ2761: [JLOI2011]不重复数字
- linux内核网络分层结构
- angularJs复选框的选择状态筛选