-
Notifications
You must be signed in to change notification settings - Fork 704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cabal will build and install broken library if other-modules is not complete #2982
Comments
The reason we don't do this is that running |
Yeah, because it has to redo all of the work parsing headers and transitively chasing everything down. I'm pretty sure this will require GHC cooperation to properly fix. |
I checked and it turns out that all the information you need is in the top-level interface files. So GHC should get a command akin to |
Would be also nice to have a command to get a list of extensions enabled in each module so that we could check that against |
This information is not currently in interface files. Can you expand on when it's necessary? |
This information is used during building, so I'd like to do this check on each |
Oh I see, you mean the Template Haskell extension! I can't tell you if an arbitrary extension was enabled, but I CAN tell you if Template Haskell was enabled from an interface file. Let me bring up another comment: we need a command line interface for this. This is a bit annoying, because the possibilities are basically endless. What should GHC accept as a flag? |
This is nice, but ideally I'd like to do this check for all extensions, though for most of them we can be more lenient (just print a warning), while omitting TH from
If If you want to implement this by parsing interface files, I guess I could use a command for dumping the dependency graph and a command for dumping a list of "extensions affecting compilation" (currently only TH, I think). |
Well,
That's a bunch of commands. Would be nice to get some agreement on how to organize them, what their output should be, etc. |
My idea was that it could be changed to do that (in a backwards-compatible way, via
Hmm, actually, nothing requires us to output both pieces of info in the same file. So they of course could be separate.
For the dependency graph, the current
|
Though there are some cases when |
I filed a ticket on GHC for simultaneous I'm not really convinced by the API for getting out extensions. |
Care to elaborate? |
I dunno. (1) it seems annoying to parse and (2) it offends me aesthetically. Someone else should feel welcome to submit the GHC ticket requesting this though :) |
Alternative solutions, that don't require teaching Cabal how to chase dependencies, or to get that information from the compiler.
(GHC ticket caused by this bug not being fixed yet: https://ghc.haskell.org/trac/ghc/ticket/9009). |
thomie: It would, except for the bit where GHC does not actually know how to link static archives on not-Darwin systems. Which is a bit goofy and probably should be fixed! https://ghc.haskell.org/trac/ghc/ticket/11373#ticket The second suggestion would work, and would be fairly easy to do. |
I think we could solve this by
Cabal already knows how to map module names to source files for |
I can't think of any obvious problems! But it certainly has a few moving parts. |
This is a reopen of #121
Cabal computes the set of object files to link into an archive by using the
exposed-modules
/other-modules
fields. This means that if an imported module is omitted, it isn't put into the archive.That in and of itself isn't too bad (since the Cabal file is buggy), but THEN Cabal will happily proceed to install this broken archive, and then you'll get a mysterious linker error error when you try to use it. Disaster!
A number of resolutions were suggested in the previous ticket:
-v
output or runningghc -M
)Attached is a test case:
test.zip
The text was updated successfully, but these errors were encountered: