[commit: ghc] ghc-7.8: Fix #8770 (c9c0b15)

git at git.haskell.org git at git.haskell.org
Mon Feb 17 10:26:41 UTC 2014


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

On branch  : ghc-7.8
Link       : http://ghc.haskell.org/trac/ghc/changeset/c9c0b1514b566425b16e2d88dd50f994c9a87709/ghc

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

commit c9c0b1514b566425b16e2d88dd50f994c9a87709
Author: Austin Seipp <austin at well-typed.com>
Date:   Thu Feb 13 07:17:30 2014 -0600

    Fix #8770
    
    As usual, Mac OS X is extremely annoying (or the software is, anyway),
    because not only does it load dynamic libraries with the .dylib
    extension, but also the .so extension. For whatever reason. At least
    it's easy to fix.
    
    Signed-off-by: Austin Seipp <austin at well-typed.com>
    (cherry picked from commit dc080915597065087b3821b3ded0a621a7e2fae7)


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

c9c0b1514b566425b16e2d88dd50f994c9a87709
 compiler/ghci/Linker.lhs      |   11 ++++++++++-
 compiler/main/DriverPhases.hs |   10 +++++-----
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/compiler/ghci/Linker.lhs b/compiler/ghci/Linker.lhs
index eb3e226..274f2fb 100644
--- a/compiler/ghci/Linker.lhs
+++ b/compiler/ghci/Linker.lhs
@@ -378,7 +378,16 @@ preloadLib dflags lib_paths framework_paths lib_spec
              -> do maybe_errstr <- loadDLL (mkSOName platform dll_unadorned)
                    case maybe_errstr of
                       Nothing -> maybePutStrLn dflags "done"
-                      Just mm -> preloadFailed mm lib_paths lib_spec
+                      Just mm | platformOS platform /= OSDarwin ->
+                        preloadFailed mm lib_paths lib_spec
+                      Just mm | otherwise -> do
+                        -- As a backup, on Darwin, try to also load a .so file
+                        -- since (apparently) some things install that way - see
+                        -- ticket #8770.
+                        err2 <- loadDLL $ ("lib" ++ dll_unadorned) <.> "so"
+                        case err2 of
+                          Nothing -> maybePutStrLn dflags "done"
+                          Just _  -> preloadFailed mm lib_paths lib_spec
 
           DLLPath dll_path
              -> do maybe_errstr <- loadDLL dll_path
diff --git a/compiler/main/DriverPhases.hs b/compiler/main/DriverPhases.hs
index 2de19b9..c406f6a 100644
--- a/compiler/main/DriverPhases.hs
+++ b/compiler/main/DriverPhases.hs
@@ -240,14 +240,14 @@ objish_suffixes :: Platform -> [String]
 -- Use the appropriate suffix for the system on which
 -- the GHC-compiled code will run
 objish_suffixes platform = case platformOS platform of
-                           OSMinGW32 -> [ "o", "O", "obj", "OBJ" ]
-                           _         -> [ "o" ]
+  OSMinGW32 -> [ "o", "O", "obj", "OBJ" ]
+  _         -> [ "o" ]
 
 dynlib_suffixes :: Platform -> [String]
 dynlib_suffixes platform = case platformOS platform of
-                           OSMinGW32 -> ["dll", "DLL"]
-                           OSDarwin  -> ["dylib"]
-                           _         -> ["so"]
+  OSMinGW32 -> ["dll", "DLL"]
+  OSDarwin  -> ["dylib", "so"]
+  _         -> ["so"]
 
 isHaskellishSuffix, isHaskellSrcSuffix, isCishSuffix, isExtCoreSuffix,
     isHaskellUserSrcSuffix



More information about the ghc-commits mailing list