amazon-linux-2023 icon indicating copy to clipboard operation
amazon-linux-2023 copied to clipboard

[Bug] - ld.gold is missing from binutils package

Open sebsto opened this issue 2 years ago • 8 comments

Describe the bug On ALI2 (and Ubuntu) the linker ld.gold is included in the binutils package

binutils-2.29.1-31.amzn2.x86_64 : A GNU collection of binary utilities
Repo        : @amzn2-core
Matched from:
Filename    : /usr/bin/ld.gold

The linker is missing from binutils package on ALi2023.

$ dnf whatprovides ld.gold
Last metadata expiration check: 0:08:18 ago on Mon Apr 24 12:12:49 2023.
Error: No matches found. If searching for a file, try specifying the full path or using a wildcard prefix ("*/") at the beginning.

$ dnf repoquery -l binutils | grep gold
Last metadata expiration check: 0:08:42 ago on Mon Apr 24 12:12:49 2023.

This prevent to build some open source projects from the source (ex : https://swift.org)

To Reproduce To an instance with ALI2023 and type

dnf whatprovides ld.gold

Expected behavior ld.gold is part of the standard toolchain for multiple open source projects. These projects can not be compiled on ALI2023

Screenshots n/a

Desktop (please complete the following information):

  • ALI 2023

sebsto avatar Apr 24 '23 12:04 sebsto

commit 8723c3add11eff25826b05275342b5df845ba31e (origin/al2022-new-macros)
Author: Amit Shah <[email protected]>
Date:   Wed Jun 29 13:34:08 2022 +0000

    binutils: drop gold
    
    The gold linker has bitrotted, and does not see updates anymore.
    
    The original devs of the gold linker have moved on to LLVM.
    
    This drops the subpackage binutils-gold.

sebsto avatar Apr 24 '23 12:04 sebsto

This is an intentional change, to not currently ship ld.gold.

Is the root request here to have the Swift compiler available on Amazon Linux 2023?

stewartsmith avatar Apr 27 '23 22:04 stewartsmith

I am working with Apple on the scripts used to build the distribution packages of Swift on different platforms. We are adding support for Amazon Linux 2023. https://github.com/apple/swift-installer-scripts

The port from Amazon Linux 2 to Amazon Linux 2023 is made difficult by two breaking changes:

  • the first one is the lack of support for ld.gold forcing us to modify the build scripts to use lld on Amazon Linux 2023 only (other platforms Ubuntu, ALI2, RedHat, Oracle Linux, Debian all provide ld.gold)
  • the second one is specific to Graviton : the clang tool chain is located under /lib/gcc/aarch64-amazon-linux/11 which is not found - by default - by clang. I wonder what drove the decision to use a custom name vs using a standard one like aarch64-linux-gnu

sebsto avatar Apr 28 '23 07:04 sebsto

Similar issue with Go, it currently requires the Gold linker for builds on ARM so the official binary releases are not compatible (https://github.com/golang/go/issues/22040).

It looks like this may be resolved in binutils 2.41 (https://github.com/golang/go/issues/22040#issuecomment-1678403929), however this is also newer than what Amazon Linux 2023 ships with.

lstoll avatar Jan 17 '24 15:01 lstoll

Here is an easy script to install ld.gold from the sources on Amazon Linux 2023 https://gist.github.com/sebsto/219315a80333fb0661e03be2e0d00c80

sebsto avatar Feb 17 '24 09:02 sebsto

to build pandoc you need ld.gold

danie-dejager avatar Apr 17 '24 11:04 danie-dejager

The regular linker probably works fine (although I haven't tried it)

stewartsmith avatar Apr 17 '24 17:04 stewartsmith

for some reason the haskel cabal builds in EPEL need the ld.gold linker to build. ¯\_(ツ)_/¯

danie-dejager avatar Apr 18 '24 09:04 danie-dejager

https://www.phoronix.com/news/GNU-Gold-Linker-Deprecated The GNU Binutils 2.44 release announcement explained the current situation: "In a change to our previous practice, in this release the binutils-2.44.tar tarball does not contain the sources for the gold linker. This is because the gold linker is now deprecated and will eventually be removed unless volunteers step forward and offer to continue development and maintenance.

The gold sources can be found in the binutils-with-gold-2.44.tar tarballs. Going forward, odd numbered releases of the binutils (2.45, 2.47, etc) will just have the binutils.2.xx.tar tarballs, whilst even numbered releases will have both the binutils-2.xx.tar and the binutils-with-gold-2.xx.tar tarballs. Eventually this will stop and gold will be dropped altogether."

danie-dejager avatar Feb 06 '25 13:02 danie-dejager

I'm going to tag this issue as documentation, as we should document the deprecation of ld.gold in the AL2023 User Guide.

stewartsmith avatar Feb 09 '25 18:02 stewartsmith