haskell / haskell/cabal

Cabal will build and install broken library if other-modules is not complete

Open
#2,982 18 comments 0 reactions 0 assignees View on GitHub
blocked: ghc Cabal: other
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

This is a reopen of #121

Cabal computes the set of object files to link into an archive by using the `exposed-modules`/`other-modules` fields. This means that if an imported module is omitted, it isn't put into the archive.

That in and of itself isn't too bad (since the Cabal file is buggy), but THEN Cabal will happily proceed to install this broken archive, and then you'll get a mysterious linker error error when you try to use it. Disaster!

A number of resolutions were suggested in the previous ticket:
- Cabal should test install a library (i.e. make sure it loads) before it gets installed
- Cabal learns how to chase module dependencies through GHC (by some mechanism, maybe parsing `-v` output or running `ghc -M`)

Attached is a test case:
[test.zip](https://github.com/haskell/cabal/files/69936/test.zip)

Contributor guide

Open the contributing guide

Research direction

Start with the attached test case and trace how Cabal computes object files from exposed-modules and other-modules during library build and installation. Review the two proposed directions in the issue, then establish a test that prevents a library with omitted imported modules from being installed as a broken archive.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
build-system
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.