Skip to content

Add support for Haiku

Current patches are in https://gitlab.haskell.org/jessicah/ghc/-/tree/haiku.

Build is currently failing at [utils/hsc2hs/ghc.mk:22: utils/hsc2hs/dist-install/build/tmp/hsc2hs]:

/.../x86_64-unknown-haiku/bin/ld.bfd: utils/hsc2hs/dist-install/build/Main.dyn_o: relocation R_X86_64_PC32 against symbol `Main_main_closure' can not be used when making a shared object; recompile with -fPIC
/.../x86_64-unknown-haiku/bin/ld.bfd: final link failed: bad value
collect2: error: ld returned 1 exit status
`x86_64-unknown-haiku-gcc' failed in phase `Linker'. (Exit code: 1)

I've tried various different options to try and ensure -fPIC is being passed, but am running into a brick wall.

https://github.com/jessicah/cross-compiler/ provides a script and patch for building a Haiku cross-compiler, the Haiku packages, and sets up a sysroot that can be used for cross-compiling. Where /path/to/cross-compiler/ contains the target prefixed binaries, e.g. x86_64-unknown-haiku-gcc. Some packages that will be needed to extract into the sysroot can be found at https://haiku.nz/files/packages/, in particular libiconv, gmp, and I think maybe gcc. Not sure of other packages that may need to be added.

Building is pretty simple:

export PATH=/path/to/cross-compiler/bin:$PATH
./configure --target=x86_64-unknown-haiku
make

My current mk/build.mk is BuildFlavour = quick and V=1, no other changes at this stage.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information