-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Cross-compiling from MacOS #64
Comments
Hey, not yet, because to my knowledge GHC and Cabal do not have the necessary cross-compiling support for that yet. But @Ericson2314 is working on that so it may work in the not-too-far future. |
Does nix-build '<nixpkgs>' --arg crossSystem '{ config = "x86_64-unknown-linux-musl"; useLLVM = true; }' -A hello work? I don't remember any Haskell-specific issues, but could easily be forgetting things. Maybe @angerman knows? |
I can confirm that cross-compiling |
I'm not sure! If anybody knows, please chime in. I haven't tried to cross-compile static Haskell exes myself yet, so any contributions or insights would be appreciated. I gave a super quick shot at passing |
static muslc is a special case on Linux. The special part is that you can natively run the muslc executable. This makes issues like TH and others (e.g. you can have a proper stage2 compiler) go away. If you want macOS as a build host you now need some form of executing haskell Linux binaries at compile time (if you want comprehensive compilation capabilities). We can do this for windows with WINE. For macOS there are a few projects that promise a Linux execution layer (e.g. the noah project). But last I checked (for macOS -> Linux cross compilation), it needed substantial patching and even then didn’t support enough Linux to make the programs run. Even if they run, making sure they behave sufficiently similar is another issue. What you could do is use vbox to start up a virtual Linux machine and delegate all cl pipe time requirements to that. Or use the splice dumping/loading approach that zeroTH/evil-splicer and obsidian.systems do to get macOS -> Linux cross compilation. Is it worth it? I can’t tell. Would it be cool to have? Absolutely! |
Is there a way that I could build a statically-linked Linux from Nix on MacOS?
Thanks
The text was updated successfully, but these errors were encountered: