Comments (8)
I have a bad feeling about this.
What happens is:
- We run
clang -MM
to compute dependencies of filehp2ps/Utilities.c
- It includes
hp2ps/Main.h
- The latter includes generated file
includes/ghcconfig.h
- But the file has not yet been generated, so
clang -MM
doesn't know what to do: what ifincludes/ghcconfig.h
includes something else? We need to have it in order to determine accurate dependencies. So,clang -MM
gives up! I wonder ifgcc -MM
gives up as well (I haven't seen this failure yet).
Not sure what's the best way to proceed with this. I can add a manual dependency: need includes
files before running other rules, but this is fragile.
from hadrian.
@ndmitchell Have you got any idea on how to handle this nicely? I don't have anything except for needing generated files explicitly.
from hadrian.
I've added explicit dependencies. We may come back to this issue if a better approach is discovered.
from hadrian.
Hi, I've been lurkingfollowing along until I can get my computer replaced and actually contribute, but I think I have a solution for this.
Unfortunately, the non-lexical way CPP works makes things more complicated in that macros defined in headers included earlier influence the dependencies of headers included later.
I propse adding at the back of the INCLUDE
path a directory with empty files named for each generated file (hopefully we can figure out that list up front). Then, when clang outputs a dependency on one of those stubs, we know we need to rebuilt it. Because of the aforemtioned non-lexicallity, after building all generated header files, we repeated the process. After a finite number of rounds, all relevant header files will be discovered and built (we'll know because clang will no longer fall back on the stubs).
from hadrian.
@Ericson2314 Hi there! Adding a directory with fake files is a nice trick. I don't see how it helps though: we still need to explicitly list these files somewhere: we list them as dependencies in src/Rules/Dependencies.hs
and everything seems to work well. You propose to list them in a special directory, and furthermore also run clang -MM
a number of rounds, which would be hard to implement.
from hadrian.
One quite easy solution is to orderOnly depend on those files before running -MM. That ensures the files exists, but doesn't depend on them, and then -MM can spot them properly. The advantage of orderOnly is you can be much more free with it as it will reduce parallelism by a very tiny amount, but won't cause unnecessary rebuilds.
from hadrian.
@ndmitchell Thanks! I didn't think of order-only dependencies. Looking at the Shake documentation this is exactly the intended use case for orderOnly
.
(In an ideal world we would have a dependency discovery mechanism that would call orderOnly [file]
whenever it encounters an include file
statement while traversing given source files, so we wouldn't have to list such dependencies manually.)
from hadrian.
In an ideal world...
Well, in general CPP variables can be used in the #include
path, so that won't work.
However, intercepting file access, as proposed in that linked issue, is the best of all worlds. Dirt simple, no up-front lists, and builds only the headers that are needed.
from hadrian.
Related Issues (20)
- _build/stage0/bin/ghc.exe misses dependency HOT 14
- Rules for rts/rts.cabal are broken HOT 15
- Should Hadrian build ghctags and haddock in Stage1? HOT 3
- Documentation broken HOT 2
- Custom build root does not work on Windows HOT 2
- Symlink traversing logic in build scripts HOT 25
- GHC testsuite rules status HOT 25
- Reduce the number of times a Cabal file is parsed HOT 13
- Improve documentation of predicates
- Build more variants of profiled runtime systems (normal, threaded, debug, threaded debug, ...) ? HOT 8
- Consider using Azure for CI HOT 1
- testsuite: support figuring out the list of tests from $PWD HOT 1
- testsuite: add CLI flag for specifying extra options to pass to ghc HOT 1
- rts: buggy handling of non-trivial dynamic flavours of the library HOT 14
- ctrl + c doesn't cancel build on windows HOT 5
- Building on windows is broken. HOT 23
- --integer-simple is broken HOT 40
- Hadrian has been merged into GHC proper HOT 4
- `happy` is not properly auto built in a fresh install HOT 11
- Issue on Trac: 15908 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hadrian.