Start GHCI with a static library

Hi all, I have a Haskell library I'd like to load up in GHCI along with a statically linked C library (libblah.a) . Is there any way to do this? My Googling only turns up instructions on loading a shared library (libblah.so). Thanks! -deech

Any ideas?
-deech
On Sat, May 2, 2015 at 10:24 AM, aditya siram
Hi all, I have a Haskell library I'd like to load up in GHCI along with a statically linked C library (libblah.a) . Is there any way to do this? My Googling only turns up instructions on loading a shared library (libblah.so).
Thanks! -deech

You need a GHC built for this, I think.
Using this setup:
https://ghc.haskell.org/trac/ghc/ticket/5371
[callen@atlantis ~/Work/exist]$ ghci -L. -lfoo testlink.hs
GHCi, version 7.10.1: http://www.haskell.org/ghc/ :? for help
ghc: panic! (the 'impossible' happened)
(GHC version 7.10.1 for x86_64-unknown-linux):
Loading archives not supported
[callen@atlantis ~/Work/exist]$ /opt/ghc/7.6.3/bin/ghci -L. -lfoo
testlink.hs
GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading object (static archive) ./libfoo.a ... done
final link ... done
[1 of 1] Compiling TestLink ( testlink.hs, interpreted )
Ok, modules loaded: TestLink.
Prelude>
Leaving GHCi.
[callen@atlantis ~/Work/exist]$ /opt/ghc/7.8.4/bin/ghci -L. -lfoo
testlink.hs
GHCi, version 7.8.4: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading object (static archive) ./libfoo.a ... ghc: panic! (the
'impossible' happened)
(GHC version 7.8.4 for x86_64-unknown-linux):
Loading archives not supported
(ditto 7.8.3)
https://github.com/ghc/ghc/blob/master/compiler/ghci/Linker.hs#L444-L450
https://mail.haskell.org/pipermail/glasgow-haskell-users/2014-October/thread...
Respective versions of GHC are all from hvr's Ubuntu PPA.
These are the versions I have installed:
ghc-7.10.1 install
ghc-7.6.3 install
ghc-7.8.3 install
ghc-7.8.4 install
Afraid I don't know much about linkers or GHC dev so that's I all I can do
for you at this time.
Cheers,
Chris
On Tue, May 12, 2015 at 7:05 PM, aditya siram
Any ideas? -deech
On Sat, May 2, 2015 at 10:24 AM, aditya siram
wrote: Hi all, I have a Haskell library I'd like to load up in GHCI along with a statically linked C library (libblah.a) . Is there any way to do this? My Googling only turns up instructions on loading a shared library (libblah.so).
Thanks! -deech
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

adityah,
if the library is cabalized, do cabal configure
--extra-lib-dirs=$PATHtoArchive and assuming you have the right foreign
import code, things should work fine. (or the equivalient .cabal file extra
lib dirs field with can be a relative path within the package). then cabal
repl should also presumably work. if you then wanna use ghci directly, try
invoking cabal repl with the verbose flag (-v) to see how its setting up
ghci.
if your ffi bindings dont work in cabal repl, thats probably valid a bug
report. (at least on some platforms)
On Sat, May 2, 2015 at 11:24 AM, aditya siram
Hi all, I have a Haskell library I'd like to load up in GHCI along with a statically linked C library (libblah.a) . Is there any way to do this? My Googling only turns up instructions on loading a shared library (libblah.so).
Thanks! -deech
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
participants (3)
-
aditya siram
-
Carter Schonwald
-
Christopher Allen