
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/build.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-derivedconstants/header -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 rts/dist/build/Hash.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-0.10.4.0 -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-1.18.1.3 -package array-0.5.0.0 -package base-4.7.0.1 -package bytestring-0.10.4.0 -package containers-0.5.5.1 -package deepseq-1.3.0.2 -package directory-1.2.1.0 -package filepath-1.3.0.2 -package ghc-7.8.2.20140623 -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 utils/haddock/dist/build/Haddock/Utf8.dyn_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

On Sat, 28 Jun 2014 08:31:41 -0700
Mark Lentczner
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/build.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:
Hi Mark! The best way to set all 3 vars: SRC_CC_OPTS = -mmacos-version-min=10.7 SRC_LD_OPTS = -mmacos-version-min=10.7 SRC_HC_OPTS = -optc-mmacos-version-min=10.7 -optl-mmacos-version-min=10.7 and, maybe even -optP. CC/LD_OPTS is more for non-haskell code from build system perspective. http://www.haskell.org/ghc/docs/latest/html/users_guide/options-phases.html#... -- Sergei

After some deep investigation (including reading the clang source), turns out the easiest way is to just set an environment variable for the duration of the GHC configure/build sequence: export MACOSX_DEPLOYMENT_TARGET=10.7 Will "do the right thing" in all contexts throughout the build without needing to thread command options through. I've tested this and it works. It does raise the issue of should set it as far back as 10.6? - Mark
participants (2)
-
Mark Lentczner
-
Sergei Trofimovich