Missing modules in `exposed-modules` and linker errors
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
**Describe the bug**
Related: #1746
I recently have [helped a user](https://discourse.haskell.org/t/cryptic-error-when-running-cabal-run-for-the-first-time/6119) with a well know error, forgetting to put modules in `exposed-modules` (edit: actually, `other-modules`, but it is the same problem).
What we know:
- a `-Wmissing-home-modules` warning gets printed.
- The user is clearly not a newbie.
The hint got probably overlooked because of the barrage of abuse by the linker
```
⁝
/tmp/aura_lang/dist-newstyle/build/x86_64-linux/ghc-9.2.1/aura-lang-0.1.0.0/build/libHSaura-lang-0.1.0.0-inplace.a(Parser.o)(.text+0x9406): error: undefined reference to 'aurazmlangzm0zi1zi0zi0zminplace_Syntax_zdWMapLiteral_info'
/tmp/aura_lang/dist-newstyle/build/x86_64-linux/ghc-9.2.1/aura-lang-0.1.0.0/build/libHSaura-lang-0.1.0.0-inplace.a(Parser.o)(.text+0x9496): error: undefined reference to 'aurazmlangzm0zi1zi0zi0zminplace_Syntax_zdWIdentifier_info'
/tmp/aura_lang/dist-newstyle/build/x86_64-linux/ghc-9.2.1/aura-lang-0.1.0.0/build/libHSaura-lang-0.1.0.0-inplace.a(Parser.o)(.text+0xaf16): error: undefined reference to 'aurazmlangzm0zi1zi0zi0zminplace_Syntax_zdWStringLiteral_info'
/tmp/aura_lang/dist-newstyle/build/x86_64-linux/ghc-9.2.1/aura-lang-0.1.0.0/build/libHSaura-lang-0.1.0.0-inplace.a(Parser.o)(.text+0xb43e): error: undefined reference to 'aurazmlangzm0zi1zi0zi0zminplace_Syntax_zdWCharLiteral_info'
/tmp/aura_lang/dist-newstyle/build/x86_64-linux/ghc-9.2.1/aura-lang-0.1.0.0/build/libHSaura-lang-0.1.0.0-inplace.a(Parser.o)(.text+0xbab0): error: undefined reference to 'aurazmlangzm0zi1zi0zi0zminplace_Lexer_boolean1_info'
/tmp/aura_lang/dist-newstyle/build/x86_64-linux/ghc-9.2.1/aura-lang-0.1.0.0/build/libHSaura-lang-0.1.0.0-inplace.a(Parser.o)(.data+0xbd8): error: undefined reference to 'aurazmlangzm0zi1zi0zi0zminplace_Lexer_variable_closure'
/tmp/aura_lang/dist-newstyle/build/x86_64-linux/ghc-9.2.1/aura-lang-0.1.0.0/build/libHSaura-lang-0.1.0.0-inplace.a(Parser.o)(.data+0xbe8): error: undefined reference to 'aurazmlangzm0zi1zi0zi0zminplace_Lexer_comma1_closure'
/tmp/aura_lang/dist-newstyle/build/x86_64-linux/ghc-9.2.1/aura-lang-0.1.0.0/build/libHSaura-lang-0.1.0.0-inplace.a(Parser.o)(.data+0x11a0): error: undefined reference to 'aurazmlangzm0zi1zi0zi0zminplace_Lexer_boolean1_closure'
/tmp/aura_lang/dist-newstyle/build/x86_64-linux/ghc-9.2.1/aura-lang-0.1.0.0/build/libHSaura-lang-0.1.0.0-inplace.a(Parser.o)(.data+0x1458): error: undefined reference to 'aurazmlangzm0zi1zi0zi0zminplace_Lexer_arrow1_closure'
⁝
```
*and* the fact that warnings are not displayed again on a new `cabal run`.
**Expected behavior**
The user notices the error, is able to understand it and fix it by themselves.
I would not know precisely what to suggest though: upgrading the warning to error could be annoying to a number of developers. Redirecting linker output somewhere too could break some dev setups.
**To reproduce**
Create a lib/exe `.cabal`, forget to expose a module in the lib that is needed by the exe.
Contributor guide
Assessment
This issue has not been assessed yet.