summaryrefslogtreecommitdiff
path: root/compiler/GHC/Runtime/Linker.hs
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2020-07-13 19:22:35 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-07-14 21:34:35 -0400
commitcdc4a6b0f71bbd16a11f23e455b28c0c15720b38 (patch)
tree3bd3e407357ddb724b6d7ef3c700dde31781763d /compiler/GHC/Runtime/Linker.hs
parent58ae62ebb5750e4dfbdb171efde8e3064b7afea8 (diff)
downloadhaskell-cdc4a6b0f71bbd16a11f23e455b28c0c15720b38.tar.gz
loadFramework: Output the errors collected in all loading attempts.
With the recent change away from first finding and then loading a framework, loadFramework had no way of communicating the real reason why loadDLL failed if it was any reason other than the framework missing from the file system. It now collects all loading attempt errors into a list and concatenates them into a string to return to the caller.
Diffstat (limited to 'compiler/GHC/Runtime/Linker.hs')
-rw-r--r--compiler/GHC/Runtime/Linker.hs14
1 files changed, 8 insertions, 6 deletions
diff --git a/compiler/GHC/Runtime/Linker.hs b/compiler/GHC/Runtime/Linker.hs
index ccbb1791e9..5b7b79c999 100644
--- a/compiler/GHC/Runtime/Linker.hs
+++ b/compiler/GHC/Runtime/Linker.hs
@@ -1705,22 +1705,24 @@ loadFramework hsc_env extraPaths rootname
Left _ -> []
Right dir -> [dir </> "Library/Frameworks"]
ps = extraPaths ++ homeFrameworkPath ++ defaultFrameworkPaths
- ; findLoadDLL ps }
+ ; errs <- findLoadDLL ps []
+ ; return $ fmap (intercalate ", ") errs
+ }
where
fwk_file = rootname <.> "framework" </> rootname
-- sorry for the hardcoded paths, I hope they won't change anytime soon:
defaultFrameworkPaths = ["/Library/Frameworks", "/System/Library/Frameworks"]
- findLoadDLL [] =
+ findLoadDLL [] errs =
-- Tried all our known library paths, but dlopen()
-- has no built-in paths for frameworks: give up
- return (Just "not found")
- findLoadDLL (p:ps) =
+ return $ Just errs
+ findLoadDLL (p:ps) errs =
do { dll <- loadDLL hsc_env (p </> fwk_file)
; case dll of
- Nothing -> return Nothing
- Just _ -> findLoadDLL ps
+ Nothing -> return Nothing
+ Just err -> findLoadDLL ps ((p ++ ": " ++ err):errs)
}
{- **********************************************************************