Closed
Bug 1412734
Opened 7 years ago
Closed 7 years ago
crtbegin_so.o: unsupported ELF machine number 40 after using clang (bug 1163171)
Categories
(Firefox Build System :: General, defect)
Firefox Build System
General
Tracking
(firefox58 fixed)
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
firefox58 | --- | fixed |
People
(Reporter: m_kato, Assigned: froydnj)
References
Details
Attachments
(1 file)
(deleted),
patch
|
snorp
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Reporter | ||
Comment 1•7 years ago
|
||
After landing bug 1163171, it causes the following build error on my workstation.
0:02.62 Executing: /home/makoto/.mozbuild/android-ndk-r15c/toolchains/llvm/preb
uilt/linux-x86_64/bin/clang++ -std=gnu++11 --target=arm-linux-androideabi -Qunus
ed-arguments -isystem /home/makoto/.mozbuild/android-ndk-r15c/platforms/android-
9/arch-arm/usr/include -gcc-toolchain /home/makoto/.mozbuild/android-ndk-r15c/to
olchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 -Qunused-arguments -Wal
l -Wc++11-compat -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointe
r-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wunreachable-code-retur
n -Wwrite-strings -Wno-invalid-offsetof -Wclass-varargs -Wloop-analysis -Wc++11-
compat-pedantic -Wc++14-compat -Wc++14-compat-pedantic -Wc++1z-compat -Wcomma -W
implicit-fallthrough -Wstring-conversion -Wno-inline-new-delete -Wno-error=depre
cated-declarations -Wno-error=array-bounds -Wformat -Wno-gnu-zero-variadic-macro
-arguments -Wformat-security -Wno-unknown-warning-option -Wno-return-type-c-link
age -fno-short-enums -fno-exceptions -I/home/makoto/.mozbuild/android-ndk-r15c/s
ources/cxx-stl/llvm-libc++/include -I/home/makoto/.mozbuild/android-ndk-r15c/sou
rces/android/support/include -I/home/makoto/.mozbuild/android-ndk-r15c/sources/c
xx-stl/llvm-libc++abi/include -march=armv7-a -mthumb -mfpu=vfp -mfloat-abi=softf
p -mno-unaligned-access -fno-exceptions -fno-strict-aliasing -fno-rtti -fno-exce
ptions -fno-math-errno -pipe -g -Oz -funwind-tables -fPIC -shared -Wl,-z,defs -W
l,-h,libfakeopenh264.so -o libfakeopenh264.so /mozilla/objdir-android/dom/media/
gmp-plugin-openh264/tmpo6Qqvh.list -L/home/makoto/.mozbuild/android-ndk-r15c/pla
tforms/android-9/arch-arm/usr/lib -Wl,-rpath-link=/home/makoto/.mozbuild/android
-ndk-r15c/platforms/android-9/arch-arm/usr/lib --sysroot=/home/makoto/.mozbuild/
android-ndk-r15c/platforms/android-9/arch-arm -Wl,--allow-shlib-undefined -gcc-t
oolchain /home/makoto/.mozbuild/android-ndk-r15c/toolchains/arm-linux-androideab
i-4.9/prebuilt/linux-x86_64 -mthumb -Wl,-z,noexecstack -Wl,-z,text -Wl,-z,relro
-Wl,--build-id -Wl,--hash-style=sysv -B ../../../build/unix/gold -Wl,-rpath-link
,/mozilla/objdir-android/dist/bin -Wl,-rpath-link,/usr/local/lib -fcolor-diagnos
tics -L/home/makoto/.mozbuild/android-ndk-r15c/sources/cxx-stl/llvm-libc++/libs/
armeabi-v7a -lc++_static -lc++abi -lunwind -landroid_support -llog
0:02.62 /mozilla/objdir-android/dom/media/gmp-plugin-openh264/tmpo6Qqvh.list:
0:02.62 INPUT("gmp-fake-openh264.o")
0:02.62
0:02.62 ../../../build/unix/gold/ld: fatal error: /home/makoto/.mozbuild/androi
d-ndk-r15c/platforms/android-9/arch-arm/usr/lib/../lib/crtbegin_so.o: unsupporte
d ELF machine number 40
0:02.62 clang++: error: linker command failed with exit code 1 (use -v to see i
nvocation)
Blocks: 1163171
Summary: crtbegin_so.o: unsupporte → crtbegin_so.o: unsupported ELF machine number 40 after using clang (bug 1163171)
Reporter | ||
Comment 2•7 years ago
|
||
reason maybe the following.
~/.mozbuild/android-ndk-r15c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin$ ./arm-linux-androideabi-gcc -print-prog-name=ld.gold
/home/mkato/.mozbuild/android-ndk-r15c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld.gold
~/.mozbuild/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/bin$ ./clang -print-prog-name=ld.gold
/usr/bin/ld.gold
Assignee | ||
Comment 3•7 years ago
|
||
What does:
~/.mozbuild/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/bin$ ./clang -gcc-toolchain ~/.mozbuild/android-ndk-r15c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/ -print-prog-name=ld.gold
print for you?
Flags: needinfo?(m_kato)
Assignee | ||
Comment 4•7 years ago
|
||
Actually, better:
~/.mozbuild/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/bin$ ./clang --target arm-linux-androideabi -gcc-toolchain ~/.mozbuild/android-ndk-r15c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/ -print-prog-name=ld.gold
Assignee | ||
Comment 5•7 years ago
|
||
(In reply to Nathan Froyd [:froydnj] from comment #4)
> Actually, better:
>
> ~/.mozbuild/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/bin$
> ./clang --target arm-linux-androideabi -gcc-toolchain
> ~/.mozbuild/android-ndk-r15c/toolchains/arm-linux-androideabi-4.9/prebuilt/
> linux-x86_64/ -print-prog-name=ld.gold
And as reported by #mobile, the correct command should actually be (notice the --target= option):
~/.mozbuild/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/bin$ ./clang --target=arm-linux-androideabi -gcc-toolchain ~/.mozbuild/android-ndk-r15c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/ -print-prog-name=ld.gold
For me, I get:
froydnj@hawkeye:~/src/gecko-dev.git$ /home/froydnj/.mozbuild/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=arm-linux-androideabi -gcc-toolchain /home/froydnj/.mozbuild/android-ndk-r15c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/ -print-prog-name=ld.gold
/home/froydnj/.mozbuild/android-ndk-r15c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld.gold
which is correct (that file exists and knows how to link ARM object files). If the link command isn't finding that linker and is using the system linker instead, that is a problem.
Reporter | ||
Comment 6•7 years ago
|
||
To get correct name, it requires --target and -gcc-toolchain.
makoto@breakbeat:/mozilla$ ~/.mozbuild/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=arm-linux-androideabi -gcc-toolchain ~/.mozbuild/android-ndk-r15c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 -print-prog-name=ld.gold
/home/makoto/.mozbuild/android-ndk-r15c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld.gold
http://searchfox.org/mozilla-central/rev/1ebd2eff44617df3b82eea7d2f3ca1b60cc591a0/build/moz.configure/toolchain.configure#1401-1402
gold_detection_arg = '-print-prog-name=ld.gold'
gold = check_cmd_output(c_compiler.compiler,
gold_detection_arg).strip()
Maybe, this doesn't use --target and -gcc-toolchain
Flags: needinfo?(m_kato)
Assignee | ||
Comment 7•7 years ago
|
||
We were adding c_compiler.flags and toolchain_flags to some paths
through this function, but not all. Not adding those flags caused this
function to detect the host's ld.gold instead of the target's ld.gold.
And that, in turn, caused linker errors when the host ld.gold couldn't
understand the target's object files.
Attachment #8923440 -
Flags: review?(snorp)
Attachment #8923440 -
Flags: review?(snorp) → review+
Pushed by nfroyd@mozilla.com:
https://hg.mozilla.org/mozilla-central/rev/a89e5587c7a7
use the correct command-line flags to detect gold; r=snorp; a=RyanVM
Assignee | ||
Comment 9•7 years ago
|
||
Sorry about this breakage. :( I fixed this case for the automation builds, but because of my mozconfig, wasn't fixing it for developer builds.
Updated•7 years ago
|
Updated•7 years ago
|
Product: Core → Firefox Build System
Updated•6 years ago
|
Assignee: nobody → nfroyd
You need to log in
before you can comment on or make changes to this bug.
Description
•