[GHC] #9386: GHCi cannot load .so in ./

GHC ghc-devs at haskell.org
Tue Dec 23 04:19:04 UTC 2014


#9386: GHCi cannot load .so in ./
-------------------------------------+-------------------------------------
              Reporter:  crockeea    |            Owner:
                  Type:  bug         |           Status:  new
              Priority:  normal      |        Milestone:
             Component:  GHCi        |          Version:  7.8.3
            Resolution:              |         Keywords:
      Operating System:              |     Architecture:  Unknown/Multiple
  Unknown/Multiple                   |       Difficulty:  Unknown
       Type of failure:  Other       |       Blocked By:
             Test Case:              |  Related Tickets:
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by rwbarton):

 Actually it's not fixed, it just works for the inplace GHC only, because
 the `inplace/bin/ghc-stage2` sets `LD_LIBRARY_PATH=...:$LD_LIBRARY_PATH`,
 my existing `LD_LIBRARY_PATH` is empty and so GHC's `LD_LIBRARY_PATH` gets
 an empty component at the end, which is interpreted as the current
 directory...

 It's actually not entirely clear what the behavior of `ghci Foo libbar.so`
 ''should'' be; maybe it should search the system library path for
 `libbar.so`, like it does today? But I'm inclined to say not, since you
 could get that behavior with `ghci Foo -lbar` instead.

 The fact that it doesn't work even when you specify `./mylib.so` is
 clearly wrong. I guess the pathname gets normalized before being passed to
 `dlopen`, but I don't yet know where or why.

 I'm inclined to fix it with a hammer by prepending `./` to the `dlopen`
 argument whenever it is a relative pathname (if its argument contains a
 `/` then `dlopen` will treat it is as a pathname and not search the system
 library path).

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9386#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list