Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 911591 - =www-client/firefox-116.0 fails to build with sys-devel/mold with DT_RELR
Summary: =www-client/firefox-116.0 fails to build with sys-devel/mold with DT_RELR
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Mozilla Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: systemwide-mold 818376
  Show dependency tree
 
Reported: 2023-08-02 08:56 UTC by Amit Prakash Ambasta
Modified: 2023-11-22 00:47 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Amit Prakash Ambasta 2023-08-02 08:56:13 UTC
Trying to build firefox-116, w/ mold linker current fails:

 1:10.70 error: failed to run custom build command for `proc-macro2 v1.0.59`
 1:10.70 note: To improve backtraces for build dependencies, set the CARGO_PROFILE_RELEASE_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.
 1:10.70 Caused by:
 1:10.70   process didn't exit successfully: `/var/tmp/portage/www-client/firefox-116.0/work/firefox_build/instrumented/release/build/proc-macro2-3bec9dfcd1853c93/build-script-build` (exit status: 127)
 1:10.70   --- stderr
 1:10.70   /var/tmp/portage/www-client/firefox-116.0/work/firefox_build/instrumented/release/build/proc-macro2-3bec9dfcd1853c93/build-script-build: error while loading shared libraries: /var/tmp/portage/www-client/firefox-116.0/work/firefox_build/instrumented/release/build/proc-macro2-3bec9dfcd1853c93/build-script-build: DT_RELR without GLIBC_ABI_DT_RELR dependency


Might be due to https://github.com/rui314/mold/issues/653
Comment 1 Amit Prakash Ambasta 2023-08-02 09:22:48 UTC
On further debugging (and manually building proc-macro2 with mold), it seems like the firefox provided cargo linker is the issue passed via 

-C linker=/var/tmp/portage/www-client/firefox-116.0/work/firefox-116.0/build/cargo-linker

```
CARGO=/usr/lib/rust/1.71.0/bin/cargo-1.71.0
CARGO_CRATE_NAME=build_script_build
CARGO_MANIFEST_DIR=/var/tmp/portage/www-client/firefox-116.0/work/firefox-116.0/third_party/rust/proc-macro2
CARGO_PKG_AUTHORS='David Tolnay <dtolnay@gmail.com>:Alex Crichton <alex@alexcrichton.com>'
CARGO_PKG_DESCRIPTION='A substitute implementation of the compiler'\''s `proc_macro` API to decouple token-based libraries from the procedural macro use case.'
CARGO_PKG_HOMEPAGE=''
CARGO_PKG_LICENSE='MIT OR Apache-2.0'
CARGO_PKG_LICENSE_FILE=''
CARGO_PKG_NAME=proc-macro2
CARGO_PKG_README=README.md
CARGO_PKG_REPOSITORY='https://github.com/dtolnay/proc-macro2'
CARGO_PKG_RUST_VERSION=1.31
CARGO_PKG_VERSION=1.0.59
CARGO_PKG_VERSION_MAJOR=1
CARGO_PKG_VERSION_MINOR=0
CARGO_PKG_VERSION_PATCH=59
CARGO_PKG_VERSION_PRE=''
LD_LIBRARY_PATH='/var/tmp/portage/www-client/firefox-116.0/work/firefox_build/instrumented/release/deps:/usr/lib/rust/1.71.0/lib'

/usr/bin/rustc
  --crate-name build_script_build
  --edition=2018
  /var/tmp/portage/www-client/firefox-116.0/work/firefox-116.0/third_party/rust/proc-macro2/build.rs
  --error-format=json
  --json=diagnostic-rendered-ansi,artifacts,future-incompat
  --crate-type bin
  --emit=dep-info,link
  -C opt-level=1
  -C embed-bitcode=no
  --cfg 'feature="default"'
  --cfg 'feature="proc-macro"'
  -C metadata=3bec9dfcd1853c93
  -C extra-filename=-3bec9dfcd1853c93
  --out-dir /var/tmp/portage/www-client/firefox-116.0/work/firefox_build/instrumented/release/build/proc-macro2-3bec9dfcd1853c93
  -C linker=/var/tmp/portage/www-client/firefox-116.0/work/firefox-116.0/build/cargo-linker
  -L dependency=/var/tmp/portage/www-client/firefox-116.0/work/firefox_build/instrumented/release/deps
  --cap-lints warn`
```

Omitting `-C linker=/var/tmp/portage/www-client/firefox-116.0/work/firefox-116.0/build/cargo-linker` works correctly
Comment 2 Stefan Salewski 2023-08-02 11:41:46 UTC
Thanks for reporting and your investigations. I just had the same issue for AMD64, and initially had no idea for the cause. Have not suspected mold as the reason, as mold was working fine before with Firefox. sys-devel/mold-2.0.0-r1. Will try with old ldd and will report is that should fail as well, but I think that will work.
Comment 3 Joonas Niilola gentoo-dev 2023-08-02 16:57:51 UTC
Hmm is this with clang+mold or gcc+mold? I think at least elfhack needs to be disabled if gcc+mold is detected.
Comment 4 Stefan Salewski 2023-08-02 19:38:32 UTC
I have clang use flag enabled in make.conf.

```
$ emerge -pv firefox

These are the packages that would be merged, in order:

Calculating dependencies... done!
Dependency resolution took 3.08 s.

