haskell / haskell/cabal

Per-project linker choice is not honoured

Open
#10,769 2 comments 2 reactions 0 assignees View on GitHub
needs triage type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

## Context:

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

```bash
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

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

```

: 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?

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure with the text-display repository, its use-lld branch, and cabal build. Trace how the project-level linker choice reaches the GHC linking command; done means the configured lld choice is honored reliably without requiring a system ld.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.