Skip to content

ghci doesn't respect loaded packages' library-dirs

@RyanGlScott reported that packages which are built with cabal and the extra-lib-dirs cannot be loaded under ghci as extra-lib-dirs is not added to the library search path used by the dynamic linker (except on Windows).

Reproducer:

  1. Install OpenJDK 11
  2. Clone https://github.com/RyanGlScott/jimage
  3. Create a cabal.project adding the OpenJDK library directory to extra-lib-dirs:
    $ cd jimage
    $ cat <<EOF >cabal.project.local
    package jimage
      extra-lib-dirs: /nix/store/pd4rnvmvy82irwrlsckp5qbi4rc0rivm-openjdk-11.0.9+11/lib/openjdk/lib
      ld-options: -Wl,-rpath=/nix/store/pd4rnvmvy82irwrlsckp5qbi4rc0rivm-openjdk-11.0.9+11/lib/openjdk/lib
  4. Build: cabal v2-build modules-extraction --write-ghc-environment-files=always
  5. Try starting ghci. You should encounter a linker error
Edited by Ryan Scott
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information