-
Notifications
You must be signed in to change notification settings - Fork 710
Pass -optcxx for GHC >= 8.10 #7072
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
Conversation
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.
We need tests.
Also "negative" tests, that cxx-options are not passed to C-files, and C-options to C++-files as mentioned in a comment in the issue. (For GHC >=8.10).
Yep, let me see what I can do about tests. In the meantime, I verified that this fixes the issue as reproduced here with GHC 8.8.4 and 8.10.2. |
@phadej would https://github.com/haskell/cabal/tree/master/cabal-testsuite/PackageTests be the right place to put test cases? I haven't found a suitable unit test suite for this, so I think the integration tests there are appropriate. If so, I will put in two examples lifted from the repro, both configured with
Is that comprehensive enough? EDIT: seems like I need to split the c++ test case in two, one for new ghc asserting that we get cxx-options, and one for old ghc asserting that we get cc-options (to preserve current behavior) |
@ejconlon yes, |
@phadej I put in two |
(Also, if you're planning on doing another RC for 3.4 I would love to get this change picked in!) |
Perfectly we would backport that to @bgamari should I prepare |
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.
Squash commits, that will help backporting.
Write in the commit message what you have written in the description. Also write
Fixes https://github.com/haskell/cabal/issues/6421
(I prefer explicit URL, not an abbreviated number, as it makes easy to click from git log
).
Fixes haskell#6421 To summarize, Cabal passes all C and C++ flags through GHC to the underlying C or C++ compiler using -optc. This works for GHC < 8.10, but now GHC expects C++ flags to come through -optcxx. This means that anything through -optc is ignored, so we cannot pass any flags to the C++ compiler. This change simply detects the GHC version and uses the correct arguments. This PR has been tested manually and two PackageTests have been added to cabal-testsuite. They pass under GHC 8.8.4 and GHC 8.10.2.
f98add2
to
2838079
Compare
(By the way, this is the second commit for which that Windows job flaked out with some handle error!) |
Yes, that would be great. Thank you! |
@ejconlon yes, windows jobs are flaky. Don't worry. |
Backported to 3.4 in #7074 |
Backported to 3.2 in #7134 |
Intends to resolve this issue. To summarize, cabal passes all C and C++ flags through GHC to the underlying C or C++ compiler using
-optc
. This works for GHC < 8.10, but now GHC expects C++ flags to come through-optcxx
. This means that anything through-optc
is ignored, so we cannot pass any flags to the C++ compiler. This change simply detects the GHC version and uses the correct arguments.changelog.d
directory).This PR has been tested manually on this repro and two
PackageTests
have been added tocabal-testsuite
. They pass under GHC 8.8.4 and GHC 8.10.2.