Cabal安装会忽略依赖于构建的软件包,然后请求它

时间:2019-01-04 11:00:55

标签: ghc cabal cabal-install

我使用cabal来尝试安装iserv-proxy,它的构建取决于libiserv,而我之前已经安装了它。当我发出安装命令:

ghc/utils/iserv-proxy$ cabal install -flibrary -fproxy

失败,并显示:

src/Main.hs:53:1: error:
Could not load module `Remote.Message'
It is a member of the hidden package `libiserv-8.6.3'.
Perhaps you need to add `libiserv' to the build-depends in your .cabal file.
Use -v to see a list of the files searched for.
   |
53 | import Remote.Message
   | ^^^^^^^^^^^^^^^^^^^^^

如错误所述,Remote.Messageexposed-module中的libiserv,但是libiserv存在于iserv-proxy.cabal文件的生成依赖项中,如下在8.6.3的{​​{1}}版本中:
(只有我将ghc的上级依赖性从containers更改为0.6,这使依赖性冲突。)

0.7

iserv-proxy.cabal

cabal知道. . . Executable iserv-proxy Default-Language: Haskell2010 Main-Is: Main.hs Hs-Source-Dirs: src Build-Depends: array >= 0.5 && < 0.6, base >= 4 && < 5, binary >= 0.7 && < 0.9, bytestring >= 0.10 && < 0.11, containers >= 0.5 && < 0.7, deepseq >= 1.4 && < 1.5, directory >= 1.3 && < 1.4, network >= 2.6, filepath >= 1.4 && < 1.5, ghci == 8.6.*, libiserv == 8.6.* 的安装:

libiserv

$ cabal list --installed libiserv * libiserv Default available version: [ Not available from any configured repository ] Installed versions: 8.6.3 License: BSD-3-Clause ,在详细的安装日志(build-depends)中看来,您可以在pastebin中找到它。

这太奇怪了,我对-vcabal还是陌生的,所以我可能会搞砸。当我查看以上verbose log中的ghc命令时:

ghc

它错过了/opt/ghc/bin/ghc --make -no-link -fbuilding-cabal-package -O -static -outputdir dist/build/iserv-proxy/iserv-proxy-tmp -odir dist/build/iserv-proxy/iserv-proxy-tmp -hidir dist/build/iserv-proxy/iserv-proxy-tmp -stubdir dist/build/iserv-proxy/iserv-proxy-tmp -i -idist/build/iserv-proxy/iserv-proxy-tmp -isrc -idist/build/iserv-proxy/autogen -idist/build/global-autogen -Idist/build/iserv-proxy/autogen -Idist/build/global-autogen -Idist/build/iserv-proxy/iserv-proxy-tmp -optP-include -optPdist/build/iserv-proxy/autogen/cabal_macros.h -hide-all-packages -Wmissing-home-modules -package-db dist/package.conf.inplace -package-id array-0.5.3.0 -package-id base-4.12.0.0 -package-id binary-0.8.6.0 -package-id bytestring-0.10.8.2 -package-id containers-0.6.0.1 -package-id deepseq-1.4.4.0 -package-id directory-1.3.3.0 -package-id filepath-1.4.2.1 -package-id ghci-8.6.3 -package-id libiserv-8.6.3 -package-id network-2.8.0.0-AkCJm1aNSYz7ekXKYyI0pF -XHaskell2010 src/Main.hs 库中的任何-I-include,有趣的是libiserv安装中没有任何libiserv文件或.h目录:

include

我的配置:

$ ls /root/.cabal/lib/x86_64-linux-ghc-8.6.3/libiserv-8.6.3-EjLBkFaay9bH1Xm2bkeUPB/
GHCi  Lib.dyn_hi  Lib.hi  Remote  libHSlibiserv-8.6.3-EjLBkFaay9bH1Xm2bkeUPB.a

我的$ cabal --version cabal-install version 2.4.1.0 compiled using version 2.4.1.0 of the Cabal library $ ghc --version The Glorious Glasgow Haskell Compilation System, version 8.6.3 ghc$ git log -1 Author: Ben Gamari <ben@smart-cactus.org> Date: Thu Dec 6 16:58:34 2018 -0500 Release 8.6.3 返回ghc-pkg checkhaddock-html文档丢失的警告。您可能会在另一个pastebin

中找到完整的输出

更新:

在安装命令中添加haddock-interfaces解决了我的问题,但事实并非如此,因此我打开了这个问题,以寻求更好的解决方案。

1 个答案:

答案 0 :(得分:1)

请注意,libiserv可以构建为带有网络支持的 ,也可以不构建。默认情况下它将不构建。您需要libiserv-fnetwork一起构建才能使其暴露Remote.Message

因此,您可能想要类似的东西:

libiserv $ cabal install -fnetwork
iserv-proxy $ cabal install -flibrary -fproxy