-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
Erlang: fix cross compilation #100835
base: master
Are you sure you want to change the base?
Erlang: fix cross compilation #100835
Conversation
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/state-of-the-beam-ecosystem-in-nix/4202/19 |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/cross-compiling-compile-bootstrap-on-target-instead-of-build/9576/1 |
@@ -43,16 +44,28 @@ let | |||
inherit (stdenv.lib) optional optionals optionalAttrs optionalString; | |||
wxPackages2 = if stdenv.isDarwin then [ wxmac ] else wxPackages; | |||
|
|||
isCross = stdenv.hostPlatform != stdenv.buildPlatform; | |||
hipeSupport = (enableHipe && !isCross); |
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.
hipeSupport = (enableHipe && !isCross); |
@@ -85,12 +98,13 @@ in stdenv.mkDerivation ({ | |||
++ optional enableThreads "--enable-threads" | |||
++ optional enableSmpSupport "--enable-smp-support" | |||
++ optional enableKernelPoll "--enable-kernel-poll" | |||
++ optional enableHipe "--enable-hipe" | |||
++ optional hipeSupport "--enable-hipe" |
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.
++ optional hipeSupport "--enable-hipe" | |
++ optional (enableHipe && !isCross) "--enable-hipe" |
But honestly I would prefer an asset and throw here because people will be confused why hipe is disabled when cross compiling.
I marked this as stale due to inactivity. → More info |
for anyone wondering, yes i am still interested in this, just more urgent problems cropped up in the meantime. Will get back to it hopefully soon TM |
I marked this as stale due to inactivity. → More info |
still interested, still no time. And tbh, i am not sure there is an easy solution here, because the bootstrapping is getting my head spinning. I do think i would appreciate some help from someone with a bit of experience. I may have to look at how other interpreters and/or runtime do it. If they do. |
I think an intermediate derivation specifically for cross-compilation is the way to go, possibly using just the bootstrapping OTP since there are specific commands for it in its build system. I know @DianaOlympos is strapped for time, but I think I see how it can be done. |
Please go work on it! I want it! But note that i tried the intermediary derivation and i never got it to work. It always pick the wrong system-arch triplet. |
Motivation for this change
Erlang does not cross compile right now through Nix. This is trying to address this, in particular with the recent rise of AWS Graviton2 instances. #58042 was doing a lot already, but staled. This is going from there and continuing. I kept the old commit and the new one for now, there is probably still some work to be done
Things done
I tried to shrink the dependency on
buildPackages
but it seems that it get spliced the Host perl instead of the Build perl into the built of the host package. Same for libxslt. I don't know why, if someone have an idea i would love to hear about it.The dependency on
buildPackages.erlang_nox
is also problematic. It is due to the fact that erlang need to bootstrap in cross compilation. But it needs to use the same version, which i found no good way to do here. So i use the defaulterlang_nox
and pray that it works. That is potentially problematic. The other solution would be to bootstrap manually by building a limited bootstrapping OTP. The erlang build system offer that option, but i did not find a way to do that nicely without having to rebuild that bootstrapping lib each time. The other solution would be to build an intermediate derivation exclusively in the case of cross compilation. If this is something NixPkgs would be ok with, i could do that.I am also not a fan of injecting
"erl_xcomp_sysroot=${stdenv.cc.libc}"
but it is needed by erlang build system or it decides it cannot find SSL for the host target. If there is a better option i would like that.sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)