-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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 android prebuilt ghc [Fixes #40194] #40210
Fix android prebuilt ghc [Fixes #40194] #40210
Conversation
Should this be in cc-wrapper?
Hm. There's a lingering issue with
But I think we can call this a separate issue. |
@@ -79,6 +81,8 @@ stdenv.mkDerivation rec { | |||
|
|||
outputs = [ "out" "doc" ]; | |||
|
|||
patches = [./8.4.2-hsc2hs-cross-build.patch]; |
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 Should this be unconditional like this? It's harmless on the normal build, but will require a rebuild of GHC 8.4.2.
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.
Yeah I agree. Simple is better.
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.
Great work @ElvishJerricco! Thanks so much!!
@@ -22,7 +22,7 @@ | |||
|
|||
, # Whether to build dynamic libs for the standard library (on the target | |||
# platform). Static libs are always built. | |||
enableShared ? true | |||
enableShared ? !targetPlatform.useAndroidPrebuilt |
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.
Can you apply the head.nix changes on more other GHCs for consistency?
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.
It's already applied to 8.4. No other GHC versions will be able to build for Android. It'd be better to have a "Not android" assertion in all the other GHCs. Want me to add 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.
Ah and there are fewer GHCs now too, +1.
@@ -79,6 +81,8 @@ stdenv.mkDerivation rec { | |||
|
|||
outputs = [ "out" "doc" ]; | |||
|
|||
patches = [./8.4.2-hsc2hs-cross-build.patch]; |
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.
Yeah I agree. Simple is better.
@@ -0,0 +1,41 @@ | |||
Submodule utils/hsc2hs 9483ad1006..738f3666c8: |
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 is a great patch! Can you open a phabricator review of it? Then we can fetchPatch
it.
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.
If it's already an 8.4 branch (or even master) commit we can pull the diff from cgit at haskell.org too. (You can give me hash and I'll do it if you like.)
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.
It's on master
but not 8.4
. It's an update to a submodule, which complicates things. I tried doing fetchPatch
on https://git.haskell.org/ghc.git/commitdiff_plain/...
, but the change to the submodule is just shown as -rev\n+rev
. Had to do git diff --submodule=diff
, and I don't know of any end point that would have such a diff.
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.
https://github.com/haskell/hsc2hs/commit/738f3666c878ee9e79c3d5e819ef8b3460288edf.diff there is a fetchPath
argument to prefix all paths in the patch so that it works.
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.
Fixed, thanks
7e698da
to
9dadb9e
Compare
Hey, just for reference, did you ever get "armv7a-android-prebuilt" to build after these changes? I am trying to figure out the cause of #42333 & not sure if it 8.4.* was ever working. |
@matthewbauer No, I think I only ever tested this with arm64 |
@@ -22,7 +22,7 @@ | |||
|
|||
, # Whether to build dynamic libs for the standard library (on the target | |||
# platform). Static libs are always built. | |||
enableShared ? true | |||
enableShared ? !targetPlatform.useAndroidPrebuilt |
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.
Did you ever get this to build a valid .apk? I think we need shared here for the Haskell activity stuff to link. Maybe it worked for you though?
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.
I believe the old stuff from reflex-platform
used this and successfully built APKs. I did not try it with this branch though.
Motivation for this change
In order to build GHC to cross compile to android, we need an extra c flag, and we need a patch from master to fix hsc2hs. There is also an issue with forbidden references in dynamic exes, so for now we just don't
enableShared
:Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)