[ebuild     U ~] www-client/firefox-116.0:rapid::gentoo [115.0.2:rapid::gentoo] USE="X clang dbus gmp-autoupdate hwaccel jumbo-build lto openh264 pgo system-av1 system-harfbuzz system-icu system-jpeg system-libevent system-libvpx system-png system-webp telemetry wayland -debug -eme-free -geckodriver -hardened -jack -libproxy -pulseaudio -screencast (-selinux) -sndio (-system-python-libs) (-valgrind) -wifi" L10N="de -ach -af -an -ar -ast -az -be -bg -bn -br -bs -ca -ca-valencia -cak -cs -cy -da -dsb -el -en-CA -en-GB -eo -es-AR -es-CL -es-ES -es-MX -et -eu -fa -ff -fi -fr -fur -fy -ga -gd -gl -gn -gu -he -hi -hr -hsb -hu -hy -ia -id -is -it -ja -ka -kab -kk -km -kn -ko -lij -lt -lv -mk -mr -ms -my -nb -ne -nl -nn -oc -pa -pl -pt-BR -pt-PT -rm -ro -ru -sc -sco -si -sk -sl -son -sq -sr -sv -szl -ta -te -th -tl -tr -trs -uk -ur -uz -vi -xh -zh-CN -zh-TW" 0 KiB

Total: 1 package (1 upgrade), Size of downloads: 0 KiB

salewski@hx90 ~ $ cat /etc/portage/package.use/firefox 
www-client/firefox hwaccel openh264 system-av1 system-harfbuzz system-icu system-jpeg system-libevent system-libvpx system-png system-python-libs system-webp

```

Disabling mold fails now also, I think ldd is not available for latest llvm. I was not aware that the linker is coupled to llvm, maybe I would have to reinstall llvm with mold disabled. But I will test without clang use flag tomorrow first. Maybe I should mention that I am using the Gentoo-LTO overlay, but I think that makes no difference for Firefox.

 * Checking for at least 13500 MiB disk space at "/var/tmp/portage/www-client/firefox-116.0/temp" ...                                                                     [ ok ]
 * sys-devel/lld:16 is missing! Cannot use LLVM slot 16 ...
 * virtual/rust:0/llvm-15 is missing! Cannot use LLVM slot 15 ...
 * sys-devel/clang:14 is missing! Cannot use LLVM slot 14 ...
Comment 5 Amit Prakash Ambasta 2023-08-04 06:52:50 UTC
Builds fine w/ clang + lld, gcc + mold.

Fails w/ clang + mold (with out without elfhack)
Comment 6 Joonas Niilola gentoo-dev 2023-08-07 13:05:50 UTC
Unfortunately latest upstream elf-hack patches don't fix this, so it's not elf-hack related.


(In reply to Amit Prakash Ambasta from comment #1)
> 
> Omitting `-C
> linker=/var/tmp/portage/www-client/firefox-116.0/work/firefox-116.0/build/
> cargo-linker` works correctly

What's the proper fix for this? Why can't I find any upstream bug about it, is this Gentoo-related?
Comment 7 Amit Prakash Ambasta 2023-08-08 07:50:17 UTC
Definitely an issue in upstream. Filed an upstream bug as well at https://bugzilla.mozilla.org/show_bug.cgi?id=1847697
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-08-09 03:05:45 UTC
(In reply to Amit Prakash Ambasta from comment #7)
> Definitely an issue in upstream. Filed an upstream bug as well at
> https://bugzilla.mozilla.org/show_bug.cgi?id=1847697

-> https://github.com/rui314/mold/issues/653#issuecomment-1670274638.

I can backport the fix to mold, I suppose.
Comment 9 Larry the Git Cow gentoo-dev 2023-08-09 03:11:15 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0b8e1cc4c541041f00338d897d34fabe66ae87b8

commit 0b8e1cc4c541041f00338d897d34fabe66ae87b8
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-08-09 03:10:49 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-08-09 03:11:03 +0000

    sys-devel/mold: backport DT_RELR fix
    
    Bug: https://bugs.gentoo.org/911591
    Signed-off-by: Sam James <sam@gentoo.org>

 .../mold/files/mold-2.0.0-DT_RELR-dependency.patch | 161 +++++++++++++++++++++
 sys-devel/mold/mold-2.0.0-r2.ebuild                |  94 ++++++++++++
 2 files changed, 255 insertions(+)
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-08-09 03:13:15 UTC
(In reply to Sam James from comment #8)
> (In reply to Amit Prakash Ambasta from comment #7)
> > Definitely an issue in upstream. Filed an upstream bug as well at
> > https://bugzilla.mozilla.org/show_bug.cgi?id=1847697
> 
> -> https://github.com/rui314/mold/issues/653#issuecomment-1670274638.
> 
> I can backport the fix to mold, I suppose.

Done. We should still backport the Firefox workaround though: https://bugzilla.mozilla.org/show_bug.cgi?id=1847697#c4.
Comment 11 Larry the Git Cow gentoo-dev 2023-08-09 06:43:08 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b865b575dde25d3a7abfd7717444a167f4d2e631

commit b865b575dde25d3a7abfd7717444a167f4d2e631
Author:     Joonas Niilola <juippis@gentoo.org>
AuthorDate: 2023-08-09 06:42:19 +0000
Commit:     Joonas Niilola <juippis@gentoo.org>
CommitDate: 2023-08-09 06:42:19 +0000

    www-client/firefox: fix 116 with mold linker
    
    Closes: https://bugs.gentoo.org/911591
    Signed-off-by: Joonas Niilola <juippis@gentoo.org>

 www-client/firefox/Manifest             | 2 +-
 www-client/firefox/firefox-116.0.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Comment 12 Joonas Niilola gentoo-dev 2023-08-09 06:43:31 UTC
Seems to work now. Thanks all!