Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Add missing flags for x86 asm support #3804

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

amyspark
Copy link

Hi all,

This MR fixes an issue we observed in GStreamer when linking for Android x86:

Build log
FAILED: libopenh264.so 
/builds/tpm/cerbero/cb/android-ndk-25/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -target i686-linux-android21 --sysroot /builds/tpm/cerbero/cb/android-ndk-25/toolchains/llvm/prebuilt/linux-x86_64/sysroot  -o libopenh264.so  -L/builds/tpm/cerbero/cb/dist/android_universal/x86/lib -L/builds/tpm/cerbero/cb/android-ndk-25/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/i686-linux-android/21 -Wl,--as-needed -Wl,--no-undefined -shared -fPIC -Wl,-soname,libopenh264.so -Wl,--whole-archive -Wl,--start-group codec/common/libcommon.a codec/processing/libprocessing.a codec/encoder/libencoder.a codec/decoder/libdecoder.a -Wl,--no-whole-archive -fPIC -no-canonical-prefixes -Wl,-no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--gc-sections -Wl,--warn-shared-textrel -Wl,-z,nocopyreloc -Wl,--sysroot=/builds/tpm/cerbero/cb/android-ndk-25/toolchains/llvm/prebuilt/linux-x86_64/sysroot -fuse-ld=lld -pthread -lm -Wl,--end-group
ld.lld: error: relocation R_386_32 cannot be used against local symbol; recompile with -fPIC
>>> defined in codec/common/libcommon.a(libcommon.a.p/dct.o)
>>> referenced by ../codec/common/x86/dct.asm
>>>               libcommon.a.p/dct.o:(.text+0x337) in archive codec/common/libcommon.a
ld.lld: error: relocation R_386_32 cannot be used against local symbol; recompile with -fPIC
>>> defined in codec/common/libcommon.a(libcommon.a.p/dct.o)
>>> referenced by ../codec/common/x86/dct.asm
>>>               libcommon.a.p/dct.o:(.text+0x34D) in archive codec/common/libcommon.a
ld.lld: error: relocation R_386_32 cannot be used against local symbol; recompile with -fPIC
>>> defined in codec/common/libcommon.a(libcommon.a.p/dct.o)
>>> referenced by ../codec/common/x86/dct.asm
>>>               libcommon.a.p/dct.o:(.text+0x355) in archive codec/common/libcommon.a
ld.lld: error: relocation R_386_32 cannot be used against local symbol; recompile with -fPIC
>>> defined in codec/common/libcommon.a(libcommon.a.p/dct.o)
>>> referenced by ../codec/common/x86/dct.asm
>>>               libcommon.a.p/dct.o:(.text+0x366) in archive codec/common/libcommon.a
ld.lld: error: relocation R_386_32 cannot be used against local symbol; recompile with -fPIC
>>> defined in codec/common/libcommon.a(libcommon.a.p/dct.o)
>>> referenced by ../codec/common/x86/dct.asm
>>>               libcommon.a.p/dct.o:(.text+0x37C) in archive codec/common/libcommon.a
ld.lld: error: relocation R_386_32 cannot be used against local symbol; recompile with -fPIC
>>> defined in codec/common/libcommon.a(libcommon.a.p/dct.o)
>>> referenced by ../codec/common/x86/dct.asm
>>>               libcommon.a.p/dct.o:(.text+0x384) in archive codec/common/libcommon.a
ld.lld: error: relocation R_386_32 cannot be used against local symbol; recompile with -fPIC
>>> defined in codec/common/libcommon.a(libcommon.a.p/dct.o)
>>> referenced by ../codec/common/x86/dct.asm
>>>               libcommon.a.p/dct.o:(.text+0x395) in archive codec/common/libcommon.a
ld.lld: error: relocation R_386_32 cannot be used against local symbol; recompile with -fPIC
>>> defined in codec/common/libcommon.a(libcommon.a.p/dct.o)
>>> referenced by ../codec/common/x86/dct.asm
>>>               libcommon.a.p/dct.o:(.text+0x3AB) in archive codec/common/libcommon.a
ld.lld: error: relocation R_386_32 cannot be used against local symbol; recompile with -fPIC
>>> defined in codec/common/libcommon.a(libcommon.a.p/dct.o)
>>> referenced by ../codec/common/x86/dct.asm
>>>               libcommon.a.p/dct.o:(.text+0x3B3) in archive codec/common/libcommon.a
ld.lld: error: relocation R_386_32 cannot be used against local symbol; recompile with -fPIC
>>> defined in codec/common/libcommon.a(libcommon.a.p/dct.o)
>>> referenced by ../codec/common/x86/dct.asm
>>>               libcommon.a.p/dct.o:(.text+0x3C4) in archive codec/common/libcommon.a
ld.lld: error: relocation R_386_32 cannot be used against local symbol; recompile with -fPIC
>>> defined in codec/common/libcommon.a(libcommon.a.p/dct.o)
>>> referenced by ../codec/common/x86/dct.asm
>>>               libcommon.a.p/dct.o:(.text+0x3DA) in archive codec/common/libcommon.a
ld.lld: error: relocation R_386_32 cannot be used against local symbol; recompile with -fPIC
>>> defined in codec/common/libcommon.a(libcommon.a.p/dct.o)
>>> referenced by ../codec/common/x86/dct.asm
>>>               libcommon.a.p/dct.o:(.text+0x3E2) in archive codec/common/libcommon.a
ld.lld: error: relocation R_386_32 cannot be used against local symbol; recompile with -fPIC
>>> defined in codec/common/libcommon.a(libcommon.a.p/dct.o)
>>> referenced by ../codec/common/x86/dct.asm
>>>               libcommon.a.p/dct.o:(.text+0x4AC) in archive codec/common/libcommon.a
ld.lld: error: relocation R_386_32 cannot be used against local symbol; recompile with -fPIC
>>> defined in codec/common/libcommon.a(libcommon.a.p/dct.o)
>>> referenced by ../codec/common/x86/dct.asm
>>>               libcommon.a.p/dct.o:(.text+0x4C2) in archive codec/common/libcommon.a
ld.lld: error: relocation R_386_32 cannot be used against local symbol; recompile with -fPIC
>>> defined in codec/common/libcommon.a(libcommon.a.p/dct.o)
>>> referenced by ../codec/common/x86/dct.asm
>>>               libcommon.a.p/dct.o:(.text+0x4CA) in archive codec/common/libcommon.a
ld.lld: error: relocation R_386_32 cannot be used against local symbol; recompile with -fPIC
>>> defined in codec/common/libcommon.a(libcommon.a.p/dct.o)
>>> referenced by ../codec/common/x86/dct.asm
>>>               libcommon.a.p/dct.o:(.text+0x4DB) in archive codec/common/libcommon.a
ld.lld: error: relocation R_386_32 cannot be used against local symbol; recompile with -fPIC
>>> defined in codec/common/libcommon.a(libcommon.a.p/dct.o)
>>> referenced by ../codec/common/x86/dct.asm
>>>               libcommon.a.p/dct.o:(.text+0x4F1) in archive codec/common/libcommon.a
ld.lld: error: relocation R_386_32 cannot be used against local symbol; recompile with -fPIC
>>> defined in codec/common/libcommon.a(libcommon.a.p/dct.o)
>>> referenced by ../codec/common/x86/dct.asm
>>>               libcommon.a.p/dct.o:(.text+0x4F9) in archive codec/common/libcommon.a
ld.lld: error: relocation R_386_32 cannot be used against local symbol; recompile with -fPIC
>>> defined in codec/common/libcommon.a(libcommon.a.p/dct.o)
>>> referenced by ../codec/common/x86/dct.asm
>>>               libcommon.a.p/dct.o:(.text+0x50A) in archive codec/common/libcommon.a
ld.lld: error: relocation R_386_32 cannot be used against local symbol; recompile with -fPIC
>>> defined in codec/common/libcommon.a(libcommon.a.p/dct.o)
>>> referenced by ../codec/common/x86/dct.asm
>>>               libcommon.a.p/dct.o:(.text+0x520) in archive codec/common/libcommon.a
ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

The fix is to extend #2611 to the Meson build system, and I added (as a failsafe) the two linker flags that x264 already uses to work around the same issue.

All feedback is appreciated.

@amyspark amyspark force-pushed the fix-meson-bstaticpic branch from 2a6ed6d to 8077206 Compare November 15, 2024 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant