-
Notifications
You must be signed in to change notification settings - Fork 90
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
Support installing cross compilers (such as new JS backend) #838
Comments
This will likely require support for all boot libraries to be downloaded and installed from Hackage. Also Cabal wouldn't consider them not reinstallable anymore. After this, the strategy for ghcup will be to only consider the host platform of the compiler, not the target platform. So just like as it does today. So I'm not sure if we should invest too much into ghcup distributing cross host/target bindists (x86_64/js, aarch64/js...) or if we should better wait for multi-target GHC. The latter seems easier to maintain and better for users. |
Well, ghcup can build cross compilers today and actually knows how to distinguish by target platform. But it's not a widely used feature. Installing via bindists would also need somewhat more work, but it won't require a major refactoring. |
I didn't know this. So can I already build GHC with the JS backend directly from ghcup? That would be already better than the build instructions we provide (especially if cabal is made to work automatically with this selected ghc) |
Good question. I've only tried building ARM cross compiler (there used to be a test even, which I should probably revive: https://gitlab.haskell.org/haskell/ghcup-hs/-/blob/master/.gitlab-ci.yml#L355 ). GHCup allows to use both make and hadrian and make is still the default. I have never tried to build a cross compiler via hadrian. I don't know whether it works the same way. Here's the hadrian specific code: Lines 994 to 1036 in 278a300
The target triple Lines 1187 to 1240 in 278a300
And in fact the CLI code will throw an error assuming it doesn't work yet when combining cross with hadrian: ghcup-hs/app/ghcup/GHCup/OptParse/Compile.hs Lines 557 to 559 in 278a300
So if you know what to pass to hadrian to make this work, the changes to ghcup code should be minimal. |
Hadrian doesn't require specific parameters to build a cross-compiler. Only For the JS backend we have the additional constraint that we need to enable the |
Then we could just remove the optparse restriction and try something like: ghup compile ghc --version=9.6.1 --bootstrap-ghc=9.6.1 --cross-target=javascript-unknown-ghcjs --hadrian --flavour=default+native_bignum I can only try next week. I'm travelling and don't have a laptop. If you want to give it a shot yourself, I'm happy to assist. |
I'll be busy this week getting TH merged before the 9.8 fork, but after that sure! |
I'll give it a shot |
Thanks a lot @hasufell! |
@bgamari @hsyl20 @david-christiansen
Afaiu from talking to Ben, the current temporary approach would be to ship additional bindists specific to cross compiler.
There seems to be work going on to allow to fold that into the same bindist and have a target flag or so for GHC?
I'm not sure what our strategy should be to support this.
The text was updated successfully, but these errors were encountered: