Skip to content

fatal error: 'ffi.h' file not found strikes back

Summary

GHC HEAD build used to work, but after updating to bfd7c1e6 started to fail with

Command line: _build/stage0/bin/ghc -Wall -Wcompat -hisuf p_hi -osuf p_o -hcsuf p_hc -static -prof -hide-all-packages -no-user-package-db '-package-env -' '-package-db _build/stage1/inplace/package.conf.d' '-this-unit-id ghc-prim-0.10.0' '-package-id rts-1.0.2' -i -i/Users/andrew/programs/ghc/_build/stage1/libraries/ghc-prim/build -i/Users/andrew/programs/ghc/_build/stage1/libraries/ghc-prim/build/autogen -i/Users/andrew/programs/ghc/libraries/ghc-prim -Irts/include -I_build/stage1/libraries/ghc-prim/build -I/Users/andrew/programs/ghc/rts/include -I/Users/andrew/programs/ghc/_build/stage1/rts/build/include -I/Users/andrew/programs/ghc/rts/@FFIIncludeDir@ -I/Users/andrew/programs/ghc/_build/stage1/rts/build/@FFIIncludeDir@ -I/Users/andrew/programs/ghc/rts/@LibdwIncludeDir@ -I/Users/andrew/programs/ghc/_build/stage1/rts/build/@LibdwIncludeDir@ -optP-include -optP_build/stage1/libraries/ghc-prim/build/autogen/cabal_macros.h -optc--target=arm64-apple-darwin -outputdir _build/stage1/libraries/ghc-prim/build -fdiagnostics-color=always -Wnoncanonical-monad-instances -optc-Wno-unknown-pragmas -optP-Wno-nonportable-include-path -c libraries/ghc-prim/GHC/Types.hs -o _build/stage1/libraries/ghc-prim/build/GHC/Types.p_o -O2 -H32m -this-unit-id ghc-prim -XHaskell2010 -no-global-package-db -package-db=/Users/andrew/programs/ghc/_build/stage1/inplace/package.conf.d -ghcversion-file=rts/include/ghcversion.h -ghcversion-file=rts/include/ghcversion.h -haddock -Wno-deprecated-flags -Wno-trustworthy-safe
===> Command failed with error code: 1

/var/folders/fj/n2mwl7ld2nz_f6v9_pkzzhth0000gn/T/ghc36444_0/ghc_4.c:4:10: error:
     fatal error: 'ffi.h' file not found
  |
4 | #include <ffi.h>
  |          ^
#include <ffi.h>
         ^~~~~~~
1 error generated.
`gcc' failed in phase `C Compiler'. (Exit code: 1)
Command failed
Build failed.

It seems like #20592 (closed) strikes back: export C_INCLUDE_PATH="`xcrun --show-sdk-path`/usr/include/ffi" helps again.

Steps to reproduce

./boot && ./configure --with-intree-gmp && hadrian/build -j

Expected behavior

The build is expected to succeed.

Environment

  • Bootstrap GHC: 9.2.5
  • Operating System: macOS 13.0.1
  • System Architecture: M2
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information