A)我正在尝试在NixOS(channels / nixos-18.03)上使用Stack,ii)创建一个Haskell项目。遵循用户指南中的HelloWorld example来构建项目时,出现错误ghc-cabal: No such file or directory
。
$ stack new helloworld new-template
$ cd helloworld
$ sudo stack build
...
Running /run/current-system/sw/bin/make install in directory /root/.stack/programs/x86_64-linux/ghc-8.6.4.temp/ghc-8.6.4/ exited with ExitFailure 2
...
utils/ghc-cabal/dist-install/build/tmp/ghc-cabal-bindist: line 3: /root/.stack/programs/x86_64-linux/ghc-8.6.4.temp/ghc-8.6.4/utils/ghc-cabal/dist-install/build/tmp/ghc-cabal: No such file or directory
make[1]: *** [ghc.mk:990: install_packages] Error 127
make: *** [Makefile:51: install] Error 2
Error: Error encountered while installing GHC with
make install
run in /root/.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:
- /root/.stack/programs/x86_64-linux/ghc-8.6.4.temp/
- /root/.stack/programs/x86_64-linux/ghc-8.6.4/
B),我已经迭代建立了/etc/nixos/configuration.nix
文件,如下所示。并且在结果系统中,实际上没有ghc-cabal
二进制文件。有cabal
,但没有ghc-cabal
。
environment.systemPackages = with pkgs; [
wget vim emacs
pkgs.firefoxWrapper pkgs.chromium
stack
haskellPackages.ghc
haskellPackages.cabal-install
haskellPackages.cabal2nix
haskellPackages.hdevtools
tree gnumake which binutils gcc clang coreutils gnutar
tmux silver-searcher gitAndTools.gitFull
];
C),我还按照Stack的Nix Integration部分中的步骤进行操作。但无济于事。
什么软件包安装了ghc-cabal
? stack
和haskellPackages.cabal-install
之间是否不匹配?我想念什么?
编辑
我做了一些挖掘,发现了一些有用的资源。 尤其是this article指出我的问题可能是由于无法解决的动态库引起的。
实际上是在查询加载的库中的二进制文件时,得到以下结果。
$ ldd ~/.stack/programs/x86_64-linux/ghc-8.6.4.temp/ghc-8.6.4/utils/ghc-cabal/dist-install/build/tmp/ghc-cabal
linux-vdso.so.1 (0x00007fff0ab01000)
libm.so.6 => /nix/store/681354n3k44r8z90m35hm8945vsp95h1-glibc-2.27/lib/libm.so.6 (0x00007fe82c07f000)
libHSCabal-2.4.0.1-ghc8.6.4.so => not found
libHSprocess-1.6.5.0-ghc8.6.4.so => not found
libHSpretty-1.1.3.6-ghc8.6.4.so => not found
libHSparsec-3.1.13.0-ghc8.6.4.so => not found
libHStext-1.2.3.1-ghc8.6.4.so => not found
libHSmtl-2.2.2-ghc8.6.4.so => not found
libHStransformers-0.5.6.2-ghc8.6.4.so => not found
libHSdirectory-1.3.3.0-ghc8.6.4.so => not found
libHSunix-2.7.2.2-ghc8.6.4.so => not found
libHStime-1.8.0.2-ghc8.6.4.so => not found
libHSfilepath-1.4.2.1-ghc8.6.4.so => not found
libHSbinary-0.8.6.0-ghc8.6.4.so => not found
libHScontainers-0.6.0.1-ghc8.6.4.so => not found
libHSbytestring-0.10.8.2-ghc8.6.4.so => not found
libHSdeepseq-1.4.4.0-ghc8.6.4.so => not found
libHSarray-0.5.3.0-ghc8.6.4.so => not found
libHSbase-4.12.0.0-ghc8.6.4.so => not found
libHSinteger-gmp-1.0.2.0-ghc8.6.4.so => not found
libHSghc-prim-0.5.3-ghc8.6.4.so => not found
libHSrts-ghc8.6.4.so => not found
libffi.so.7 => not found
librt.so.1 => /nix/store/681354n3k44r8z90m35hm8945vsp95h1-glibc-2.27/lib/librt.so.1 (0x00007fe82c06d000)
libutil.so.1 => /nix/store/681354n3k44r8z90m35hm8945vsp95h1-glibc-2.27/lib/libutil.so.1 (0x00007fe82c068000)
libdl.so.2 => /nix/store/681354n3k44r8z90m35hm8945vsp95h1-glibc-2.27/lib/libdl.so.2 (0x00007fe82c063000)
libpthread.so.0 => /nix/store/681354n3k44r8z90m35hm8945vsp95h1-glibc-2.27/lib/libpthread.so.0 (0x00007fe82c042000)
libgmp.so.10 => not found
libc.so.6 => /nix/store/681354n3k44r8z90m35hm8945vsp95h1-glibc-2.27/lib/libc.so.6 (0x00007fe82be8a000)
/lib64/ld-linux-x86-64.so.2 => /nix/store/681354n3k44r8z90m35hm8945vsp95h1-glibc-2.27/lib64/ld-linux-x86-64.so.2 (0x00007fe82c219000)
我尝试通过将haskellPackages.stdio
和haskellPackages.stdf
添加到configuration.nix来解决丢失的库。但是由此产生了更多上游错误(例如:我不能将aeson添加为environment.systemPackages
依赖项)。所以我还没有找到合适的组合。
CallStack (from HasCallStack):
die', called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:950:20 in Cabal-2.4.0.1:Distribution.Simple.Configure
configureFinalizedPackage, called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:460:12 in Cabal-2.4.0.1:Distribution.Simple.Configure
configure, called at libraries/Cabal/Cabal/Distribution/Simple.hs:596:20 in Cabal-2.4.0.1:Distribution.Simple
confHook, called at libraries/Cabal/Cabal/Distribution/Simple/UserHooks.hs:67:5 in Cabal-2.4.0.1:Distribution.Simple.UserHooks
configureAction, called at libraries/Cabal/Cabal/Distribution/Simple.hs:178:19 in Cabal-2.4.0.1:Distribution.Simple
defaultMainHelper, called at libraries/Cabal/Cabal/Distribution/Simple.hs:115:27 in Cabal-2.4.0.1:Distribution.Simple
defaultMain, called at Setup.hs:2:8 in main:Main
Setup: Encountered missing dependencies:
aeson ==0.8.*, base ==4.7.*, binary ==0.7.*, text ==1.1.*
答案 0 :(得分:0)
ghc-cabal is an artifact in ghc's build, included in ghc binary distributions:
$ ls -l ~/.stack/programs/x86_64-linux/ghc-tinfo6-8.6.3.tar.xz
-rw-rw-r--. 1 user group 182356948 Dec 25 15:11 ghc-tinfo6-8.6.3.tar.xz
$ tar tvf ~/.stack/programs/x86_64-linux/ghc-tinfo6-8.6.3.tar.xz | grep tmp/ghc-cabal
-rwxr-xr-x ghc/ghc 225936 2018-12-08 00:03 ghc-8.6.3/utils/ghc-cabal/dist-install/build/tmp/ghc-cabal
-rwxr-xr-x ghc/ghc 858 2018-12-08 00:03 ghc-8.6.3/utils/ghc-cabal/dist-install/build/tmp/ghc-cabal-bindist
答案 1 :(得分:0)
因此,我在commercialhaskell/stack
问题Kirill Zaborsky中借助thread解决了这个问题。错误的原因(在stack new
和stack build
中)是旧的Stack版本。具体来说,我的本地用户的堆栈(1.6.5
)比根(1.9.3
)还旧。
版本1.6.5使用Cabal-2.0
,此后Cabal
(例如base-noprelude
)引入了新功能,使用了领先的逗号,该逗号在haskell/cabal#4953中随版本2.2一起实现。 。因此,Stack无法使用新的格式功能解析阴谋文件。
有关详细信息,请参见commercialhaskell/stack
问题thread。升级本地用户的堆栈(nix-env --upgrade stack
)可以解决此问题。