Skip to content

Fix building of exes that use TH and profiling. #1251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 21, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cabal/Distribution/Simple/GHC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ buildExe verbosity _pkg_descr lbi
compileOpts | withProfExe lbi = profOpts
| withDynExe lbi = dynOpts
| otherwise = staticOpts

linkOpts = compileOpts `mappend` mempty {
ghcOptLinkOptions = PD.ldOptions exeBi,
ghcOptLinkLibs = extraLibs exeBi,
Expand All @@ -880,7 +880,7 @@ buildExe verbosity _pkg_descr lbi
-- be loaded up and run by the compiler.
when ((withProfExe lbi || withDynExe lbi) &&
EnableExtension TemplateHaskell `elem` allExtensions exeBi) $
runGhcProg compileOpts { ghcOptNoLink = toFlag True }
runGhcProg staticOpts { ghcOptNoLink = toFlag True }
--TODO: do we also need to play the static vs dynamic games here?

runGhcProg compileOpts { ghcOptNoLink = toFlag True }
Expand Down
6 changes: 4 additions & 2 deletions Cabal/tests/PackageTests/TemplateHaskell/Check.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ profiling = TestCase $ do
let flags = ["--enable-library-profiling"
-- ,"--disable-library-vanilla"
,"--enable-executable-profiling"]
spec = PackageSpec ("PackageTests" </> "TemplateHaskell" </> "profiling") flags
spec = PackageSpec ("PackageTests" </>
"TemplateHaskell" </> "profiling") flags
result <- cabal_build spec
assertBuildSucceeded result

Expand All @@ -18,6 +19,7 @@ dynamic = TestCase $ do
let flags = ["--enable-shared"
-- ,"--disable-library-vanilla"
,"--enable-executable-dynamic"]
spec = PackageSpec ("PackageTests" </> "TemplateHaskell" </> "dynamic") flags
spec = PackageSpec ("PackageTests" </>
"TemplateHaskell" </> "dynamic") flags
result <- cabal_build spec
assertBuildSucceeded result