Commit dc080915 authored by Austin Seipp's avatar Austin Seipp
Browse files

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: default avatarAustin Seipp <austin@well-typed.com>
parent a8a01e74
...@@ -378,7 +378,16 @@ preloadLib dflags lib_paths framework_paths lib_spec ...@@ -378,7 +378,16 @@ preloadLib dflags lib_paths framework_paths lib_spec
-> do maybe_errstr <- loadDLL (mkSOName platform dll_unadorned) -> do maybe_errstr <- loadDLL (mkSOName platform dll_unadorned)
case maybe_errstr of case maybe_errstr of
Nothing -> maybePutStrLn dflags "done" 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 DLLPath dll_path
-> do maybe_errstr <- loadDLL dll_path -> do maybe_errstr <- loadDLL dll_path
......
...@@ -240,14 +240,14 @@ objish_suffixes :: Platform -> [String] ...@@ -240,14 +240,14 @@ objish_suffixes :: Platform -> [String]
-- Use the appropriate suffix for the system on which -- Use the appropriate suffix for the system on which
-- the GHC-compiled code will run -- the GHC-compiled code will run
objish_suffixes platform = case platformOS platform of objish_suffixes platform = case platformOS platform of
OSMinGW32 -> [ "o", "O", "obj", "OBJ" ] OSMinGW32 -> [ "o", "O", "obj", "OBJ" ]
_ -> [ "o" ] _ -> [ "o" ]
dynlib_suffixes :: Platform -> [String] dynlib_suffixes :: Platform -> [String]
dynlib_suffixes platform = case platformOS platform of dynlib_suffixes platform = case platformOS platform of
OSMinGW32 -> ["dll", "DLL"] OSMinGW32 -> ["dll", "DLL"]
OSDarwin -> ["dylib"] OSDarwin -> ["dylib", "so"]
_ -> ["so"] _ -> ["so"]
isHaskellishSuffix, isHaskellSrcSuffix, isCishSuffix, isExtCoreSuffix, isHaskellishSuffix, isHaskellSrcSuffix, isCishSuffix, isExtCoreSuffix,
isHaskellUserSrcSuffix isHaskellUserSrcSuffix
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment