I reproduced your same error, and figured out the cause. I'll just embed it as a diff inline, you'll spot it in the script instantly :).
Took me annoyingly long to find it; I didn't at all expect that it'd be either the configure or Hadrian lines, as I copied those from the most recent entries in my zsh history. It turned out to be the 11th line of the Hadrian command, where it sets the CPPFLAGS: --- broken +++ working @@ -8,7 +8,7 @@ --configure-option=LDFLAGS= \ --configure-option=--target=aarch64-unknown-openbsd" \ "stage1.*.cabal.configure.opts += \ - --configure-option=CPPFLAGS=--sysroot=aarch64-sysroot \ + --configure-option=CPPFLAGS=--sysroot=$SYSROOT \ --ghc-option=-optc--target=aarch64-unknown-openbsd \ --ghc-option=-optl--host=aarch64-unknown-openbsd \ --ghc-option=-optl--target=aarch64-unknown-openbsd \ Cheers, Habib