I was reading some tutorial about Nix and tried installing gcc.
After that when I start working on my haskell project with stack test
I got this.
discordia> build (lib + test)
Preprocessing library for discordia-0.0.0..
Building library for discordia-0.0.0..
/usr/bin/ld.gold: error: cannot open crti.o: No such file or directory
/usr/bin/ld.gold: error: cannot open crtn.o: No such file or directory
/usr/bin/ld.gold: error: cannot find -lgcc_s
/usr/bin/ld.gold: error: cannot find -lgcc_s
collect2: error: ld returned 1 exit status
`gcc' failed in phase `Linker'. (Exit code: 1)
-- While building package discordia-0.0.0 using:
/home/wh/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.4 --builddir=.stack-work/dist/x86_64-linux/Cabal-2.4.0.1 build lib:discordia test:discordia-test-suite --ghc-options " -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
Progress 1/2
Then I tried stack setup--reinstall
and get this erro.
Preparing to install GHC to an isolated location.
This will not interfere with any system-level installation.
Already downloaded.
configure: error: in `/home/wh/.stack/programs/x86_64-linux/ghc-8.6.4.temp/ghc-8.6.4':
configure: error: C compiler cannot create executables
See `config.log' for more details
Received ExitFailure 77 when running
Raw command: /home/wh/.stack/programs/x86_64-linux/ghc-8.6.4.temp/ghc-8.6.4/configure --prefix=/home/wh/.stack/programs/x86_64-linux/ghc-8.6.4/
Run from: /home/wh/.stack/programs/x86_64-linux/ghc-8.6.4.temp/ghc-8.6.4/
Error: Error encountered while configuring GHC with
/home/wh/.stack/programs/x86_64-linux/ghc-8.6.4.temp/ghc-8.6.4/configure --prefix=/home/wh/.stack/programs/x86_64-linux/ghc-8.6.4/
run in /home/wh/.stack/programs/x86_64-linux/ghc-8.6.4.temp/ghc-8.6.4/
The following directories may now contain files, but won't be used by stack:
- /home/wh/.stack/programs/x86_64-linux/ghc-8.6.4.temp/
- /home/wh/.stack/programs/x86_64-linux/ghc-8.6.4/
For more information consider rerunning with --verbose flag
Configuring GHC ...
I solved this by uninstall gcc in Nix nix-env -e gcc
, it seems like the gcc in nix store doesn't have the permission to create some link. However, this is still a confusing problem. What if I want to use the gcc in nix store !?