Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nix: stack should compile setup-Simple-Cabal with libgmp #2944

Closed
domenkozar opened this issue Jan 21, 2017 · 3 comments
Closed

Nix: stack should compile setup-Simple-Cabal with libgmp #2944

domenkozar opened this issue Jan 21, 2017 · 3 comments

Comments

@domenkozar
Copy link
Contributor

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)
@mgsloan
Copy link
Contributor

mgsloan commented Mar 20, 2018

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:

  1. When simple Setup or custom Setup get built, first sanity check them with --version.

  2. 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.

@picnoir
Copy link

picnoir commented Apr 8, 2018

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 ;)

@domenkozar
Copy link
Contributor Author

I haven't tested this, but as per above comment following should work: #3971

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants