Skip to content

'FFI_DEFAULT_ABI' could not be recognized even if it is provided by ffitarget.h

Summary

I've provided the ffi.h and its libs when ./configure. But the hadrian compiler seems not to recognize the definition of FFI_DEFAULT_ABI in ffitarget.h.

error: In file included from _build/stage0/libraries/ghci/build/GHCi/FFI_hsc_make.c:1:
FFI.hsc: In function 'main':
FFI.hsc:131:16: error: 'fFI_DEFAULT_ABI' undeclared (first use in this function); did you mean 'FFI_LAST_ABI'?
/opt/workload/build/ghc-9.2.3/_build/stage0/lib/template-hsc.h:45:10: note: in definition of macro 'hsc_const'
   45 |     if ((x) < 0)                                      \
      |          ^
FFI.hsc:131:16: note: each undeclared identifier is reported only once for each function it appears in
/opt/workload/build/ghc-9.2.3/_build/stage0/lib/template-hsc.h:45:10: note: in definition of macro 'hsc_const'
   45 |     if ((x) < 0)                                      \
      |   

Steps to reproduce

This issue has the same background as issue 21921, so steps are similar to it.

Run ./configure as below instead.

./configure \
AR_STAGE0=/usr/bin/ar \
CC_STAGE0=/usr/bin/gcc \
LD_STAGE0=/usr/bin/ld \
CC=${CROSS_TOOLS}/${CROSS_TARGET}-gcc \
CPP=${CROSS_TOOLS}/${CROSS_TARGET}-cpp \
LD=${CROSS_TOOLS}/${CROSS_TARGET}-ld \
NM=${CROSS_TOOLS}/${CROSS_TARGET}-nm \
OBJDUMP=${CROSS_TOOLS}/${CROSS_TARGET}-objdump \
STRIP=${CROSS_TOOLS}/${CROSS_TARGET}-strip \
RANLIB=${CROSS_TOOLS}/${CROSS_TARGET}-ranlib \
CLANG=${CROSS_TOOLS}/clang \
LLC=${CROSS_TOOLS}/llc \
OPT=${CROSS_TOOLS}/opt \
LDFLAGS=-L${BASEDIR}/cross-tools/ \
CPPFLAGS=-I${BASEDIR}/cross-tools/ \
--target=${CROSS_TARGET} \
--with-system-libffi=yes \
--with-ffi-includes=/opt/workload/cross-tools/target/usr/include/ \
--with-ffi-libraries=/opt/workload/cross-tools/target/usr/lib64

Expected behavior

In FFI.hsc, 'fFI_DEFAULT_ABI' could be recognized as 'FFI_LAST_ABI', since it has been defined in ffitarget.h

Environment

  • GHC version used: 9.2.3
  • Operating System: Fedoral Server 36
  • System Architecture: x86_64
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information