-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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-{8.2.2,8.4.2}: fixups mostly for 2-stage cross, musl #37598
Conversation
Since I put this together for someone on IRC, here's a command for turning hours of CPU time into a musl-based haskell "Hello World":
😁 |
CC @angerman |
The
That in turn should also set the |
If you two (and @bgamari too, maybe) could collaborate, that would be great! |
Historically, I've been able to cross compile fine without the gentoo patches, but I'll look through them to see what they offer. |
Per haskell/cabal#4941 (comment) @23Skidoo would be interested in us producing official cabal-install binaries statically linked with musl. LMK what I can do to help with these PRs. |
@dtzWill Fantastic, this worked! I have uploaded a built nix closure of the GHC built in that process here, so that people who don't want to wait hours to compile GHC can use my binary build: https://github.com/nh2/nixpkgs/releases/tag/ghc-cross-musl-works |
The stuff in here allowed me to build some fully static Haskell executables: |
@dtzWill Which of these branches is more up-to-date / should I use? |
haha I honestly don't know. :/ sorry. There were other deeper problems that made cross-compiling (musl or no) with GHC problematic, Or maybe cross-compilation with GHC works better now than it did, not sure. |
7048fc7
to
1e28373
Compare
Ah I finally understand this now. This stuff is for 2-stage cross, which wasn't attempted before. It's a somewhat odd use-case, but seems at least harmless to everything else. I'm happy merging this if you all want; just got rid of conflicts. |
Actually @angerman I think recently submitted a better version of the last patch. I'm going to gate them all on the two-stage case. |
* grab patches from gentoo to fix various 2-stage cross build system bugs * explicitly set CrossCompilePrefix to the expected targetPrefix -- ensures everything has expected name and location -- fixes lack of prefix'ing when doing glibc -> musl "cross" * Stage1Only: only set if doing "true" cross * don't try to specify include/lib dirs for ncurses on cross -- only used by terminfo which actually removed the include option, and the lib option doesn't seem to do anything other than confuse the situation re:cross. Fixes NixOS#37522
1e28373
to
6cc5483
Compare
@Ericson2314 The rebase seems to make GHC 8.2.2 unhappy: #37522 (comment) |
@Ericson2314 thanks! What do you mean "2-stage cross", and why is it odd? (not challenging, just .. I don't remember this at all and am curious!) |
Normally GHC just builds a single cross compiler and that's this. Here GHC builds a cross compiler which builds a native compiler, a process that is only possible because the target platform is very close to the build platform (i.e. can run musl binaries on linux with glibc for most things). General compilation is limited to a single-stage build. |
@Ericson2314, which last patch are you referring to? |
I don’t think i’ve Done anything to hp2ps or unlit. Only to hsc2hs. I’m afraid you must be misremembering, @Ericson2314. |
With the version before the rebase, I managed to build a Haskell package with lots of dependencies ( Now we just have to get it working on the latest nixpkgs, and figure out the |
@angerman Ah I was thinking of haskell/hsc2hs@738f366, which was inspired by those patches. |
(!!!) ~~it's happening!!~~ |
Oh we need |
FWIW build path for me seems to go through sqlalchemy, which is currently failing to build (failed test) w/musl but is fixed by bumping its version, see #42180 . At least ran into this trying to build 8.2.2. |
@Ericson2314 any idea what the problem with 8.4.3 is? It builds (and seems to work when I manually invoke it on a trivial program), see #42455 (comment) for a bit more details. Looks like the output doesn't have the right prefixes-- trying a quick fix that I don't expect to work but might do the trick... otherwise thoughts/suggestions are welcome :). |
bugs
-- ensures everything has expected name and location
-- fixes lack of prefix'ing when doing glibc -> musl "cross"
-- only used by terminfo which actually removed the include option,
and the lib option doesn't seem to do anything other than
confuse the situation re:cross.
Fixes #37522
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)Tested native x86_64, aarch64, cross-to-musl on those platforms,
and 'hello' :).