ghc.nix icon indicating copy to clipboard operation
ghc.nix copied to clipboard

Fix LD_LIBRARY_PATH issues on NixOS

Open cydparser opened this issue 1 year ago • 2 comments

I'm unable to use direnv with the flake provided by this repo on NixOS due to LD_LIBRARY_PATH being unset initially. Here is the output:

❯ rm -rf .direnv

❯ echo 'use flake -L github:alpmestan/ghc.nix' > .envrc
direnv: error /home/cyd/src/ghc/.envrc is blocked. Run `direnv allow` to approve its content

❯ echo $LD_LIBRARY_PATH


❯ direnv allow
direnv: loading /home/cyd/src/ghc/.envrc
direnv: using flake -L github:alpmestan/ghc.nix
trace: checking if /hadrian/hadrian.cabal is present:  no
[0/1 built] direnv: ([/nix/store/zchzkskbsrcimfslixzhy1mjn7zwxrxa-direnv-2.32.3/bin/direnv export zsh]) is taking a while to execute. Use CTRL-C to give up.
warning: Git tree '/home/cyd/src/ghc' is dirty
direnv: nix-direnv: renewed cache
/nix/store/8ksyipmh68wxmq3qdazkf3bccw786gpr-nix-direnv-2.3.0/share/nix-direnv/direnvrc:2057: LD_LIBRARY_PATH: unbound variable
direnv: error exit status 1

Additionally, LD_LIBRARY_PATH does not include a path to libstdc++, which causes some tests to fail.

cydparser avatar Aug 03 '23 04:08 cydparser

Hey @cydparser ,

Could you please explain a bit which issue you're solving (error messages, etc.)?

supersven avatar Aug 03 '23 08:08 supersven

The reason that direnv fails is due to my config enabling strict_env, which is supposed to be enabled by default at some point.

I've discovered another problem with LD_LIBRARY_PATH: it does not include a path to libstdc++.so.6, which causes tests like T11829 to fail.

cydparser avatar Aug 06 '23 01:08 cydparser