Skip to content

Cross-compiling seems to not pass CC through

I'm having trouble trying to bootstrap OpenBSD-aarch64 from OpenBSD-amd64. I do have a working cross-toolchain (courtesy of LLVM) but it looks like the plumbing in hadrian is not fully laid. At least, when running with

export MAKE=gmake \
       AUTOCONF_VERSION=2.71 \
       AUTOMAKE_VERSION=1.16 \
       CC=/usr/local/bin/clang-13 \
       LD=/usr/local/bin/ld.lld-13 \
       NM=/usr/local/bin/llvm-nm-13 \
       OBJDUMP=/usr/local/bin/llvm-objdump-13
./boot
./configure --target=aarch64-none-openbsd --with-cc=/usr/local/bin/clang-13

hadrian/build '*.*.ghc.link.opts+=-L/usr/local/lib' \
	      --docs=none \
	      --flavour=quickest \
              -j stage1:exe:ghc-bin

I see the main configure succeed, but stage0 is already going off the rails when trying to configure the time library which shows in its config.log:

  $ //home/greg/s/ghc/libraries/time/configure --with-compiler=ghc
  '--prefix=${pkgroot}/..' 'CFLAGS=-Qunused-arguments -iquote
  /home/greg/s/ghc/libraries/time -Qunused-arguments'
  LDFLAGS=--target=aarch64-none-openbsd --host=aarch64-none-openbsd
  --with-cc=clang CC=/usr/bin/clang

Which clearly mixed up the uses target value for host whereas the compiler is the one for host. This compiler promptly reports:

error: unable to create target: 'No available targets are compatible with triple "aarch64-none-openbsd"'

because it doesn't have support for aarch64. In fact, it's unclear, where /usr/bin/clang even came from. My configure command above didn't point at it. Moreover, top level config.log doesn't mention it.

If there's better cross-compilation documentation to follow than https://gitlab.haskell.org/ghc/ghc/-/wikis/building/cross-compiling, I'd love to read that.

Attaching the top level config.log andtime-config.log.

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