Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 831282 - net-libs/webkit-gtk: fails to build with mold linker (sys-devel/mold)
Summary: net-libs/webkit-gtk: fails to build with mold linker (sys-devel/mold)
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Linux Gnome Desktop Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: systemwide-mold
  Show dependency tree
 
Reported: 2022-01-16 02:34 UTC by Michael Orlitzky
Modified: 2022-07-15 21:57 UTC (History)
3 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 Michael Orlitzky gentoo-dev 2022-01-16 02:34:58 UTC
Trying to build webkit-gtk with mold as the linker currently fails:

  CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:69 (message):
    The C compiler

      "/usr/bin/x86_64-pc-linux-gnu-gcc"

    is not able to compile a simple test program.
    ...
    mold: unknown command line option: --no-keep-memory

That "--no-keep-memory" flag is appended by the ebuild and looks like it is not critical, so hopefully this is an easy fix.
Comment 1 Larry the Git Cow gentoo-dev 2022-01-16 02:46:06 UTC
The bug has been closed via the following commit(s):

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

commit aa8c75638bbc8e9d35f33478ab3b0e18b83f19dc
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-01-16 02:44:50 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-01-16 02:45:48 +0000

    net-libs/webkit-gtk: test if linker supports --no-keep-memory
    
    For example, mold doesn't.
    
    Closes: https://bugs.gentoo.org/831282
    Signed-off-by: Sam James <sam@gentoo.org>

 net-libs/webkit-gtk/webkit-gtk-2.34.3.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 2 Michael Orlitzky gentoo-dev 2022-01-16 14:48:15 UTC
Thanks, but... that actually doesn't help when using GCC with "-fuse-ld=mold". The flagomatic test is running,

  x86_64-pc-linux-gnu-g++ -Werror -std=c++17 -xc++ -c \
  /var/tmp/portage/net-libs/webkit-gtk-2.34.3/temp/test-flag.cc \
  -o /var/tmp/portage/net-libs/webkit-gtk-2.34.3/temp/test-flag.exe

which checks that /usr/bin/ld (either ld.bfd or ld.gold, depending on binutils' USE flags) support the flag.
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-01-20 05:53:43 UTC
(In reply to Michael Orlitzky from comment #2)
> Thanks, but... that actually doesn't help when using GCC with
> "-fuse-ld=mold". The flagomatic test is running,
> 
>   x86_64-pc-linux-gnu-g++ -Werror -std=c++17 -xc++ -c \
>   /var/tmp/portage/net-libs/webkit-gtk-2.34.3/temp/test-flag.cc \
>   -o /var/tmp/portage/net-libs/webkit-gtk-2.34.3/temp/test-flag.exe
> 
> which checks that /usr/bin/ld (either ld.bfd or ld.gold, depending on
> binutils' USE flags) support the flag.

Oh, ugh, I see. I'm really surprised we've not got a proper way of handling this?
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-01-20 05:54:15 UTC
(In reply to Sam James from comment #3)
> (In reply to Michael Orlitzky from comment #2)
> > Thanks, but... that actually doesn't help when using GCC with
> > "-fuse-ld=mold". The flagomatic test is running,
> > 
> >   x86_64-pc-linux-gnu-g++ -Werror -std=c++17 -xc++ -c \
> >   /var/tmp/portage/net-libs/webkit-gtk-2.34.3/temp/test-flag.cc \
> >   -o /var/tmp/portage/net-libs/webkit-gtk-2.34.3/temp/test-flag.exe
> > 
> > which checks that /usr/bin/ld (either ld.bfd or ld.gold, depending on
> > binutils' USE flags) support the flag.
> 
> Oh, ugh, I see. I'm really surprised we've not got a proper way of handling
> this?

... it'd.. be enough to just respect ${LDFLAGS}?
Comment 5 Michael Orlitzky gentoo-dev 2022-01-20 14:46:47 UTC
(In reply to Sam James from comment #4)
> > 
> > Oh, ugh, I see. I'm really surprised we've not got a proper way of handling
> > this?
> 
> ... it'd.. be enough to just respect ${LDFLAGS}?

That was my first thought. It's probably OK, but it does change the meaning of the test from "does CCLD support this flag?" to "does CCLD support this flag along with $LDFLAGS"?

I can imagine some (highly contrived) cases where the former is what's desired.
Comment 6 Marco Scardovi (scardracs) 2022-01-24 11:47:57 UTC
Try to use /usr/bin/mold as symlink of /usr/bin/ld instead of -fuse-ld=mold and see if it helps: I used to have some problems using -fuse-ld too
Comment 7 Michael Orlitzky gentoo-dev 2022-01-30 15:13:03 UTC
I opened bug 832377 for the eclass.
Comment 8 Michael Orlitzky gentoo-dev 2022-04-03 12:07:31 UTC
Can we band-aid this in the meantime? The gcc "-fuse-ld=mold" flag isn't free-form, so we could check *FLAGS for it without feeling too guilty.
Comment 9 rajas 2022-05-14 23:47:48 UTC
Could this be the band aid?

    # Try to use less memory, bug #469942 (see Fedora .spec for reference)
    # --no-keep-memory doesn't work on ia64, bug #502492
    local ldinuse=$(get-flag "fuse-ld")
    if ! use ia64 && [[ ${ldinuse} != "mold" ]] ; then
        append-ldflags $(test-flags-CCLD "-Wl,--no-keep-memory")
    fi
Comment 10 Michael Orlitzky gentoo-dev 2022-05-16 11:10:32 UTC
(In reply to rajas from comment #9)
> Could this be the band aid?
> 
>     # Try to use less memory, bug #469942 (see Fedora .spec for reference)
>     # --no-keep-memory doesn't work on ia64, bug #502492
>     local ldinuse=$(get-flag "fuse-ld")
>     if ! use ia64 && [[ ${ldinuse} != "mold" ]] ; then
>         append-ldflags $(test-flags-CCLD "-Wl,--no-keep-memory")
>     fi

You might be able to shorten it a bit with "is-flagq", but yes, something easy like that is all it should take.
Comment 11 Michael Orlitzky gentoo-dev 2022-07-15 21:57:19 UTC
To my great confusion (trying to reproduce the failure), it looks like mold has gained the ability to parse & ignore this flag:

  https://github.com/rui314/mold/commit/bd3fa9a3db4c2

So a fair solution is: upgrade your sys-devel/mold.