You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For projects with C source files and headers, the check whether it needs to recompile is naive and only looks at whether the source file has changed.
So if you have two files foo.h and foo.c, touching foo.h should cause foo.c to be recompiled.
The same problem exists for .hsc files: #24 and #3087.
One idea for implementing this is to change the checkNeedsRecompilation function (https://github.com/haskell/cabal/blob/master/Cabal/Distribution/Simple/GHC.hs#L1327) to call out to gcc -M, which generates a makefile rule listing the dependencies for that particular file.
We'd need to call gcc -M with the C flags (the include dirs), parse the makefile rule, then go through all those files and see if any are newer than the object.
Does that sound too slow to do every time? Is there an easy way to cache this?
The text was updated successfully, but these errors were encountered:
Although this seems similar to the problem for hsc files, I actually think these are not related; checkNeedsRecompilation is only called for building C sources (I don't see any call sites), so #3087 must a different bug somewhere else.
#4174 would probably help us implement more accurate recomp avoidance. Barring that, it is probably true that the only way we can figure out whether or not we need to recompile is by getting the makefile rule and testing to see if things are newer.
Admittedly, it would be less horrible for Cabal to have a bad recompilation checker if there were an easy way to force recompilation. So that might be a short term fix which would be easier to develop a patch for.
As for gcc -M, honestly, I don't think it would take that long, esp. since I don't think people are shoving extremely large piles of C files into the Cabal build system. So, I would take a patch that taught build how to handle this.
For projects with C source files and headers, the check whether it needs to recompile is naive and only looks at whether the source file has changed.
So if you have two files
foo.h
andfoo.c
, touchingfoo.h
should causefoo.c
to be recompiled.The same problem exists for
.hsc
files: #24 and #3087.One idea for implementing this is to change the
checkNeedsRecompilation
function (https://github.com/haskell/cabal/blob/master/Cabal/Distribution/Simple/GHC.hs#L1327) to call out togcc -M
, which generates a makefile rule listing the dependencies for that particular file.We'd need to call
gcc -M
with the C flags (the include dirs), parse the makefile rule, then go through all those files and see if any are newer than the object.Does that sound too slow to do every time? Is there an easy way to cache this?
The text was updated successfully, but these errors were encountered: