如何解决 error adding symbols: Bad value 问题
来源:互联网 发布:如何申请网络域名 编辑:程序博客网 时间:2024/05/20 16:33
//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
这样就可以使用该静态库了,使用其他库类似问题同样适用。
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
- K上升序列总和
- 证明重组问题为NP完全问题
- linux-head命令
- Android弹幕功能实现,模仿斗鱼直播的弹幕效果
- 20170121C++阶段班05_STL_02inheritance补充
- 如何解决 error adding symbols: Bad value 问题
- Java反射
- CC2541关于OAD空中升级(安卓客户端收不到服务的)
- Ubuntu下安装opencv 2.4.11
- POJ-1787 Charlie's Change( 多重背包记录方案)
- hihoCoder--1036 Trie图(AC自动机)
- 经典的机器人入门资料
- Mac下配置本地Maven
- Docker简单使用