Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 936253 - media-sound/mpd-0.23.13-r1 hates all linkers (dev-build/meson bug with linker detection?)
Summary: media-sound/mpd-0.23.13-r1 hates all linkers (dev-build/meson bug with linker...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal
Assignee: Adrian Schollmeyer
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: systemwide-mold
  Show dependency tree
 
Reported: 2024-07-18 14:27 UTC by Paul Gover
Modified: 2024-07-20 03:58 UTC (History)
5 users (show)

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


Attachments
emerge --info media-sound/mpd (file_936253.txt,9.22 KB, text/plain)
2024-07-18 14:27 UTC, Paul Gover
Details
media-sound/mpd-foo/temp directory tarball (mpd.build.log,42.34 KB, text/x-log)
2024-07-19 16:31 UTC, Paul Gover
Details
mpd emerge temp directory tarball (mpd.temp.tgz,42.34 KB, application/x-compressed-tar)
2024-07-19 16:35 UTC, Paul Gover
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Gover 2024-07-18 14:27:30 UTC
Created attachment 897929 [details]
emerge --info media-sound/mpd

Today's update brought media-sound/mpd-0.23.13-r1.  It failed early during the compilation, the build.log complaining that the build only supports a limited list of linkers, and specifically not ld.bfd.  Which would be fine except AFAIK I'm using mold everywhere, and that was explicitly listed.

Trying my usual /etc/portage/package.env override for lld failed with the same message, despite it being listed.

Digging around, I came across /etc/clang/gentoo-runtimes.cfg which specifies
--fuse-ld=bfd
so I tried changing it to --fuse-ld=mold, and that cured it.

So something weird is going on, as it appears my usual override (see emerge --info attached) isn't being recognised by mpd, though I'm sure it works elsewhere.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-07-18 18:43:55 UTC
No build.log?
Comment 2 Paul Gover 2024-07-18 19:33:04 UTC
Tomorrow (I need to recreate it and it's getting late)
Comment 3 Paul Gover 2024-07-19 16:31:39 UTC
Created attachment 897996 [details]
media-sound/mpd-foo/temp directory tarball

I made the tarball as there seem to be some additional relevant files than just build.log.
Comment 4 Paul Gover 2024-07-19 16:35:42 UTC
Created attachment 897997 [details]
mpd emerge temp directory tarball

Same contents as previous, but with a name that bugzilla might handle better than "log"
Comment 5 Eli Schwartz gentoo-dev 2024-07-19 17:24:10 UTC
C compiler for the host machine: clang (clang 17.0.6 "clang version 17.0.6")
C linker for the host machine: clang ld.mold 2.31.0
C++ compiler for the host machine: clang++ (clang 17.0.6 "clang version 17.0.6")
C++ linker for the host machine: clang++ ld.mold 2.31.0

[...]

ERROR: LLVM's ThinLTO only works with gold, lld, lld-link, ld64 or mold, not ld.bfd

A full log can be found at /var/tmp/portage/media-sound/mpd-0.23.15-r1/work/mpd-0.23.15-build/meson-logs/meson-log.txt

I'm not sure how this happens. With a test project, meson works fine via:

CC="clang" LDFLAGS="-fuse-ld=mold" meson setup -Db_lto=true -Db_lto_mode=thin builddir/

The error message is an internal error:


            # ThinLTO requires the use of gold, lld, ld64, lld-link or mold 1.1+
            if isinstance(self.linker, (MoldDynamicLinker)):
                # https://github.com/rui314/mold/commit/46995bcfc3e3113133620bf16445c5f13cd76a18
                if not mesonlib.version_compare(self.linker.version, '>=1.1'):
                    raise mesonlib.MesonException("LLVM's ThinLTO requires mold 1.1+")
            elif not isinstance(self.linker, (AppleDynamicLinker, ClangClDynamicLinker, LLVMDynamicLinker, GnuGoldDynamicLinker)):
                raise mesonlib.MesonException(f"LLVM's ThinLTO only works with gold, lld, lld-link, ld64 or mold, not {self.linker.id}")
Comment 6 Paul Gover 2024-07-19 19:15:15 UTC
Hmm, as per my original Description, that error message would appear to imply "self linker" has been built from the information in /etc/clang/gentoo-runtimes.cfg (leading to an ld.bfd linker), and not been overridden by LDFLAGS in this instance.

Apologies - you probably had already worked that out, but I thought I better say it in case my Description wasn't clear.
Comment 7 Eli Schwartz gentoo-dev 2024-07-19 19:23:52 UTC
Right, the problem is that the logs identify the linker model as "clang++ ld.mold 2.31.0" and in theory it should never be able to print "ld.mold" there unless we are indeed inside MoldDynamicLinker.

It is only class MoldDynamicLinker(GnuDynamicLinker) that has a self.id = 'ld.mold', nothing else inherits from it, so the meson codebase shouldn't be able to hit this error under such a circumstance.

The linker id shouldn't be getting recalculated or reset at any point, and it was definitely detected correctly at the start...