Skip to content
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

Only pass -no-pie for binary targets #1424

Merged
merged 2 commits into from
Sep 17, 2020
Merged

Only pass -no-pie for binary targets #1424

merged 2 commits into from
Sep 17, 2020

Conversation

mboes
Copy link
Member

@mboes mboes commented Sep 16, 2020

When using GHC 8.10, passing -no-pie to the linker when building
libraries leads to obscure linker errors. Since PIE pertains to
executables, it doesn't make much sense passing that flag when
building libraries anyways. Removing it, both for haskell_library
and haskell_cabal_library fixes GHC 8.10 support. We make sure to
keep the flag for executables. This would otherwise negate the effect
of #1388.

Fixes #1418

When using GHC 8.10, passing `-no-pie` to the linker when building
libraries leads to obscure linker errors. Since PIE pertains to
executables, it doesn't make much sense passing that flag when
building libraries anyways. Removing it, both for `haskell_library`
and `haskell_cabal_library` fixes GHC 8.10 support. We make sure to
keep the flag for executables. This would otherwise negate the effect
of #1388.
@mboes mboes requested review from cocreature and guibou September 16, 2020 08:38
@mboes
Copy link
Member Author

mboes commented Sep 16, 2020

This PR does not change the compiler version used during testing. We still test with GHC 8.8.3 only, whereas the bug the PR is fixing only appears on GHC 8.10.*. @patrickt you may also want to confirm that this fixes the linker errors you saw when then moving Semantic to GHC 8.10.

patrickt added a commit to github/semantic that referenced this pull request Sep 16, 2020
As per tweag/rules_haskell#1424, the linker
errors associated with Actions CI should be fixed now.
Copy link
Contributor

@guibou guibou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for the change. I'm surprised because I'm using GHC 8.10 with rules_haskell since it was released and I never had this issue on Linux.

So there may be an additional requirement (not just GHC 8.10) which triggers this issue.

@patrickt
Copy link

Doesn’t seem to work on our end just yet: ld is dying with

/usr/bin/ld: -r and -pie may not be used together

Full backscroll here: https://github.com/github/semantic/pull/627/checks?check_run_id=1123152233

@mboes
Copy link
Member Author

mboes commented Sep 16, 2020

@patrickt I see that error with GHC 8.8 but not 8.10. Are you sure you are using 8.10? For 8.8, I'll push a workaround to the workaround. The logic is getting really complex, all to paper over a lack of proper solution to https://gitlab.haskell.org/ghc/ghc/-/issues/15319. I think we should tackle that next.

@patrickt
Copy link

It seems to be working now!! You’re the best, @mboes! And indeed, linker errors are my least favorite part of programming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

haskell_cabal_library linker errors when using GHC 8.10
3 participants