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

haskell generic-builder: Limit usage of --extra-framework-dirs on Darwin for compat #41084

Merged
merged 1 commit into from May 25, 2018

Conversation

Ericson2314
Copy link
Member

Motivation for this change

I have no idea why this appears to be a Darwin only thing. It would be nice to investigate that.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@Ericson2314 Ericson2314 requested a review from peti as a code owner May 25, 2018 18:25
@Ericson2314 Ericson2314 changed the title haskell generic-builder: Limit usage of --extra-framework-dirs for compat haskell generic-builder: Limit usage of --extra-framework-dirs on Darwin for compat May 25, 2018
@GrahamcOfBorg GrahamcOfBorg added 6.topic: darwin Running or building packages on Darwin 10.rebuild-linux: 0 and removed 10.rebuild-linux: 501+ labels May 25, 2018
@Ericson2314 Ericson2314 merged commit 97e376b into NixOS:master May 25, 2018
@Ericson2314 Ericson2314 deleted the fix-darwin-haskell branch May 25, 2018 19:28
@Ericson2314
Copy link
Member Author

Best to just unbreak Darwin now. We can improve the condition later.

@LnL7
Copy link
Member

LnL7 commented May 25, 2018

Yeah.

@kirelagin
Copy link
Member

Wait what 😮. This condition makes completely no sense to me, can you, please, elaborate? 😕

This appears to be a macOS-only thing, so why is it !buildPlatform.isDarwin? Why does the version of ghc matter? I guess, my question can be summed up as “Why not simply buildPlatform.isDarwin?”

@kirelagin
Copy link
Member

kirelagin commented Jun 19, 2018

I guess I just don’t understand what was the original issue.
Current condition triggers on Linux always (??? I suppose this option does nothing there and even $p/Library probably never exists on Linux) and on Darwin with recent versions of GHC. So if the issue was about older versions of GHC (actually, Cabal, I suppose, as this is a Cabal flag?), then shouldn’t the condition be buildPlatform.isDarwin && versionAtLeast nativeGhc.version "8.0"?
@Ericson2314

@LnL7
Copy link
Member

LnL7 commented Jun 19, 2018

@kirelagin This is specifically for cross compiling, the flags where added for linux->darwin and this fixes native darwin.

@kirelagin
Copy link
Member

kirelagin commented Jun 19, 2018

Why not hostPlatform.isDarwin && versionAtLeast nativeGhc.version "8.0" then?

@LnL7
Copy link
Member

LnL7 commented Jun 19, 2018

Do you mean !hostPlatform.isDarwin or targetPlatform.isDarwin?

@kirelagin
Copy link
Member

the flags where added for linux->darwin and this fixes native darwin

Again, the problem probably is that I do not understand the original issue. How stopping to include frameworks in certain cases can help with a cross-compilation to Darwin, when Darwin is exactly where these frameworks are needed?

I see how this could fix Darwin -> Linux compilation if buildHost libraries were included and the linker tried then to link a Linux binary to Darwin frameworks.
I now see that those frameworks are needed for host only, so, then, I think the condition should be hostPlatform.isDarwin, because we want to link with macOS frameworks when we are building a binary for it, regardless of the build platform (and of the target platform, I think).

@Ericson2314
Copy link
Member Author

@kirelagin Yes the condition is weird AF. I was gonna make it unconditional with the understanding that it would have no effect on Linux anyways. But then it failed with the Canal that came with GHC 8 on Darwin for unknown reasons. I think that was Cabal 1.24 and I tried the flag on Linux and it was recognized! So I have no idea what's going on.

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.

None yet

4 participants