grin-compiler / grin

GRIN is a compiler back-end for lazy and strict functional languages with whole program optimization support.
https://grin-compiler.github.io/
1.03k stars 38 forks source link

Update nix setup #56

Closed luc-tielen closed 4 years ago

luc-tielen commented 4 years ago

This PR continues the work from #22. I used https://github.com/input-output-hk/haskell.nix/ to keep nix in sync with stack. I can get it to build on OSX, but I'm still getting an "stdio.h" not found error when compiling the C files. I think I might need to add another nix overlay for this.

You can test it by doing the following:

$ nix-shell
$ # once inside in the nix-shell you can run your stack commands like you would without nix
csabahruska commented 4 years ago

Is this PR ready or is it work in progress?

luc-tielen commented 4 years ago

@csabahruska oh that's funny, I was about to ask on gitter channel if this could be merged in. It's ready. 😄

luc-tielen commented 4 years ago

Also, it might currently take quite some time to build some dependencies (like GHC), but we could create a cachix instance for grin organization so all build artifacts can be cached (reducing build times of dependencies to simply copying files from remote destination to locally). This can be done in a later PR.

andorp commented 4 years ago

I have encountered with this while building in debian, the suggested --option seems to be fixing my nex issue. https://github.com/NixOS/nix/issues/3142, building the rest of the universe now...

andorp commented 4 years ago

I got this at my debian when stack build/test:

<command line>: can't load .so/.DLL for: /nix/store/6yaj6n8l925xxfbcd65gzqx3dz7idrnn-glibc-2.27/lib/librt.so (/nix/store/6yaj6n8l925xxfbcd65gzqx3dz7idrnn-glibc-2.27/lib/librt.so: symbol __close_nocancel, version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference)

--  While building package grin-0.1.0.0 using:
      /home/andorp/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.5 --builddir=.stack-work/dist/x86_64-linux/Cabal-2.4.0.1 build lib:grin exe:grin test:grin-end-to-end-test test:grin-test --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1

It needs further investigation at my machine, but the nix-shell got activated and the stack build started.

csabahruska commented 4 years ago

did work on Ubuntu 16.04

luc-tielen commented 4 years ago

I tested this on my Macbook with OSX and on my previous Linux laptop with Ubuntu (18.04) and both seemed to compile + run tests, maybe the error is due to the sandboxing option @andorp? Or something different on Debian? How do we proceed with this PR? Can it be merged in?

andorp commented 4 years ago

@luc-tielen : I think this is not a showstopper as it works 75% of the observed cases. I plan the update my dev machine soon, and hopefully the problem will go away.