Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Per-project linker choice is not honoured #10769

Open
Kleidukos opened this issue Jan 30, 2025 · 2 comments
Open

Per-project linker choice is not honoured #10769

Kleidukos opened this issue Jan 30, 2025 · 2 comments

Comments

@Kleidukos
Copy link
Member

Kleidukos commented Jan 30, 2025

Context:

I'm converting a project to cabal, and it has many shell scripts with such invocations:

export USE_LINKER=lld

ghc -Wall -i../.. \
  -odir ../../build \
  -hidir ../../build \
  ../../libiced_hs.a \
  ${USE_LINKER+-optl -fuse-ld="$USE_LINKER"} \
  main.hs

(https://github.com/ibaryshnikov/iced-hs/blob/5c7ad27deba8fad4f29df7d16d67881c21ca1508/examples/radio/build.sh#L7-L12)

However it's unclear to me how to create a working setup where lld is used reliably.

## Reproducer

$ git clone https://github.com/haskell-text/text-display
$ cd text-display
$ git switch use-lld
$ cabal build

<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)

What is the preferred workflow these days?

@TeofilC
Copy link
Collaborator

TeofilC commented Feb 7, 2025

Incidentally I have recently created a GHC issue asking the same question but about GHC: https://gitlab.haskell.org/ghc/ghc/-/issues/25726

@TeofilC
Copy link
Collaborator

TeofilC commented Feb 7, 2025

Btw I think the issue is that in your case you are passing -fuse-ld=lld to your linker, which is probably ld.bfd or ld.gold. But you are meant to pass it to gcc.

I saw the same message and this is what was causing it for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants