使用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.Message
是libiserv
中的exposed-module
,但libiserv
存在于依赖于iserv-proxy.cabal
文件的构建中,就像ghc
的8.6.3
版本中一样:
(只有我将containers
的上依赖从0.6
更改为0.7
,这导致了依赖冲突。)
iserv-proxy.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
,正如在详细的安装日志(-v
)中所示,您可能会在这里的pastebin中找到它。
它太可怕了,我对cabal
和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 check
为丢失的haddock-html
和haddock-interfaces
文档返回了几个警告。你可以在另一个粘贴仓中找到完整的输出
更新:
在install命令中添加--ghc-options="-i../../libraries/libiserv/src/"
解决了我的问题,但不应该是这样,所以我打开了这个问题,寻找更好的解决方案。
请注意,libiserv
可以在支持网络的情况下构建,也可以不支持。默认情况下,它将在没有的情况下生成。您需要使用-fnetwork
构建libiserv
,以便它公开Remote.Message
。
因此,你可能想要这样的东西:
libiserv $ cabal install -fnetwork
iserv-proxy $ cabal install -flibrary -fproxy