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

ghc: apply a patch to fix common gold linker problem #27584

Closed
wants to merge 1 commit into from

Conversation

domenkozar
Copy link
Member

@domenkozar domenkozar commented Jul 23, 2017

It would otherwise result into undefined referenecs for some functions
in the base when using the gold linker:

error: undefined reference to 'sqrt'

Fixes haskell/double-conversion#17

Previously ghc option -optl=-lm was used for packages depending on
such functions, but that could result into

fatal error: cannot mix -r with dynamic object /nix/store/7crrmih8c52r8fbnqb933dxrsp44md93-glibc-2.25/lib/libm.so.6

in some situations like profiling builds.

Patch was prepared by Michael Bishop and Niklas Hambüchen

NOTE: this hasn't been tested on macOS yet.

cc @peti

@mention-bot
Copy link

@domenkozar, thanks for your PR! By analyzing the history of the files in this pull request, we identified @dtzWill, @peti and @3noch to be potential reviewers.

@domenkozar domenkozar requested review from shlevy and peti July 23, 2017 15:22
@NeQuissimus
Copy link
Member

LGTM but I'm no expert here :)

@bgamari
Copy link
Contributor

bgamari commented Jul 23, 2017

Yes, this looks right to me as well.

@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
sha256 = "1c8qc4fhkycynk4g1f9hvk53dj6a1vvqi6bklqznns6hw59m8qhi";
};

patches = []
patches = [ ./ghc-gold-liner.patch ]
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be gold-linker or is this a clever pun?

It would otherwise result into undefined referenecs for some functions
in the base when using the gold linker:

   error: undefined reference to 'sqrt'

Fixes haskell/double-conversion#17

Previously ghc option -optl=-lm was used for packages depending on
such functions, but that could result into

   fatal error: cannot mix -r with dynamic object /nix/store/7crrmih8c52r8fbnqb933dxrsp44md93-glibc-2.25/lib/libm.so.6

in some situations like profiling builds.

Patch was prepared by Michael Bishop and Niklas Hambüchen
@bgamari
Copy link
Contributor

bgamari commented Jul 23, 2017

Tracked as GHC #14022. Patch uploaded as D3780.

Thanks for reporting this!

Copy link
Member

@peti peti left a comment

Choose a reason for hiding this comment

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

👍

@domenkozar
Copy link
Member Author

@peti should we merge this or are you going to incorporate into your fork?

@peti
Copy link
Member

peti commented Jul 24, 2017

I've added it to haskell-updates in 513df754e164bc67da7f0a88c5aca968b36ab78e. I think this change will make it to master within the next 24 hours.

@domenkozar
Copy link
Member Author

@peti could you also backport to 17.03? Thank you!

peti pushed a commit that referenced this pull request Jul 26, 2017
It would otherwise result into undefined referenecs for some functions
in the base when using the gold linker:

   error: undefined reference to 'sqrt'

Fixes haskell/double-conversion#17

Previously ghc option -optl=-lm was used for packages depending on
such functions, but that could result into

   fatal error: cannot mix -r with dynamic object /nix/store/7crrmih8c52r8fbnqb933dxrsp44md93-glibc-2.25/lib/libm.so.6

in some situations like profiling builds.

Patch was prepared by Michael Bishop and Niklas Hambüchen.

Closes #27584.

(cherry picked from commit aafe3d2)
@peti peti closed this in aafe3d2 Jul 26, 2017
@NeQuissimus
Copy link
Member

@peti I don't want to hit "Delete branch" for you, in case you need the branch still. If not, could you? :D

@domenkozar domenkozar deleted the ghc-gold-linking branch July 26, 2017 12:09
@bgamari
Copy link
Contributor

bgamari commented Jul 27, 2017

For the record, GHC upstream is taking a slightly different tack on this: https://phabricator.haskell.org/D3787.

adrianpk added a commit to adrianpk/nixpkgs that referenced this pull request May 31, 2024
It would otherwise result into undefined referenecs for some functions
in the base when using the gold linker:

   error: undefined reference to 'sqrt'

Fixes haskell/double-conversion#17

Previously ghc option -optl=-lm was used for packages depending on
such functions, but that could result into

   fatal error: cannot mix -r with dynamic object /nix/store/7crrmih8c52r8fbnqb933dxrsp44md93-glibc-2.25/lib/libm.so.6

in some situations like profiling builds.

Patch was prepared by Michael Bishop and Niklas Hambüchen.

Closes NixOS#27584.

(cherry picked from commit aafe3d2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants