cc & ld extra flags

Mark Lentczner mark.lentczner at
Sat Jun 28 15:31:41 UTC 2014

I'd like to build GHC, and all the base libs, with an extra flag supplied
to cc (well gcc) and ld commands:

I thought I could just add this to mk/

SRC_CC_OPTS = -mmacos-version-min=10.7
SRC_LD_OPTS = -mmacos-version-min=10.7

But this seems very inconsistently applied. For example:

This part of the build of the RTS gets it:

"inplace/bin/ghc-stage1" -optc-m64 -optc-fno-stack-protector
*-optc-mmacosx-version-min=10.7* -optc-Wall -optc-Wextra
-optc-Wstrict-prototypes -optc-Wmissing-prototypes
-optc-Wmissing-declarations -optc-Winline -optc-Waggregate-return
-optc-Wpointer-arith -optc-Wmissing-noreturn -optc-Wnested-externs
-optc-Wredundant-decls -optc-Iincludes -optc-Iincludes/dist
-optc-Iincludes/dist-ghcconstants/header -optc-Irts -optc-Irts/dist/build
-optc-DCOMPILING_RTS -optc-fno-strict-aliasing -optc-fno-common
-optc-DBE_CONSERVATIVE -optc-DDTRACE -optc-O2 -optc-fomit-frame-pointer
-optc-DRtsWay=\"rts_v\" -static  -H32m -O -Iincludes -Iincludes/dist
-Iincludes/dist-derivedconstants/header -Iincludes/dist-ghcconstants/header
-Irts -Irts/dist/build -DCOMPILING_RTS -package-name rts -dcmm-lint
-DDTRACE     -i -irts -irts/dist/build -irts/dist/build/autogen
-Irts/dist/build -Irts/dist/build/autogen           -O2    -c rts/Hash.c -o

But this part doesn't:

"inplace/bin/ghc-stage2" -hisuf dyn_hi -osuf  dyn_o -hcsuf dyn_hc -fPIC
-dynamic  -H32m -O    -hide-all-packages -i -iutils/haddock/driver
-iutils/haddock/src -iutils/haddock/vendor/attoparsec-
-iutils/haddock/dist/build -iutils/haddock/dist/build/autogen
-Iutils/haddock/dist/build -Iutils/haddock/dist/build/autogen
-optP-DIN_GHC_TREE -optP-include
-optPutils/haddock/dist/build/autogen/cabal_macros.h -package
Cabal- -package array- -package base- -package
bytestring- -package containers- -package deepseq-
-package directory- -package filepath- -package
ghc- -package xhtml-3000.2.1 -funbox-strict-fields -Wall
-fwarn-tabs -O2 -XHaskell2010  -no-user-package-db -rtsopts      -odir
utils/haddock/dist/build -hidir utils/haddock/dist/build -stubdir
utils/haddock/dist/build   -c utils/haddock/src/Haddock/Utf8.hs -o

I think it might have to do with the dyn_o and thr_o targets?

So - Is there a better way to ensure these flags are applied? I suppose I
could wrap gcc (clang) and ld.... but that seems ham-handed.

- Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the ghc-devs mailing list