免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 11196 | 回复: 3

gcc 加参数 -fPIC 问题 [复制链接]

论坛徽章:
0
发表于 2011-12-11 10:23 |显示全部楼层
本帖最后由 hjk857 于 2011-12-11 10:29 编辑

[root@nginx_bak ~]# uname -a
Linux nginx_bak 2.6.18-274.12.1.el5 #1 SMP Tue Nov 29 13:37:46 EST 2011 x86_64 x86_64 x86_64 GNU/Linux

在64位的系统是配置安装vlc遇到下面问题。

[root@nginx_bak ~]# make
make[6]: Nothing to be done for `all-am'.
make[6]: Leaving directory `/usr/local/src/vlc/vlc/modules/codec/omxil'
make[5]: Leaving directory `/usr/local/src/vlc/vlc/modules/codec/omxil'
make[5]: Entering directory `/usr/local/src/vlc/vlc/modules/codec'
/bin/sh ../../libtool --tag=CC --mode=link gcc -std=gnu99 `top_srcdir="../.." top_builddir="../.." ../../vlc-config --cflags plugin libx264_plugin.la` -Wall -Wextra -Wsign-compare -Wundef -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wmissing-prototypes -Wvolatile-register-var -Werror-implicit-function-declaration -rpath '/usr/local/lib/vlc/plugins/codec' -avoid-version -module -export-symbol-regex ^vlc_entry -shrext .so -rpath "/usr/local/lib/vlc/plugins/codec" -no-undefined `top_srcdir="../.." top_builddir="../.." ../../vlc-config --ldflags plugin libx264_plugin.la`  -o libx264_plugin.la   libx264_plugin_la-x264.lo  `top_srcdir="../.." top_builddir="../.." ../../vlc-config -libs plugin libx264_plugin.la` ../../src/libvlccore.la ../../compat/libcompat.la
gcc -std=gnu99 -shared  .libs/libx264_plugin_la-x264.o -Wl,--whole-archive ../../compat/.libs/libcompat.a -Wl,--no-whole-archive  -Wl,--rpath -Wl,/usr/local/src/vlc/vlc/src/.libs -lx264 -lpthread -L/usr/local/src/vlc/x264-snapshot-20100524-2245 -lm ../../src/.libs/libvlccore.so  -mtune=athlon64 -Wl,-soname -Wl,libx264_plugin.so -o .libs/libx264_plugin.so
/usr/bin/ld: /usr/local/src/vlc/x264-snapshot-20100524-2245/libx264.a(cabac-a.o): relocation R_X86_64_PC32 against `x264_cabac_range_lps' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
make[5]: *** [libx264_plugin.la] Error 1
make[5]: Leaving directory `/usr/local/src/vlc/vlc/modules/codec'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/usr/local/src/vlc/vlc/modules/codec'
make[3]: *** [all] Error 2
make[3]: Leaving directory `/usr/local/src/vlc/vlc/modules/codec'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/usr/local/src/vlc/vlc/modules'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/vlc/vlc'
make: *** [all] Error 2

求解

根据网上资料,说要在Makefile文件里面,给GCC 加参数-fPIC,具体怎么操作?

论坛徽章:
0
发表于 2011-12-11 11:46 |显示全部楼层
[root@nginx_bak ~]# uname -a
Linux nginx_bak 2.6.18-274.12.1.el5 #1 SMP Tue Nov 29 13:37:46 EST 201 ...
hjk857 发表于 2011-12-11 10:23


在对应的CFLAGS里面加上“-fPIC”选项呗。

论坛徽章:
0
发表于 2011-12-11 13:34 |显示全部楼层
在对应的CFLAGS里面加上“-fPIC”选项呗。
freearth 发表于 2011-12-11 11:46



vlc的Makefile部份内容如下,请问在哪行加? 加了-fPIC之后是否还需要重新configure一次再执行make?
BUILD_VLC_FALSE = #
BUILD_VLC_TRUE =
CACA_CFLAGS =
CACA_LIBS =
CC = gcc -std=gnu99
CCAS = gcc -std=gnu99
CCASFLAGS = -g -O2
CCDEPMODE = depmode=gcc3
CFLAGS =  -Wall -Wextra -Wsign-compare -Wundef -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wmissing-prototypes -Wvolatile-register-var -Werror-implicit-function-declaration
CONTRIB_DIR =
COPYRIGHT_MESSAGE = Copyright © 1996-2010 the VideoLAN team
COPYRIGHT_YEARS = 1996-2010
CPP = gcc -std=gnu99 -E
CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include  -DSYS_LINUX
CXX = g++
CXXCPP = g++ -E
CXXDEPMODE = depmode=gcc3
CXXFLAGS = -g -O2
CYGPATH =
CYGPATH_W = echo
DBUS_CFLAGS =

论坛徽章:
2
2015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:53:17
发表于 2011-12-11 21:01 |显示全部楼层
make CC='gcc -fPIC'
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP