Pass *-options to GHC when compiling ordinary Haskell sources#10969
Conversation
1bd501e to
c3e68be
Compare
|
I probably need to think about tests, maybe something started working besides |
|
Ok, got it, we just need to separate the flags |
a439429 to
1b8e5bb
Compare
|
@ulysses4ever @phadej It's not very easy to add flags to sources files due to backward compatibility, so for now I suggest considering the pull request as is ¯\_(ツ)_/¯ (Anyway, this solved the problem with macros in header files) |
ulysses4ever
left a comment
There was a problem hiding this comment.
Great start, thank you! Below are some inline questions.
One general question: did you check that this doesn't lead to duplicated options when cabal calls GHC? I assume other *-options are passed today sometimes. So, sometimes we'll get those options passed as today and through your change too. Is that right? It seems undesirable.
It's not very easy to add flags to sources files due to backward compatibility
Can you be more specific? Do you mean it's hard to test on older GHCs? This shouldn't be a problem because the tests can run for specific versions of GHC (e.g. starting from 8.10).
geekosaur
left a comment
There was a problem hiding this comment.
Same concerns as @ulysses4ever raised.
Yes, it looks like so. I'd say the problem is rather that IMHO, it's wrong that there are separate EDIT: There might be situations where EDIT: So AFAICT, this is not the correct fix, not what I'd imagine seeing. |
0b74992 to
37417aa
Compare
|
Sadly, @mpickering may not be able to contribute to this PR any more. @zlonast: how can we help to get it through? |
|
@Mikolaj Hi! As the author, I think it works and we can be merge it 😄 But perhaps you want to pay attention to this:
|
a8f1b13 to
6b7957c
Compare
|
@zlonast thank you for your work here and for the summary in partiular. Quetsions:
This looks rather serious. Can you elaborate with example scenarios? E.g. will I not be able to build any package with c-sources after this change if I need to use 9.4? FTR, we are supposed to maintain ccompatibility with any GHC released last 5 years. GHC 9.4.8 was released 10 November 2023, so there's still 2.5 years of it staying in this support window.
Do you think you could add some? |
6b7957c to
e522b12
Compare
|
This must happen before this pull request is merged.
issue #11712 pr fix #11713
tests #11711 |
e522b12 to
afa91a2
Compare
|
|
afa91a2 to
858d618
Compare
858d618 to
7de85b7
Compare
|
I found the problem and left a link in this #10969 (comment). I've only left two things in that pr.
I suggest checking the compilation of the entire |
|
Deprecation notice: This pull request comes from a fork and was rebased using |
✅ Branch has been successfully rebased |
Refactor componentGhcOptions for pass *-options to all invoking GHC. During the refactoring process we needed to add componentGhcOptions to all Haskell sources. It was also worth add linkGhcOptions to linkLibrary same as componentGhcOptions to linkExecutable, linkFLib. Add test for PackageTests/FFI/ForeignOptsCapi to pass cc-options flags to *.h. Fixes haskell#9801 haskell#4435 Co-authored-by: Mikolaj Konarski <mikolaj.konarski@gmail.com>
Co-authored-by: Yuriy Syrovetskiy <git-orbi@cblp.su>
|
To summarize the current state of this PR:
Regarding the tests, the two added test cases directly address what was requested in the linked issues (#9801, #4435):
@Mikolaj @ulysses4ever I believe this is now ready. |
Before GHC 8.10, Cabal passed both `cc-options` and `cxx-options` via a single GHC flag, `-optc`. When GHC 8.10 introduced `-optcxx`, Cabal picked up this change: `cc-options` and `cxx-options` are now mapped to `-optc` and `-optcxx`, respectively. However, Cabal also changed its behavior for older GHC versions (8.8 and below): it now sends `cc-options` and `cxx-options` through separate instances of `-optc`. Co-authored-by: Artem Pelenitsyn <a.pelenitsyn@gmail.com>
|
This looks great! Are the conversations resolved but not marked, or not yet resolved? |
|
@ulysses4ever For now, I'll put the |
Merge Queue Status
This pull request spent 5 hours 7 minutes 18 seconds in the queue, including 3 hours 5 minutes 2 seconds running CI. Required conditions to merge
|
Will close issues #9801 #4435
Main idea #9801 (comment)
cc-options,cxx-options,jspp-options,asm-options,cmm-options,ld-options,cpp-options,should be always passed when invoking GHC, similarly as
ghc-optionsshould be always used wheninvoking
ghc- regardless of what is the intention of a particular GHC-call.GHC might use or not use the options, Cabal cannot know and should not guess.
cc-optionsandcxx-optionsstill need to be separated (C/C++) for versions below 8.10.https://gitlab.haskell.org/ghc/ghc/-/issues/16477
Template Α: This PR modifies behaviour or interface
Include the following checklist in your PR:
significance: significantin the changelog file.Depends-on: #11711
Depends-on: #11713