jaryyy2000 发表于 2015-09-12 10:16

libvpx库的yasm编译如何生成-fPIC位置无关代码?

我在编译时需要连接libvpx静态库,提示我需要使用-fPIC参数重新编译位置无关的libvpx库/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
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
Makefile:518: recipe for target 'libgd.la' failed
make: *** Error 1
make: Leaving directory '/root/libgd/libgd-2.1.1/src'
Makefile:436: recipe for target 'all' failed
make: *** Error 2
make: Leaving directory '/root/libgd/libgd-2.1.1/src'
Makefile:331: recipe for target 'all-recursive' failed
make: *** Error 1
然后我去修改libvpx的Makefile,在CFLAGS和CXXFLAGS还有ASFLAGS里面添加了-fPIC参数:CFLAGS+=-I$(BUILD_PFX)$(BUILD_ROOT) -I$(SRC_PATH) -fPIC
CXXFLAGS+=-I$(BUILD_PFX)$(BUILD_ROOT) -I$(SRC_PATH) -fPIC
ASFLAGS+=-I$(BUILD_PFX)$(BUILD_ROOT)/ -I$(SRC_PATH)/ -fPIC/
编译以后,就会报错,如下:    vpx_ports/emms.asm.o
yasm: FATAL: unrecognized object format `PIC/'
Makefile:179: recipe for target 'vpx_ports/emms.asm.o' failed
make: *** Error 1
Makefile:17: recipe for target '.DEFAULT' failed
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如何编译位置无关的代码?

yjh777 发表于 2015-10-10 15:52

http://ffmpeg.org/pipermail/ffmpeg-devel/2009-November/076635.html

-DPIC
页: [1]
查看完整版本: libvpx库的yasm编译如何生成-fPIC位置无关代码?