Problem
I am cross-compiling gstreamer using Meson, and it works for 3 different platforms (android-arm, android-arm64, android-x86_64) but fails for android-x86 with errors like:
ld: error: relocation R_386_32 cannot be used against local symbol; recompile with -fPIC
I can't seem to understand which component was not built with -fPIC
, and I don't understand why this would differ between the 4 platforms. If 3 are built with -fPIC
, why would the fourth be different?
Details
More specifically, it fails with a bunch of the following errors:
FAILED: subprojects/FFmpeg/test_avcodec_utils
/usr/i686-linux-android/bin/clang -o subprojects/FFmpeg/test_avcodec_utils subprojects/FFmpeg/test_avcodec_utils.p/libavcodec_tests_utils.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -pie -Wl,-Bsymbolic -fPIC -Wl,--start-group subprojects/FFmpeg/libavcodec-static.a subprojects/FFmpeg/libavutil.a subprojects/FFmpeg/libavutil-static.a subprojects/FFmpeg/libswresample.a subprojects/FFmpeg/libswresample-static.a -pthread -lm -lz -lz -Wl,--end-group
ld: error: relocation R_386_32 cannot be used against local symbol; recompile with -fPIC
>>> defined in subprojects/FFmpeg/libavcodec-static.a(libavcodec-static.a.p/dirac_dwt.o)
>>> referenced by x86util.asm:1315 (/work/build/android-x86/dependencies/gstreamer/gstreamer/src/gstreamer/subprojects/FFmpeg/libavutil/x86/x86util.asm:1315)
>>> libavcodec-static.a.p/dirac_dwt.o:(.text+0x9F) in archive subprojects/FFmpeg/libavcodec-static.a
I essentially run $ meson setup --cross-file my-crossfile build .
in a Dockcross container, with some options, so nothing special there as far as I can tell.
My cross-file looks like this (similar to the other 3 that work, except for cpu
and cpu_family
that differ):
[constants]
cross_triple = 'i686-linux-android'
cross_root = '/usr/' + cross_triple
[properties]
pkg_config_libdir = ''
[binaries]
c = cross_root + '/bin/clang'
cpp = cross_root + '/bin/clang++'
ar = cross_root + '/bin/llvm-ar'
as = cross_root + '/bin/llvm-as'
ranlib = cross_root + '/bin/llvm-ranlib'
ld = cross_root + '/bin/ld'
strip = cross_root + '/bin/llvm-strip'
pkgconfig = 'pkg-config'
[host_machine]
system = 'android'
cpu_family = 'x86'
cpu = 'i686'
endian = 'little'