It's a common error in Stack+Nix:
$ stack build
....
Process exited with code: ExitFailure 127
Logs have been written to: /home/netsu/.zsh/antigen-hs/.stack-work/logs/text-1.2.1.3.log
/home/netsu/.stack/setup-exe-cache/setup-Simple-Cabal-1.22.4.0-x86_64-linux-ghc-7.10.2: error while loading shared libraries: libgmp.so.10: cannot open shared object file: No such file or directory
This really comes from the fact that Stack fails to compile setup-Simple-Cabal-1.22.4.0-x86_64-linux-ghc-7.10.2 correctly with Nix:
$ ldd /home/ielectric/.stack/setup-exe-cache/x86_64-linux-nix/setup-Simple-Cabal-1.24.0.0-ghc-8.0.1
linux-vdso.so.1 (0x00007fffb63df000)
librt.so.1 => /nix/store/jm1n87rp8vr90j9ahcrfzr57nc2r8vgf-glibc-2.24/lib/librt.so.1 (0x00007f0375647000)
libutil.so.1 => /nix/store/jm1n87rp8vr90j9ahcrfzr57nc2r8vgf-glibc-2.24/lib/libutil.so.1 (0x00007f0375444000)
libdl.so.2 => /nix/store/jm1n87rp8vr90j9ahcrfzr57nc2r8vgf-glibc-2.24/lib/libdl.so.2 (0x00007f0375240000)
libgmp.so.10 => not found
libm.so.6 => /nix/store/jm1n87rp8vr90j9ahcrfzr57nc2r8vgf-glibc-2.24/lib/libm.so.6 (0x00007f0374f3b000)
libc.so.6 => /nix/store/jm1n87rp8vr90j9ahcrfzr57nc2r8vgf-glibc-2.24/lib/libc.so.6 (0x00007f0374b9d000)
libpthread.so.0 => /nix/store/jm1n87rp8vr90j9ahcrfzr57nc2r8vgf-glibc-2.24/lib/libpthread.so.0 (0x00007f0374980000)
/nix/store/jm1n87rp8vr90j9ahcrfzr57nc2r8vgf-glibc-2.24/lib/ld-linux-x86-64.so.2 (0x00007f037584f000)
I just encountered this on a client project. There, the error message was worse there for some reason, it did not even mention libgmp.so.10.
/home/username/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_2.0.1.0_ghc-8.2.2: streamingProcess: runInteractiveProcess: exec: does not exist (No such file or directory)
@domenkozar I'm not sure if this is a stack issue, it is making a very straightforward invocation of ghc to build this. What should it do differently?
It took me a while to figure out why I was getting "does not exist" even when running the binary with bash. I think it would be nice to do the following:
When simple Setup or custom Setup get built, first sanity check them with --version.
If the sanity check fails, perhaps run ldd (if that exists), and check for "=> not found". If that is found in the output, then perhaps give the user some tips on resolving it.
Hi,
I just had the same problem. I worked around it by specifying gmp as a nix extra package in the stack.yml file:
[...]
nix:
enable: true
packages: [gmp]
It may be useful to somebody else ;)
I haven't tested this, but as per above comment following should work: https://github.com/commercialhaskell/stack/pull/3971
Most helpful comment
Hi,
I just had the same problem. I worked around it by specifying gmp as a nix extra package in the stack.yml file:
It may be useful to somebody else ;)