Opened 9 years ago

Closed 9 years ago

#5313 closed bug (fixed)

wrong dylib name using GHC package

Reported by: mwotton Owned by:
Priority: high Milestone: 7.2.1
Component: GHC API Version: 7.0.3
Keywords: Cc: jcpetruzza@…
Operating System: Linux Architecture: Unknown/Multiple
Type of failure: Runtime crash Test Case: driver/5313
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


> import qualified GHC
> import qualified GHC.Paths
> main = GHC.runGhcT (Just GHC.Paths.libdir) $ do
>       -- begin initialize
>       df0 <- GHC.getSessionDynFlags
>       let df1 = df0{GHC.ghcMode    = GHC.CompManager,
>                     GHC.hscTarget  = GHC.HscInterpreted,
>                     GHC.ghcLink    = GHC.LinkInMemory,
>                     GHC.verbosity  = 0}
>       _ <- GHC.setSessionDynFlags df1
>       -- begin reset
>       GHC.setContext [] []
>       GHC.setTargets []
>       _ <- GHC.load GHC.LoadAllTargets
>       return ()

compiling this on ubuntu with ghc 7.0.3

$ ghc --make test.lhs -dynamic -package ghc

[1 of 1] Compiling Main             ( test.lhs, test.o )
Linking test ...
vagrant@lucid64:~$ ./test
test: <command line>: can't load .so/.DLL for: /usr/local/lib/ghc-7.0.3/ghc-prim- (lib/usr/local/lib/ghc-7.0.3/ghc-prim- cannot open shared object file: No such file or directory)

notice the link.

Change History (5)

comment:1 Changed 9 years ago by mwotton

this is boiled down from using HINT -

import Language.Haskell.Interpreter

main = runInterpreter (return ()) >>= print

comment:2 Changed 9 years ago by simonmar

Milestone: 7.2.1
Priority: normalhigh

We ought to make the GHC API work with -dynamic, even if it fails horribly when some packages or modules are not compiled with -dynamic.

comment:3 Changed 9 years ago by marlowsd@…

commit aed43f7a1ed96277e9c14c6ef643eb134d5bf7f6 Author: Simon Marlow <marlowsd@…> Date: Tue Jul 12 12:16:17 2011 +0100

Fix DLL/SO loading (see #5313).

The code in here is a bit of a mess. I've fixed up some inconsistencies I can see, but it could do with an overhaul.

comment:4 Changed 9 years ago by simonmar

Status: newmerge
Test Case: driver/5313

comment:5 Changed 9 years ago by igloo

Resolution: fixed
Status: mergeclosed
Note: See TracTickets for help on using tickets.