Hi Ganesh,

 > zlibTest:~/zlib-0.5.4.1$ cabal repl
 > ...
 > Loading object (dynamic) z ... failed.
 > <command line>: user specified .o/.so/.DLL could not be loaded
 > (libz.so: cannot open shared object file: No such file or directory)
 > Whilst trying to load:  (dynamic) z

you are right: the environment variable $NIX_LDFLAGS ensures that GCC
can find libz (and other systems libraries), which is why "cabal
configure" succeeds. But this won't help GHC locate those libraries,
because it doesn't know about that variable. I guess, we could create a
wrapper around cabal-install to remedy that issue.

Anyway, a simple work-around for this problem is to call:

  $ cabal configure ${NIX_LDFLAGS//-L/--extra-lib-dirs=}

Alternatively, you can add appropriate environment variables to the
derivation by means of the extraCmds attribute, i.e. define in
~/.nixpkgs/config.nix:

  {
    packageOverrides = super: let self = super.pkgs; in
    {
      zlibTest = self.myEnvFun {
          name = "zlibTest";
          buildInputs  = with self; [
            stdenv pkgconfig zlib which ghc.ghc763
            haskellPackages.cabalInstall_1_18_0_3
          ];
          extraCmds = ''
            export LD_LIBRARY_PATH+=:${self.zlib}/lib
          '';
      };
    };
  }

Then "cabal configure && cabal repl" should succeed, too.

Best regards,
Peter

_______________________________________________
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to