免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3312 | 回复: 1
打印 上一主题 下一主题

[系统] libvpx库的yasm编译如何生成-fPIC位置无关代码? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2015-09-12 10:16 |只看该作者 |倒序浏览
我在编译时需要连接libvpx静态库,提示我需要使用-fPIC参数重新编译位置无关的libvpx库
  1. /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../lib/libvpx.a(subpixel_mmx.asm.o): relocation R_X86_64_PC32 against symbol `vp8_bilinear_filters_x86_8' can not be used when making a shared object; recompile with -fPIC
  2. /usr/bin/ld: final link failed: Bad value
  3. collect2: error: ld returned 1 exit status
  4. Makefile:518: recipe for target 'libgd.la' failed
  5. make[2]: *** [libgd.la] Error 1
  6. make[2]: Leaving directory '/root/libgd/libgd-2.1.1/src'
  7. Makefile:436: recipe for target 'all' failed
  8. make[1]: *** [all] Error 2
  9. make[1]: Leaving directory '/root/libgd/libgd-2.1.1/src'
  10. Makefile:331: recipe for target 'all-recursive' failed
  11. make: *** [all-recursive] Error 1
复制代码
然后我去修改libvpx的Makefile,在CFLAGS和CXXFLAGS还有ASFLAGS里面添加了-fPIC参数:
  1. CFLAGS+=-I$(BUILD_PFX)$(BUILD_ROOT) -I$(SRC_PATH) -fPIC
  2. CXXFLAGS+=-I$(BUILD_PFX)$(BUILD_ROOT) -I$(SRC_PATH) -fPIC
  3. ASFLAGS+=-I$(BUILD_PFX)$(BUILD_ROOT)/ -I$(SRC_PATH)/ -fPIC/
复制代码
编译以后,就会报错,如下:
  1.     [AS] vpx_ports/emms.asm.o
  2. yasm: FATAL: unrecognized object format `PIC/'
  3. Makefile:179: recipe for target 'vpx_ports/emms.asm.o' failed
  4. make[1]: *** [vpx_ports/emms.asm.o] Error 1
  5. Makefile:17: recipe for target '.DEFAULT' failed
  6. make: *** [.DEFAULT] Error 2
复制代码
如果去掉ASFLAGS的-fPIC参数,前面链接的时候就会提示
/libvpx.a(subpixel_mmx.asm.o): relocation R_X86_64_PC32 against symbol `vp8_bilinear_filters_x86_8' can not be used when making a shared object; recompile with -fPIC

yasm如何编译位置无关的代码?

论坛徽章:
84
每日论坛发贴之星
日期:2015-12-29 06:20:00每日论坛发贴之星
日期:2016-01-16 06:20:00每周论坛发贴之星
日期:2016-01-17 22:22:00程序设计版块每日发帖之星
日期:2016-01-20 06:20:00每日论坛发贴之星
日期:2016-01-20 06:20:00程序设计版块每日发帖之星
日期:2016-01-21 06:20:00每日论坛发贴之星
日期:2016-01-21 06:20:00程序设计版块每日发帖之星
日期:2016-01-23 06:20:00程序设计版块每日发帖之星
日期:2016-01-31 06:20:00数据库技术版块每日发帖之星
日期:2016-01-16 06:20:00程序设计版块每日发帖之星
日期:2016-01-16 06:20:00程序设计版块每日发帖之星
日期:2016-01-14 06:20:00
2 [报告]
发表于 2015-10-10 15:52 |只看该作者
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP