Skip to content

Improve debugging experience for CPP / include search path related build failures

Summary

GHC master does not build successfully with GCC as the C compiler

Steps to reproduce

in fish shell syntax,

set -xl CC /usr/local/bin/gcc-9
git clone --recursive git@gitlab.haskell.org:ghc/ghc.git triage-gcc-plz
## master is commit b3e5c678851ed73897b0eb337e656ff377d242c9 atm 
cd triage-gcc-plz/
perl boot ;and ./configure --with-intree-gmp ;and ./hadrian/build.sh -j8 --flavour=quick

note that any build flavor will do, and i'm getting the same error with both make and hadrian, and i can reproduce it with a fresh checkout

Expected behavior

build to work

What do you expect the reproducer described above to do?

| Run Ghc FindHsDependencies Stage1: libraries/integer-gmp/src/GHC/Integer.hs (and 4 more) => _build/stage1/libraries/integer-gmp/.dependencies.mk
libraries/integer-gmp/cbits/wrappers.c:30:3: error: #error __GNU_MP_VERSION not defined
libraries/integer-gmp/cbits/wrappers.c:30:3: error: #error __GNU_MP_VERSION not defined
   30 | # error __GNU_MP_VERSION not defined
   30 | # error __GNU_MP_VERSION not defined
      |   ^~~~~
      |   ^~~~~
libraries/integer-gmp/cbits/wrappers.c:42:3: error: #error WORD_SIZE_IN_BITS != GMP_LIMB_BITS not supported
libraries/integer-gmp/cbits/wrappers.c:42:3: error: #error WORD_SIZE_IN_BITS != GMP_LIMB_BITS not supported
   42 | # error WORD_SIZE_IN_BITS != GMP_LIMB_BITS not supported
   42 | # error WORD_SIZE_IN_BITS != GMP_LIMB_BITS not supported
      |   ^~~~~
      |   ^~~~~
Error when running Shake build system:
  at action, called at src/Rules.hs:71:19 in main:Rules
  at need, called at src/Rules.hs:93:5 in main:Rules
* Depends on: _build/stage1/lib/package.conf.d/integer-gmp-1.0.2.0.conf
  at need, called at src/Rules/Register.hs:113:5 in main:Rules.Register
* Depends on: _build/stage1/libraries/integer-gmp/build/libHSinteger-gmp-1.0.2.0.a
  at need, called at src/Rules/Library.hs:146:5 in main:Rules.Library
* Depends on: _build/stage1/libraries/integer-gmp/build/c/cbits/wrappers.o
* Raised the exception:
user error (Development.Shake.cmd, system command failed
Command line: /usr/local/bin/gcc-9 -std=c99 -Wall -E -MM -MG -MF _build/stage1/libraries/integer-gmp/build/c/cbits/wrappers.o.d -MT _build/stage1/libraries/integer-gmp/build/c/cbits/wrappers.o -Iincludes -I_build/stage1/lib -I_build/stage1/libraries/integer-gmp/build -I_build/stage1/libraries/integer-gmp/build/include -Ilibraries/integer-gmp/include -I/Users/carter/Desktop/reposcratcher/triage-gcc-plz/_build/stage1/lib/x86_64-osx-ghc-8.11.0.20200125/rts-1.0/include -x c libraries/integer-gmp/cbits/wrappers.c -I_build/stage1/gmp/include
Exit code: 1
Stderr:
libraries/integer-gmp/cbits/wrappers.c:30:3: error: #error __GNU_MP_VERSION not defined
   30 | # error __GNU_MP_VERSION not defined
      |   ^~~~~
libraries/integer-gmp/cbits/wrappers.c:42:3: error: #error WORD_SIZE_IN_BITS != GMP_LIMB_BITS not supported
   42 | # error WORD_SIZE_IN_BITS != GMP_LIMB_BITS not supported
      |   ^~~~~
)

Environment

  • GHC version used: 8.6.5

Optional:

  • Operating System: osx mojave
  • System Architecture: AMD64
Edited by Carter Schonwald
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information