Configure fails for android build with "ERROR: Failed to find a linker" with --enable-release
Categories
(Firefox Build System :: General, defect, P3)
Tracking
(firefox-esr78 wontfix, firefox86 wontfix, firefox87 fixed)
People
(Reporter: jnicol, Assigned: glandium)
References
(Regression)
Details
(Keywords: in-triage, regression)
Attachments
(2 files)
This is on a brand new PC so a fresh setup, so it's possible I'm missing some magic I had done to my old machine.
I checked out gecko, ran ./mach bootstrap
for android, then ran ./mach build
.
I get the following error:
0:03.16 checking for linker...
0:03.16 DEBUG: Executing:/usr/bin/clang -std=gnu99 --target=arm-linux-androideabi -Wl,--version -isystem /home/jamie/.mozbuild/android-ndk-r17b/sysroot/usr/include/arm-linux-androideabi -isystem /home/jamie/.mozbuild/android-ndk-r17b/sysroot/usr/include -gcc-toolchain /home/jamie/.mozbuild/android-ndk-r17b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 -D__ANDROID_API__=16
0:03.16 ERROR: Failed to find a linker
I had recently removed the CC and CXX lines from my mozconfig, as I'd read in bug 1561323 to do so. Adding them back in (to point to mozbuild's clang) makes the problem go away.
This is a reduced mozconfig which still triggers the bug:
ac_add_options --enable-application=mobile/android
ac_add_options --with-android-ndk="${HOME}/.mozbuild/android-ndk-r17b"
and adding this fixes it:
CC="${HOME}/.mozbuild/clang/bin/clang"
CXX="${HOME}/.mozbuild/clang/bin/clang++"
Comment 1•5 years ago
|
||
jnicol: huh, that's surprising. Can you give me the complete log of ./mach configure
in the failing case (i.e., without CC
and CXX
)? After Bug 1519954 what you set should be the default... but if you look at your partial log, we're clearly finding /usr/bin/clang
.
glandium: thoughts?
Reporter | ||
Comment 3•5 years ago
|
||
This is building central.
Huh, this is interesting. I must have been mistaken yesterday when I said that 2-line reduced mozconfig reproduced it. Today I'm seeing it work fine with that: checking for the target C compiler... /home/jamie/.mozbuild/clang/bin/clang
. But if I add the line ac_add_options --enable-release
to my mozconfig then it tries to use /usr/bin/clang
, and I get the linker error.
Any idea why that flag would cause that?
Assignee | ||
Comment 4•5 years ago
|
||
Because with --enable-release
, .mozbuild is considered last, so if a compiler can be found before that, it will be used.
Updated•5 years ago
|
Comment 5•5 years ago
|
||
I think this is working as intended. glandium, should we prefer .mozbuild
for developer builds even with --enable-release
? I personally think so but don't have good context here.
If we don't want this, let's close this ticket.
Reporter | ||
Comment 6•5 years ago
|
||
Thanks for helping here, happy for this to be closed. I don't usually have that option, but was doing some profiling of rust code and heard that's how to get it optimised properly. Is there a better way to achieve that?
Assignee | ||
Comment 7•5 years ago
|
||
should we prefer .mozbuild for developer builds even with --enable-release?
Well, that's the thing... The definition of a developer build is one without --enable-release... (and --enable-release is enabled by default on beta/release/esr). I do think there's something to improve here, and I think how I'm going to fix bug 1553230 will get us closer to being able to do that.
Comment 8•5 years ago
|
||
Bugbug thinks this bug should belong to this component, but please revert this change in case of error.
Updated•5 years ago
|
Assignee | ||
Comment 9•4 years ago
|
||
There is something more general than an Android problem here. In fact, I found this bug again while filing a bug with the title "Configure fails with "Failed to find a linker" in some cases instead of trying lld".
Assignee | ||
Comment 10•4 years ago
|
||
Comment 11•4 years ago
|
||
Comment 12•4 years ago
|
||
bugherder |
Updated•4 years ago
|
Updated•3 years ago
|
Description
•