-
Notifications
You must be signed in to change notification settings - Fork 697
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
Dedupe more includeDirs and extraLibDirs #5356
Dedupe more includeDirs and extraLibDirs #5356
Conversation
e23bab3
to
806001c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not happy with the use of ordNub
which changes the ordering of such order-sensitive CLI flags. Can we use a order-preserving nub
?
nevermind, I realised that our ordNub
does in fact retain the order (it retains the first occurence, like nub
would)
I first thought this dedupe is only necessary if the outside world passes in duplicated flags. But in fact this seems to fix the issue that before the patch, Cabal added a duplicated I think we should also investigate whether it's actually legitimate that cabal tries to combine the flags from these different sections into one ( |
What's up with that one Travis failure? Doesn't seem related to my PR.
I have now done that, works fine and I can build stuff again thanks to these Regarding
I've filed the separte issue #5360 instead as that isn't really related to this PR. So from my side this is ready to merge. |
Patch looks sensible to me. The 7.10 builders are known to be flaky. Does this solve the problem for good? It's a good, small patch and I think that it should be applied anyway, but the long-term solution would be response files if |
@quasicomputational No, it only reduces the problem (length of the command line arguments) by factor N, where N is the number of executables+test suites+libraries+benchmarks you have in your In practice for most projects now, it solves the problem, but if you make a project with truly many dependencies, it can still happen.
No, response files don't help, see my post here:
|
806001c
to
02ab5ca
Compare
Rebased to fix README conflict |
Someone should patch GCC to make it pass args to its subprocesses via response files. |
Another thing to consider is that I believe that this needs to be fixed separately in e.g. hsc2hs. I know that NixOS/nixpkgs#40013 is caused by the call out to hsc2hs, and this fix does nothing to fix that. |
I agree with @hvr that |
I failed to see the retraction on mobile. Anyhow, even if we retain the order, we remove duplicate items later, which might interfere with However, I'm willing to just risk it, and figure out a work around in case something does some stupid |
@angerman Ah, I see. It seems to me that this is not a big deal, because We may be able to remove the deduplication if as part of #5360 we change the Further, I'm not sure if it's worth supporting; as per the documentation you linked,
so it wouldn't work e.g. with If we want to support it, it might be easier to just add an extra flag to cabal that says "don't do any path deduplication"; this would then be used in the rarest of cases, and in the default case, cabal wouldn't fail due to large amount of duplicated arguments. I have just scanned all contents of Hackage (from my download at 2017-07-22), and there is no single use of So at this stage, I recommend we deduplicate, and if somebody comes and actually needs this GNU-only feature, we add a cabal flag for them that they can use on their package in order to not deduplicate. |
Let's do this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks OK. Do you think we can change the type of these fields to NubList
instead of using ordNub
?
I resolved the conflicts with github's resolution tool; what a bad idea, now I have a merge commit in my branch. One moment, will fix. |
e917e31
to
fdb350f
Compare
@23Skidoo possibly, but it would be nice if you could do it in a separate commit, as right now other code in that file also uses |
@nh2 said:
It's worth noting that this is only being done in |
… and `PD.extraLibDirs`. Should help with big invocations as found in NixOS/nixpkgs#41340.
fdb350f
to
fd6ff29
Compare
This was green before I rebased, so merging straight away. |
@nh2 Thanks! |
See NixOS/nixpkgs#41340.
Also see #3974 and #4105.
[ci skip]
is used to avoid triggering the build bots (it is not)Haven't tested it yet, will do that tomorrow.
TODO
[ ] investigate whether it's actually legitimate that cabal tries to combine the flags from these different sections into one (filed Check if cabal's cross-section combination of flags passed to GCC is legitimate #5360 insteadordNub
ed or not) -- maybe there might be flags across the different sections that are mutually exculsive