编译出错 recompile with -fPIC

对作者表示深刻感谢

来源:http://blog.csdn.net/greencacti/article/details/9188679

作者:greencacti

背景:

这两天在玩ganglia这个的时候,发现这个依赖于libConfuse,先按照libConfuse以后,然后再编译ganglia的时候报错,提示"recomile with fPIC".


资料:

上网找了一下资料,发现了下文比较接近

http://deidara.blog.51cto.com/400447/154166/(下文中附)


实际解决办法:

按照上面方法,在libConfuse里面找不到对应的文件,继续探究configure文件的时候,发现有一个enable-shared参数,估计有用,按照如下步骤编译了libConfuse,然后再编译ganglia就通过了

# ./configure --enable-shared
# make
# make install

文中参考资料

来源:http://deidara.blog.51cto.com/400447/154166/

作者:Deidara

今天编译ffmepg 报错,找了半天原因,后来发现只有在 64 位系统是才会报这种错误!
错误如下:
/usr/lib64/gcc/x86_64-linux/4.2.0/../../../../x86_64-linux/bin/ld: /usr/local/libnut.a(z.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
 
/usr/local/libnut.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
 
在网上搜索的解决办法如下:
You will get these messages on x86_64 any place that libtool tries to use a static (.a) library in a .la, and as it says, it can't link. These "recompile with -fPIC" messages fall into three types -
 
        1.recompile the current package with -fPIC
 
        2.fix a broken symlink (I had a dangling symlink for ncurses in my scripts, because of a typo - on x86 libtool couldn't find the .so but took the .a and ran with it, on x86_64 it barfed)
 
        3.convert a Makefile to use .la instead of .a (very uncommon)
但是我使用 第二中方法还是不行,所以我就用第一种方法.重新编译了一下 libnut
 
shell $> cd libnut
shell $> vim config.mak
 
PREFIX = /usr/local
prefix = $(DESTDIR)$(PREFIX)
#CFLAGS += -DDEBUG
CFLAGS += -Os -fomit-frame-pointer -g -Wall -fPIC   ###加入 -fPIC 参数
CFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
CC = cc
RANLIB  = ranlib
AR = ar
 
shell $>make libnut
shell $> make prefix=/usr install-libnut
再编译ffmpeg
 
shell $> cd ffmpeg
shell $> ./configure --prefix=/usr --enable-gpl --enable-nonfree --enable-pthreads --disable-ipv6 --enable-small --enable-bzlib --enable-libamr-nb --enable-libamr-wb  --enable-libdc1394 --enable-libdirac --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-zlib --disable-debug --enable-shared
shell $> make
shell $> make install

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值