Skip to content

mkRtsOptionsLevelObj should respect -optc standard headers

Our fancy compilation environment does not keep the standard C headers always in the same place. We always invoke gcc with --sysroot. Then we pass the same flag to ghc with -optc--sysroot=blah.

This works most of the time until I also do ghc -rtsopts. In that case GHC will try to build a small generated object file with a limited command line that fails to include -optc flags. That leads to failure:

*** C Compiler:
gcc -c /tmp/ghc15472_0/ghc15472_0.c -o /tmp/ghc15472_0/ghc15472_0.o -Ilib/ghc-7.0.4/include -fno-stack-protector

In file included from /tmp/ghc15472_0/ghc15472_0.c:1:0: 

In file included from lib/ghc-7.0.4/include/Rts.h:23:0:
    

lib/ghc-7.0.4/include/Stg.h:62:10:
     fatal error: 'math.h' file not found
#include <math.h>
         ^
1 error generated.

This seems trivially easy to fix with the attached patch.

Edited by Ian Lynagh -
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information