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
Fix some GHC dependencies on iOS #40393
Fix some GHC dependencies on iOS #40393
Conversation
@ryantrinkle I left out 47f2e72. @angerman seemed to think it should have worked as it was before. Could you clarify the purpose of that commit? |
I also left out 1bb6287. I think it's better to just require people to use |
@@ -402,6 +406,21 @@ stdenv.mkDerivation ({ | |||
export NIX_${ghcCommandCaps}PKG="${ghcEnv}/bin/${ghcCommand}-pkg" | |||
# TODO: is this still valid? | |||
export NIX_${ghcCommandCaps}_DOCDIR="${ghcEnv}/share/doc/ghc/html" | |||
export LD_LIBRARY_PATH="''${LD_LIBRARY_PATH:+''${LD_LIBRARY_PATH}:}${ |
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.
Setting LD_LIBRARY_PATH
in the generic builder is not a good idea. It's important that all relevant search paths are registered with Cabal because otherwise the generated library config file does not contain them and then libraries will fail to link when they're used by other components, etc.
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.
What is the right way to register this with Cabal?
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.
In cc-wrapper. I'll do this once I get home. It will be mass rebuild however.
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.
Err sorry that would be for the cflags link part. Maybe Cabal has an --extra-framework-dirs
?
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.
Ah but this is the shell env. @peti the env
is really screwed up, you know, because the system-haskell division of deps does not take into account propagated dependencies. We drop propagated systems deps (including frameworks) on the floor since ghcWithPackages
doesn't reexport them. I like the idea of ghcWithPackages
, but it is very incompatible with the bash-heavy cc-wrapper way of doing things. More thought is needed.
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.
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.
@ElvishJerricco let's try to land #39735 by @kirelagin for this reflex-platform release too.
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.
@Ericson2314 So you're going to tackle these env
issues in a separate PR? Should I remove the env
changes from this PR entirely?
# On macOS, statically linking against system frameworks is not supported; | ||
# see https://developer.apple.com/library/content/qa/qa1118/_index.html | ||
# They must be propagated to the environment of any executable linking with the library | ||
, libraryDarwinFrameworkDepends ? [], executableDarwinFrameworkDepends ? [] |
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.
Cabal refers to these dependencies simply as frameworks
in its BuildInfo
type, therefore I think we should adopt that nomenclature and simply call them framework
here, too, rather than darwinFramework
.
optionals (allPkgconfigDepends != []) allPkgconfigDepends ++ | ||
propagatedBuildInputs = buildDepends ++ libraryHaskellDepends ++ executableHaskellDepends ++ libraryDarwinFrameworkDepends; | ||
otherBuildInputs = setupHaskellDepends ++ extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++ executableDarwinFrameworkDepends ++ | ||
optionals (allPkgconfigDepends != []) ([pkgconfig] ++ allPkgconfigDepends) ++ | ||
optionals doCheck (testDepends ++ testHaskellDepends ++ testSystemDepends ++ testToolDepends) ++ |
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.
We require a testFrameworkDepends
argument, too.
optionals (allPkgconfigDepends != []) allPkgconfigDepends ++ | ||
propagatedBuildInputs = buildDepends ++ libraryHaskellDepends ++ executableHaskellDepends ++ libraryDarwinFrameworkDepends; | ||
otherBuildInputs = setupHaskellDepends ++ extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++ executableDarwinFrameworkDepends ++ | ||
optionals (allPkgconfigDepends != []) ([pkgconfig] ++ allPkgconfigDepends) ++ | ||
optionals doCheck (testDepends ++ testHaskellDepends ++ testSystemDepends ++ testToolDepends) ++ | ||
optionals doBenchmark (benchmarkDepends ++ benchmarkHaskellDepends ++ benchmarkSystemDepends ++ benchmarkToolDepends); |
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.
Ditto with benckmarkFrameworkDepends
.
7bbacff
to
0466a57
Compare
optionals (allPkgconfigDepends != []) allPkgconfigDepends ++ | ||
propagatedBuildInputs = buildDepends ++ libraryHaskellDepends ++ executableHaskellDepends ++ libraryDarwinFrameworkDepends; | ||
otherBuildInputs = setupHaskellDepends ++ extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++ executableDarwinFrameworkDepends ++ | ||
optionals (allPkgconfigDepends != []) ([pkgconfig] ++ allPkgconfigDepends) ++ |
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.
Pkg-config is up above as a native build input.
@@ -402,6 +406,21 @@ stdenv.mkDerivation ({ | |||
export NIX_${ghcCommandCaps}PKG="${ghcEnv}/bin/${ghcCommand}-pkg" | |||
# TODO: is this still valid? | |||
export NIX_${ghcCommandCaps}_DOCDIR="${ghcEnv}/share/doc/ghc/html" | |||
export LD_LIBRARY_PATH="''${LD_LIBRARY_PATH:+''${LD_LIBRARY_PATH}:}${ |
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.
In cc-wrapper. I'll do this once I get home. It will be mass rebuild however.
@@ -402,6 +406,21 @@ stdenv.mkDerivation ({ | |||
export NIX_${ghcCommandCaps}PKG="${ghcEnv}/bin/${ghcCommand}-pkg" | |||
# TODO: is this still valid? | |||
export NIX_${ghcCommandCaps}_DOCDIR="${ghcEnv}/share/doc/ghc/html" | |||
export LD_LIBRARY_PATH="''${LD_LIBRARY_PATH:+''${LD_LIBRARY_PATH}:}${ |
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.
Err sorry that would be for the cflags link part. Maybe Cabal has an --extra-framework-dirs
?
@@ -1,14 +1,18 @@ | |||
{ stdenv, appleDerivation }: | |||
|
|||
appleDerivation { | |||
preConfigure = "cd libiconv"; | |||
preConfigure = "cd libiconv" #TODO: This `cd` should be in postUnpack, not preConfigure; otherwise, autoreconfHook breaks |
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.
This TODO is done on staging.
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.
@Ericson2314 So I should remove this preConfigure
entirely?
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.
Sadly not, because I can't figure out how to get autoreconf hook to work.
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.
So then what do you want me to do with this?
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.
Keep the below part but get rid of the comment so that specific line is unchanged.
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.
@Ericson2314 I should switch this from stdenv.hostPlatform != stdenv.buildPlatform
to something like hostPlatform.isDarwin
or something, right?
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.
You could do hostPlatofrm.isiOS
. This is already a Darwin-specific version of libiconv.
@Ericson2314 Also, should this PR be pointing at |
@ElvishJerricco by the rebuild count I guess staging? We can still base them off a master commit so we can use them without pulling in as much of a rebuild I suppose. |
@Ericson2314 what about the |
@Ericson2314 ping |
optionals doBenchmark (benchmarkDepends ++ benchmarkHaskellDepends ++ benchmarkSystemDepends ++ benchmarkToolDepends); | ||
propagatedBuildInputs = buildDepends ++ libraryHaskellDepends ++ executableHaskellDepends ++ libraryFrameworkDepends; | ||
otherBuildInputs = setupHaskellDepends ++ extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++ executableFrameworkDepends ++ | ||
optionals (allPkgconfigDepends != []) ([pkgconfig] ++ allPkgconfigDepends) ++ |
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.
Why do you add [pkgconfig]
here? It's already part of nativeBuildInputs
.
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.
Agreed. I had a comment on that too but GitHub evidently ate it.
@ElvishJerricco lets just land the framework changes (maybe on 18.03, too) and then return to the rest of this. |
febf5aa
to
5120c8c
Compare
@Ericson2314 I've removed all the changes to generic-builder and the comment in libiconv, and I've switched the condition in libiconv to |
@ElvishJerricco see 62fd669 on staging, it should be Overall, I wanted to start with the framework depends (outside |
@@ -59,6 +59,7 @@ nodePackages // { | |||
|
|||
ios-deploy = nodePackages.ios-deploy.override (oldAttrs: { | |||
preRebuild = '' | |||
LD=$CC |
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.
there is another default-v*.nix
that probably needs this too.
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.
Done
@Ericson2314 Yes, the With the generic-builder stuff gone, this PR is pretty small. I don't really see anything particularly gross. |
5120c8c
to
ccdc91b
Compare
Needs to link with a C compiler, not linker directly
ccdc91b
to
4f25cf5
Compare
OK will merge. I don't like not being able to run |
Motivation for this change
This fixes a few iOS related packages, particularly with the goal of fixing GHC dependencies. GHC itself does not quite build yet, but its dependencies do.
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)/cc @ryantrinkle @Ericson2314