
Replying to [comment:3 rwbarton]:
Isn't this another consequence of the fix for #8935 (opening shared
#10442: Loading of shared libraries is problematic in ghc 7.10.1 -------------------------------------+------------------------------------- Reporter: artella.coding | Owner: Type: bug | Status: new Priority: high | Milestone: 7.10.2 Component: Compiler | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 Type of failure: Runtime crash | (amd64) Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by artella.coding): Replying to [comment:5 trommler]: libraries with RTLD_LOCAL)?
Yes it is.
So should we also link temporary object files against any libraries specified on the ghc(i) command line with `-lfoo`?
Building libtest.so like so {{{ gcc -shared -o libMy.so mylib.o -L. -l test -Wl,-rpath=. }}}
should fix the problem with `cabal repl`. I tried it with openSUSE's ghc 7.8.4 that has the fix for #8935 included.
Hi thanks a lot, your solution works in ghc 7.10.1. But another problem persists. If I now reorganise such that the shared libraries are created in a subdirectory `libDir`, then I get an error upon a `cabal run`. That is if I compile via : {{{ gcc -shared -o libDir/libtest.so test.c gcc -fPIC -c mylib.c -o mylib.o gcc -shared -o libDir/libMy.so mylib.o -L./libDir -l test -Wl,-rpath=./libDir }}} this creates the following shared libraries : {{{ libDir/libMy.so libDir/libtest.so }}} Then if I modify the cabal file to be : {{{ name: illustrate version: 0.1.0.0 build-type: Simple cabal-version: >=1.10 executable illustrate main-is: Main.hs build-depends: base >=4.8 && <4.9 default-language: Haskell2010 extra-libraries: test My extra-lib-dirs: ./libDir }}} then `cabal repl` works fine, but `cabal run` gives the following error : {{{ cabal run Preprocessing executable 'illustrate' for illustrate-0.1.0.0... [1 of 1] Compiling Main ( Main.hs, dist/build/illustrate /illustrate-tmp/Main.o ) Linking dist/build/illustrate/illustrate ... Running illustrate... /home/linux/Downloads/illustrate_withDir/dist/build/illustrate/illustrate: error while loading shared libraries: libtest.so: cannot open shared object file: No such file or directory }}} Why is this happening? Should I close this trac and post the problem above as a new Trac? Thanks -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10442#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler