[commit: packages/Cabal] ghc-head: Calling ghci also needs the linker options (730e4c3)

git at git.haskell.org git at git.haskell.org
Mon Aug 26 23:31:19 CEST 2013


Repository : ssh://git@git.haskell.org/Cabal

On branch  : ghc-head
Link       : http://git.haskell.org/?p=packages/Cabal.git;a=commit;h=730e4c3d67d2e3e4243481dcf489500671c8e72f

>---------------------------------------------------------------

commit 730e4c3d67d2e3e4243481dcf489500671c8e72f
Author: Duncan Coutts <duncan at community.haskell.org>
Date:   Fri Aug 16 22:00:12 2013 +0100

    Calling ghci also needs the linker options
    
    For a normal compile we do separate invocations of ghc for compiling as
    for linking. But for repl we have to do just the one invocation, so
    that one has to include all the linker stuff too, like -l flags and any
    .o files from C files etc.
    
    Need to see how .o files from C files works with ghci that uses dynamic
    loading by default.


>---------------------------------------------------------------

730e4c3d67d2e3e4243481dcf489500671c8e72f
 Cabal/Distribution/Simple/GHC.hs |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/Cabal/Distribution/Simple/GHC.hs b/Cabal/Distribution/Simple/GHC.hs
index 2ee702c..c484a83 100644
--- a/Cabal/Distribution/Simple/GHC.hs
+++ b/Cabal/Distribution/Simple/GHC.hs
@@ -956,9 +956,17 @@ buildOrReplExe forRepl verbosity _pkg_descr lbi
                       ghcOptDynHiSuffix    = toFlag "dyn_hi",
                       ghcOptDynObjSuffix   = toFlag "dyn_o"
                     }
+      linkerOpts = mempty {
+                      ghcOptLinkOptions    = PD.ldOptions exeBi,
+                      ghcOptLinkLibs       = extraLibs exeBi,
+                      ghcOptLinkLibPath    = extraLibDirs exeBi,
+                      ghcOptLinkFrameworks = PD.frameworks exeBi,
+                      ghcOptInputFiles     = [exeDir </> x | x <- cObjs]
+                   }
       replOpts   = baseOpts {
                       ghcOptExtra          = filterGhciFlags (ghcOptExtra baseOpts)
                    }
+                   `mappend` linkerOpts
                    `mappend` mempty {
                       ghcOptMode           = toFlag GhcModeInteractive,
                       ghcOptOptimisation   = toFlag GhcNoOptimisation
@@ -989,12 +997,8 @@ buildOrReplExe forRepl verbosity _pkg_descr lbi
         | isGhcDynamic = doingTH && (withProfExe lbi || withStaticExe)
         | otherwise    = doingTH && (withProfExe lbi || withDynExe lbi)
 
-      linkOpts = commonOpts `mappend` mempty {
-                      ghcOptLinkOptions    = PD.ldOptions exeBi,
-                      ghcOptLinkLibs       = extraLibs exeBi,
-                      ghcOptLinkLibPath    = extraLibDirs exeBi,
-                      ghcOptLinkFrameworks = PD.frameworks exeBi,
-                      ghcOptInputFiles     = [exeDir </> x | x <- cObjs],
+      linkOpts = commonOpts `mappend`
+                 linkerOpts `mappend` mempty {
                       ghcOptLinkNoHsMain   = toFlag (not isHaskellMain)
                  }
 





More information about the ghc-commits mailing list