-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add RISC-V (64-bit) support #9
Comments
Currently, there is no official support for GHC on Linux/RISC-V: |
This requires cross-compiling GHC1 from either This is quite a lot of work and to compile it in a reasonable time, 'native RISC-V hardware'2 is required. @bgamari @mpickering Is cross-compiling GHC to Linux/RISC-V currently even possible? ℹ️ 2024-08-22: Debian sid has GHC 9.4.7 for riscv64 in its package repository. Footnotes |
I believe you can cross-compiler to RISC-V using the LLVM backend (your linked ticket seems to suggest that people do this). |
@supersven At some point I would like to add a There is not much documentation about 'porting GHC'1 to a new architecture using hadrian. Any hints/tips? Dockerfile to build GHC 9.10.1 for both Footnotes
|
To shed some light on this:
So, the only way to get a GHC bindist (for a recent GHC version) is to create it on real hardware (or an emulated VM, e.g. Qemu.) If you got RISCV-V hardware, this shouldn't be much of an issue: Distributions like SuSE or Debian ship GHC with the LLVM backend configured. Though, be prepared that building and bundling with take about a day (without running the testsuite.) As you likely want to ship only from trusted sources, I fear you'll need to wait until either Hadrian allows So, I'd be excited to see a GHC/RISC-V Docker image (thanks a lot for bringing this up, BTW 👍 ), but we probably aren't ready, yet. |
According to https://gitlab.haskell.org/ghc/ghc/-/wikis/cross-compilation#meshing-with-ghcs-2-stage-build this is one of two ways.
I currently use QEMU...
...but HW is on its way.
No. I intend to cross-compile from either
|
@supersven This seems to be the alternative. But with my limited knowledge regarding GHC and cross-compiling1, I am unable to derive the required steps for hadrian myself. Footnotes
|
@benz0li Ah, I see 💡 E.g. Debian Sid (GHC 9.4.7, https://packages.debian.org/sid/ghc) and Experimental (9.6.6, https://packages.debian.org/experimental/ghc) ship with RISC-V GHC. If you get one of these running in Qemu, you should be able to build a GHC bindist: ./boot && ./configure
hadrian/build -j --flavour=release binary-dist I fear the documentation is a bit outdated. To my knowledge, building cross-compiled GHCs with Hadrian is a work-in-progress: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/11444 |
FYI @mpilgrem The Both GHC and Stack are built (manually) from source on an emulated Linux/RISC-V platform. |
Create
linux/riscv64
docker images.The text was updated successfully, but these errors were encountered: