Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 892641 - www-client/firefox-109.0 fails to build with mold linker
Summary: www-client/firefox-109.0 fails to build with mold linker
Status: RESOLVED WORKSFORME
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
  Show dependency tree
 
Reported: 2023-01-30 15:36 UTC by Michelangelo Scopelliti
Modified: 2023-06-07 10:48 UTC (History)
1 user (show)

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


Attachments
emerge --info (emerge.info.gz,3.52 KB, application/gzip)
2023-01-30 15:37 UTC, Michelangelo Scopelliti
Details
build log (firefox-109.0:20230130-105012.log.bz2,433.90 KB, application/x-bzip2)
2023-01-30 15:42 UTC, Michelangelo Scopelliti
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michelangelo Scopelliti 2023-01-30 15:36:29 UTC
On my system, LD_FLAGS is set to 

LDFLAGS="-fuse-ld=mold -Wl,-O2 -Wl,--as-needed"

After commit c38056ecf68cd7c730d41fcf131829175a7793ab (gitweb), mold is picked up as an option in mozconfig (-> --enable-linker=mold)

Building firefox then fails. Removing "-fuse-ld=mold " from LD_FLAGS allows to build with no errors.

Reproducible: Always




Logs will follow
Comment 1 Michelangelo Scopelliti 2023-01-30 15:37:09 UTC
Created attachment 849521 [details]
emerge --info
Comment 2 Michelangelo Scopelliti 2023-01-30 15:42:50 UTC
Created attachment 849523 [details]
build log

mold: fatal: /var/tmp/portage/www-client/firefox-109.0/work/firefox_build/toolkit/library/build/libxul_so.list:1022: INPUT("../../../gfx/cairo/cairo/src/cairo-image-source.o")
library not found: ../../../gfx/cairo/cairo/src/cairo-image-source.o
error: linker command failed with exit code 1 (use -v to see invocation)
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-30 15:57:37 UTC
Linker script issue.
Comment 4 Joonas Niilola gentoo-dev 2023-01-30 16:25:03 UTC
That's weird, I managed to build firefox-109.0 with -fuse-ld=mold and pretty similar use flags that you have. 

What are your use flags for cairo and gtk+:3.0?
Comment 5 Joonas Niilola gentoo-dev 2023-01-30 16:54:12 UTC
Does it always fail to the same spot? Are you limited by ulimits? Idea gotten from https://bugzilla.mozilla.org/show_bug.cgi?id=1746462#c3 and the followup comment #4.
Comment 6 Michelangelo Scopelliti 2023-01-30 18:37:39 UTC
(In reply to Joonas Niilola from comment #4)
> That's weird, I managed to build firefox-109.0 with -fuse-ld=mold and pretty
> similar use flags that you have. 
> 
> What are your use flags for cairo and gtk+:3.0?

emerge -pqv cairo gtk+

[ebuild   R   ] x11-libs/cairo-1.17.6  USE="X glib opengl (-aqua) (-debug) (-gles2-only) -gles3 -gtk-doc -test" ABI_X86="(64) -32 (-x32)"
[ebuild   R   ] x11-libs/gtk+-3.24.35  USE="X cups introspection vim-syntax (-aqua) -broadway -colord -examples -gtk-doc -sysprof -test -wayland -xinerama" ABI_X86="(64) -32 (-x32)"

I will try to rebuild both and test again
Comment 7 Michelangelo Scopelliti 2023-01-30 18:41:17 UTC
(In reply to Joonas Niilola from comment #5)
> Does it always fail to the same spot? Are you limited by ulimits? Idea
> gotten from https://bugzilla.mozilla.org/show_bug.cgi?id=1746462#c3 and the
> followup comment #4.

It is strange, on some other machine the failure is in a different spot, but rebuilding on the same machine seems to fail in the same way. I'll make some other test.

About ulimits: 'ulimit' gives 'unlimited'
Comment 8 Michelangelo Scopelliti 2023-01-30 19:00:38 UTC
After rebuilding both cairo and gtk+, the error message is the same.

So, without cleaning the workdir, I've launched an 

ebuild `equery w firefox` compile

and again after removing the offending .o file.

The result is still the same.
Comment 9 Michelangelo Scopelliti 2023-01-31 18:32:17 UTC
(In reply to Joonas Niilola from comment #5)
> Does it always fail to the same spot? Are you limited by ulimits? Idea
> gotten from https://bugzilla.mozilla.org/show_bug.cgi?id=1746462#c3 and the
> followup comment #4.

OK, it appears to be an ulimit problem.

I tampered a little with the parameters, and "ulimit -n 2048" (default 1024) solved the issue on two different systems. I'm not sure if 2048 is too high, though.
Comment 10 Joonas Niilola gentoo-dev 2023-02-01 04:51:27 UTC
I seem to have 
  "-n 1048576 -l unlimited"
for whatever reason. Soo...

Glad you figured it out. Funny how it seems mold will trigger this issue. I do wonder if there's some sort of a recommendation as to good ulimites for desktop machines, or if I need to add some general warning to the ebuild that gets printed with mold in future.
Comment 11 Amit Prakash Ambasta 2023-06-07 09:27:51 UTC
Don't think the current approach is correct. Currently, ulimit is being set in the src_configure phase, but imo it should be set in src_compile phase as I've been using in my overlay here

```https://github.com/ambasta/ambasta/blob/6f3e07fe62a3dae959cb2cb0702e646d474e2a3e/www-client/firefox/firefox-113.0.2.ebuild#L1140```

Attempting to build firefox w/ the ebuild in portage tree still runs into ulimit erros as 

```
173:01.38 mold: fatal: /var/tmp/portage/www-client/firefox-114.0/work/firefox_build/toolkit/library/build/libxul_so.list:1022: INPUT("../../../gfx/cairo/cairo/src/cairo-polygon-reduce.o")
173:01.38                                                                                                                     ^ library not found: ../../../gfx/cairo/cairo/src/cairo-polygon-reduce.o
173:01.42 clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
```
Comment 12 Joonas Niilola gentoo-dev 2023-06-07 10:48:58 UTC
Yeah I guess and was afraid so, tucking it with the mold checks felt the easiest solution though :\

I'll update and move it to src_compile.