hadrian does not correctly implement in tree gmp support
Summary
Hadrian's intree gmp build logic only works if theres a GMP header file in one of the default search paths of the C compiler
Steps to reproduce
build ghc using hadrian with the intree-gmp configuration, without GMP headers in any of the default header include paths used by your GCC/CLANG/CC.
on OSX you can reproduce as follows (directions follow assume you're using brew to install libraries)
brew unlink gmp
git clean -fdx
make maintainer-clean
perl boot
./configure --with-intree-gmp # you may also add CC=(which clang) or gcc or whatever
hadrian/build.sh --flavour=quickest -j
Expected behavior
ghc should build! instead we get this
| 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
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
| ^~~~~
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/HSinteger-gmp-1.0.2.0.o
at need, called at src/Rules/Library.hs:102: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.20200127/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.8.1 or 8.6.5
Optional:
- Operating System: OSX
- System Architecture: AMD64
i originally reported this as #17741 (closed) and friends, incorrectly :)