Cabal v2.2 c-sources fails to link when .c file happens to have the same base name as a .hs file
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
Hey,
I stumbled upon a weird issue. The capitalization of a `.c` file specified in `c-sources` affects whether its symbols get linked to the resulting executable. Has anyone seen anything like this?
Here's a test-case that reproduces this at least on my Arch Linux setup with GHC 8.4.3 and Cabal v2.2: https://github.com/moll/examples-haskell-csource/
```
Linking dist/build/csource/csource ...
/usr/bin/ld.gold: error: cannot find -lHScsource-0.1.337-7OQ5RPKzFZVCSEfeTtlOSq
dist/build/csource/csource-tmp/Main.o:Main_main2_info: error: undefined reference to 'foo'
collect2: error: ld returned 1 exit status
`gcc' failed in phase `Linker'. (Exit code: 1)
```
Rename the `Csource.c` file to `csource.c` and it links and runs fine.
Cheers
Contributor guide
Assessment
This issue has not been assessed yet.