commercialhaskell / commercialhaskell/stack

Dynamic linking with a local extra-dep is broken

Open
#3,113 3 comments 0 reactions 0 assignees View on GitHub
component: build type: bug
Dominant language
Haskell
Stars
4.1k
Forks
850
Avg merge
10h 37m
Merged PRs (30d)
4

Description

When using a local package as extra-dep in `stack.yaml` like this:

```yaml
- location: ../../../github/path
extra-dep: true
```

And using the `-dynamic` flag with ghc; stack links with the path library in the snapshot rather than with the local path package specified in stack.yaml, resulting in link errors (e.g. undefined reference) during linking. The linker options passed to gcc use the dynamic library from the snapshot.

Contributor guide

Open the contributing guide

Research direction

Reproduce the case using the local extra-dep in stack.yaml and GHC's -dynamic flag. Inspect how Stack resolves the local package versus the snapshot package and how it constructs the gcc linker options. Done means dynamic linking uses the local extra-dep rather than the snapshot library and no longer produces the reported link errors.

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.