Stack Error: Couldn't figure out linker information

Stack used to work for me when I used the stack package from the package repo.

I switched over to ghcup to better manage versions, and now stack is complaining about not finding a linker. However, I have GNU ld on my system, what can I do here?

I have tested with Stack 2.9.1 and 2.9.3, and ghc 9.4.4.

$ stack build
[1 of 2] Compiling Main             ( /home/daniel/.stack/setup-exe-src/setup-SvXsv1f_.hs, /home/daniel/.stack/setup-exe-src/setup-SvXsv1f_.o )
[2 of 2] Compiling StackSetupShim   ( /home/daniel/.stack/setup-exe-src/setup-shim-SvXsv1f_.hs, /home/daniel/.stack/setup-exe-src/setup-shim-SvXsv1f_.o )
Linking /home/daniel/.stack/setup-exe-cache/x86_64-linux/tmp-Cabal-simple_SvXsv1f__3.6.3.0_ghc-9.2.5 ...

<no location info>: error:
    Warning: Couldn't figure out linker information!
             Make sure you're using GNU ld, GNU gold or the built in OS X linker, etc.
collect2: fatal error: cannot find ‘ld’
compilation terminated.
`gcc' failed in phase `Linker'. (Exit code: 1)

Error: [S-6374]
       While building simple Setup.hs (scroll up to its section to see the error) using:
       /home/daniel/.ghcup/ghc/9.2.5/bin/ghc -rtsopts -threaded -clear-package-db -global-package-db -hide-all-packages -package base -main-is StackSetupShim.mainOverride -package Cabal-3.6.3.0 /home/daniel/.stack/setup-exe-src/setup-SvXsv1f_.hs /home/daniel/.stack/setup-exe-src/setup-shim-SvXsv1f_.hs -o /home/daniel/.stack/setup-exe-cache/x86_64-linux/tmp-Cabal-simple_SvXsv1f__3.6.3.0_ghc-9.2.5
       Process exited with code: ExitFailure 1 
$ ld --version
GNU ld (GNU Binutils) 2.40
Copyright (C) 2023 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.