Opened 2 years ago

Closed 2 years ago

#5709 closed bug (fixed)

ghc-7.2 cannot find libraries in non-standard locations

Reported by: kosmikus Owned by:
Priority: normal Milestone: 7.4.1
Component: Package system Version: 7.2.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Other Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

The following is what I perceive to be a regression from ghc-7.0.4 to ghc-7.2.1 and ghc-7.2.2.

On NixOS, all packages are installed into separate directories in the Nix store. With ghc-7.0.4, the following works:

$ ghc -package zlib -e "print ()"
()
$ ghc-pkg describe zlib | grep library-dirs -A 1
library-dirs: /nix/store/vnflri0w0fadiqwv1j6w6gxw00paav6a-haskell-zlib-ghc7.0.4-0.5.3.1-profiling/lib/zlib-0.5.3.1/ghc-7.0.4
              /nix/store/0jmzlnayh2p06vlgmiiyaj3xppc6l9lr-zlib-1.2.5/lib
$ strace ghc -package zlib -e "print ()" 2>&1 | grep libz.so
stat64("/nix/store/vnflri0w0fadiqwv1j6w6gxw00paav6a-haskell-zlib-ghc7.0.4-0.5.3.1-profiling/lib/zlib-0.5.3.1/ghc-7.0.4/libz.so", 0xb5e94490) = -1 ENOENT (No such file or directory)
stat64("/nix/store/0jmzlnayh2p06vlgmiiyaj3xppc6l9lr-zlib-1.2.5/lib/libz.so", {st_mode=S_IFREG|0555, st_size=91092, ...}) = 0
open("/nix/store/0jmzlnayh2p06vlgmiiyaj3xppc6l9lr-zlib-1.2.5/lib/libz.so", O_RDONLY) = 7

However, if I try exactly the same with ghc-7.2.1, I get:

$ ghc -package zlib -e "print ()"
<command line>: can't load .so/.DLL for: libz.so (libz.so: cannot open shared object file: No such file or directory)
$ ghc-pkg describe zlib | grep library-dirs -A 1
library-dirs: /nix/store/6zjd86g35dpxl5r6zrr67nnmf00qalkr-haskell-zlib-ghc7.2.1-0.5.3.1-profiling/lib/zlib-0.5.3.1/ghc-7.2.1
              /nix/store/0jmzlnayh2p06vlgmiiyaj3xppc6l9lr-zlib-1.2.5/lib
$ strace ghc -package zlib -e "print ()" 2>&1 | grep libz.so
open("/nix/store/ri2nlzb1lsi0d1y7nb8dkhzhsnyd08k4-gmp-4.3.2/lib/libz.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/nix/store/nmliqd429c0s4sdlbk0394zdfx86gvf9-ncurses-5.7/lib/libz.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/nix/store/m9p1r0p6qlaw5wy5hnwpii323la3s8j3-glibc-2.12.2/lib/libz.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/nix/store/m9p1r0p6qlaw5wy5hnwpii323la3s8j3-glibc-2.12.2/lib/libz.so", O_RDONLY) = -1 ENOENT (No such file or directory)

The directories listed by strace seem to be the ones used for building GHC itself. The directories in the package configuration file seem to be ignored.

Change History (1)

comment:1 Changed 2 years ago by simonmar

  • Difficulty set to Unknown
  • Milestone set to 7.4.1
  • Resolution set to fixed
  • Status changed from new to closed

I'm not quite sure how this broke in 7.2, but it is fixed in 7.4 and we have a test for it (ghcilink005).

Note: See TracTickets for help on using tickets.