commercialhaskell / commercialhaskell/stack
Library build process acknowledges incremental changes to c-sources but does not re-compile C/++ files
- Dominant language
- Haskell
- Stars
- 4.1k
- Forks
- 850
- Avg merge
- 10h 37m
- Merged PRs (30d)
- 4
Description
In a mixed Haskell/C++ project, the library to be built lists several C++ files as c-sources. When an incremental change to a C++ file is made and "stack build" is run, the change to the file is acknowledged. However, when the library is built, the "stale" version of the C++ code remains in the resulting library. Performing "stack clean" prior to build resolves the issue, triggering a recompile of the C++ file and linking in the new result into the library.
To reproduce:
1. Include a C or C++ file as a dependency to the library to be built using the c-sources attribute in package.yaml.
2. Perform a clean build.
3. Delete the C/++ file.
4. Run "stack build"
5. Observe that the change is acknowledged (lib-ver: unregistering (local file changes: /path/to/file.c))
6. Observe that the build succeeds despite a necessary file being deleted, indicating an old version of the compiled file is being used rather than a freshly-compiled version.
Relevant example .yaml config:
library:
source-dirs:
- src/hs
c-sources:
- src/cpp/*.cpp
include-dirs:
- src/cpp/include
Expected behavior is that if a c-source file is changed, it is recompiled on the next build. It seems as though the library build is dependent on the object file produced by compilation, rather than the source file itself, so recompilation is not triggered by changes to the source.
Stack version info:
Version 1.6.5, Git revision 24ab0d6ff07f28276e082c3ce74dfdeb1a2ca9e9 (5514 commits) x86_64 hpack-0.20.0
Installed via Arch Linux AUR repository "stack-bin"; updated using "stack upgrade" to version 1.6.5 from 1.6.3 to verify bug still present in latest version.
Contributor guide
Assessment
This issue has not been assessed yet.