-
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
Always pass ghc-options
#8717
Always pass ghc-options
#8717
Conversation
433d05b
to
2188ace
Compare
@9999years would you like my help with fixing the conflicts of the PR? |
9f309b7
to
11257c5
Compare
Rebased against latest |
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.
Essentially, this makes sure that wherever we have shared options, we also pass in the ghc-options. I think the implementation makes sense. Ideally, we'd have some kind of test for this... But I wouldn't know how.
LGTM!
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.
LGTM
Cabal/src/Distribution/Simple/GHC.hs
Outdated
@@ -717,7 +717,7 @@ buildOrReplLib mReplFlags verbosity numJobs pkg_descr lbi lib clbi = do | |||
, ghcOptFPic = toFlag True | |||
, ghcOptHiSuffix = toFlag "dyn_hi" | |||
, ghcOptObjSuffix = toFlag "dyn_o" | |||
, ghcOptExtra = hcSharedOptions GHC libBi | |||
, ghcOptExtra = hcOptions GHC libBi ++ hcSharedOptions GHC libBi |
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.
For consistency shouldn't you do the same thing for ghcOptExtra
of profOpts
a few line above?
@9999years thanks for fixing this. Is there anything blocking this PR from getting merged? I'm keen on using the solution outlined in https://gitlab.haskell.org/ghc/ghc/-/merge_requests/9908#note_481299 |
There are some merge conflicts to solve still |
@Kleidukos Are you going to actually merge or review it? I've fixed conflicts multiple times with this PR over the last year and it still hasn't moved. |
@9999years Yes, I thought your reviewers would have merged it. I will take personal care of this PR. Thank you again for your patience. 🙇 |
@9999years would you mind giving a thought to #8717 (comment) ? |
Is there a reason that this hasn't been merged? This PR got two approvals and then it seemed like people wanted it merged and then nothing happened. Could we get this merged and address any follow-up concerns in a future PR? |
There are still merge conflicts (see just after the incomplete CI record) that prevent it from being merged. I think we're still waiting on @Kleidukos but I can take a look at them later today if necessary. |
The [documentation for `ghc-shared-options`][1] states that they are combined with `ghc-options`: > Additional options for GHC when the package is built as shared > library. The options specified via this field are combined with the > ones specified via `ghc-options`, and are passed to GHC during both > the compile and link phases. However, _only_ `ghc-shared-options` and not `ghc-options` are passed in many cases. This is an issue because it requires setting `ghc-shared-options` even if the shared (dynamic) parts of the build don't actually need different options; this has the unpleasant side-effect of causing modules to be compiled twice, effectively doubling compile time! See here, where any non-empty `ghc-shared-options` causes Cabal to not set `-dynamic-too`: https://github.com/haskell/cabal/blob/acbc0f3a5cc9faf0913ff3e270196693816cec41/Cabal/src/Distribution/Simple/GHC.hs#L1466-L1469 This issue was discovered while integrating the `mold` linker with a Haskell project. [1]: https://cabal.readthedocs.io/en/latest/cabal-package.html#pkg-field-ghc-shared-options
11257c5
to
ce56702
Compare
ce56702
to
b0c5c5b
Compare
@9999years Is there a procedure I can follow to ensure that the patch does what it says? |
4ecf237
to
9c702ad
Compare
@mergify backport 3.12 |
✅ Backports have been created
|
* Always pass `ghc-options` The [documentation for `ghc-shared-options`][1] states that they are combined with `ghc-options`: > Additional options for GHC when the package is built as shared > library. The options specified via this field are combined with the > ones specified via `ghc-options`, and are passed to GHC during both > the compile and link phases. However, _only_ `ghc-shared-options` and not `ghc-options` are passed in many cases. This is an issue because it requires setting `ghc-shared-options` even if the shared (dynamic) parts of the build don't actually need different options; this has the unpleasant side-effect of causing modules to be compiled twice, effectively doubling compile time! See here, where any non-empty `ghc-shared-options` causes Cabal to not set `-dynamic-too`: https://github.com/haskell/cabal/blob/acbc0f3a5cc9faf0913ff3e270196693816cec41/Cabal/src/Distribution/Simple/GHC.hs#L1466-L1469 This issue was discovered while integrating the `mold` linker with a Haskell project. [1]: https://cabal.readthedocs.io/en/latest/cabal-package.html#pkg-field-ghc-shared-options * Add documentation * Also enhance profArgs and profDynArgs --------- Co-authored-by: Hécate Moonlight <[email protected]> Co-authored-by: Hécate <[email protected]> (cherry picked from commit 9c775f2) # Conflicts: # Cabal/src/Distribution/Simple/GHC.hs # doc/cabal-package-description-file.rst
* Always pass `ghc-options` The [documentation for `ghc-shared-options`][1] states that they are combined with `ghc-options`: > Additional options for GHC when the package is built as shared > library. The options specified via this field are combined with the > ones specified via `ghc-options`, and are passed to GHC during both > the compile and link phases. However, _only_ `ghc-shared-options` and not `ghc-options` are passed in many cases. This is an issue because it requires setting `ghc-shared-options` even if the shared (dynamic) parts of the build don't actually need different options; this has the unpleasant side-effect of causing modules to be compiled twice, effectively doubling compile time! See here, where any non-empty `ghc-shared-options` causes Cabal to not set `-dynamic-too`: https://github.com/haskell/cabal/blob/acbc0f3a5cc9faf0913ff3e270196693816cec41/Cabal/src/Distribution/Simple/GHC.hs#L1466-L1469 This issue was discovered while integrating the `mold` linker with a Haskell project. [1]: https://cabal.readthedocs.io/en/latest/cabal-package.html#pkg-field-ghc-shared-options * Add documentation * Also enhance profArgs and profDynArgs --------- Co-authored-by: Hécate Moonlight <[email protected]> Co-authored-by: Hécate <[email protected]> (cherry picked from commit 9c775f2)
* Always pass `ghc-options` The [documentation for `ghc-shared-options`][1] states that they are combined with `ghc-options`: > Additional options for GHC when the package is built as shared > library. The options specified via this field are combined with the > ones specified via `ghc-options`, and are passed to GHC during both > the compile and link phases. However, _only_ `ghc-shared-options` and not `ghc-options` are passed in many cases. This is an issue because it requires setting `ghc-shared-options` even if the shared (dynamic) parts of the build don't actually need different options; this has the unpleasant side-effect of causing modules to be compiled twice, effectively doubling compile time! See here, where any non-empty `ghc-shared-options` causes Cabal to not set `-dynamic-too`: https://github.com/haskell/cabal/blob/acbc0f3a5cc9faf0913ff3e270196693816cec41/Cabal/src/Distribution/Simple/GHC.hs#L1466-L1469 This issue was discovered while integrating the `mold` linker with a Haskell project. [1]: https://cabal.readthedocs.io/en/latest/cabal-package.html#pkg-field-ghc-shared-options * Add documentation * Also enhance profArgs and profDynArgs --------- Co-authored-by: Hécate Moonlight <[email protected]> Co-authored-by: Hécate <[email protected]> (cherry picked from commit 9c775f2)
* Always pass `ghc-options` The [documentation for `ghc-shared-options`][1] states that they are combined with `ghc-options`: > Additional options for GHC when the package is built as shared > library. The options specified via this field are combined with the > ones specified via `ghc-options`, and are passed to GHC during both > the compile and link phases. However, _only_ `ghc-shared-options` and not `ghc-options` are passed in many cases. This is an issue because it requires setting `ghc-shared-options` even if the shared (dynamic) parts of the build don't actually need different options; this has the unpleasant side-effect of causing modules to be compiled twice, effectively doubling compile time! See here, where any non-empty `ghc-shared-options` causes Cabal to not set `-dynamic-too`: https://github.com/haskell/cabal/blob/acbc0f3a5cc9faf0913ff3e270196693816cec41/Cabal/src/Distribution/Simple/GHC.hs#L1466-L1469 This issue was discovered while integrating the `mold` linker with a Haskell project. [1]: https://cabal.readthedocs.io/en/latest/cabal-package.html#pkg-field-ghc-shared-options * Add documentation * Also enhance profArgs and profDynArgs --------- Co-authored-by: Hécate Moonlight <[email protected]> Co-authored-by: Hécate <[email protected]> (cherry picked from commit 9c775f2)
* Always pass `ghc-options` The [documentation for `ghc-shared-options`][1] states that they are combined with `ghc-options`: > Additional options for GHC when the package is built as shared > library. The options specified via this field are combined with the > ones specified via `ghc-options`, and are passed to GHC during both > the compile and link phases. However, _only_ `ghc-shared-options` and not `ghc-options` are passed in many cases. This is an issue because it requires setting `ghc-shared-options` even if the shared (dynamic) parts of the build don't actually need different options; this has the unpleasant side-effect of causing modules to be compiled twice, effectively doubling compile time! See here, where any non-empty `ghc-shared-options` causes Cabal to not set `-dynamic-too`: https://github.com/haskell/cabal/blob/acbc0f3a5cc9faf0913ff3e270196693816cec41/Cabal/src/Distribution/Simple/GHC.hs#L1466-L1469 This issue was discovered while integrating the `mold` linker with a Haskell project. [1]: https://cabal.readthedocs.io/en/latest/cabal-package.html#pkg-field-ghc-shared-options * Add documentation * Also enhance profArgs and profDynArgs --------- Co-authored-by: Hécate Moonlight <[email protected]> Co-authored-by: Hécate <[email protected]> (cherry picked from commit 9c775f2)
Always pass `ghc-options` (backport #8717)
The documentation for
ghc-shared-options
states that they arecombined with
ghc-options
:However, only
ghc-shared-options
and notghc-options
are passed in many cases.This is an issue because it requires setting
ghc-shared-options
even if the shared (dynamic) parts of the build don't actually need different options; this has the unpleasant side-effect of causing modules to be compiled twice, effectively doubling compile time! See here, where any non-emptyghc-shared-options
causes Cabal to not set-dynamic-too
:cabal/Cabal/src/Distribution/Simple/GHC.hs
Lines 1466 to 1469 in acbc0f3
This issue was discovered while integrating the
mold
linker with a Haskell project; whenghc-shared-options
wasn't set to the same value asghc-options
, thegold
linker would be used instead ofmold
for various links during the build.Please include the following checklist in your PR:
Please also shortly describe how you tested your change. Bonus points for added tests!
I've tested this by using Cabal with this patch applied to build a large commercial Haskell project (the mercury.com backend) and saw that the
ghc-options
were correctly applied (in this case, that meant observing that no links were performed withgold
and all links were correctly performed withmold
, as the options requested, with the exception of the single link described in #4439).Possibly related issues: