0

我正在尝试从源代码编译haskell ghc。我尝试从与 /usr/ 不同的文件夹配置我的 cabal 配置。从一开始它总是成功地构建任何包。

在某些时候(安装包 cabal-install 之后),我更改了 cabal 的配置以包含另一个“library-dirs”。然后,发生了一些错误(可能是因为在 cabal 配置中的“library-dirs”字段中插入了错误的字符串)。因此,我尝试再次重新配置我的 cabal 配置文件(我什至删除了配置文件并尝试清理 ghc 包缓存)并注释字段“library-dirs”选项,但它仍然失败。我也已经尝试删除 cabal 包目录(cabal 保存有关包的缓存的目录)。

这是使用“ghc-pkg check”时的输出:

Warning: library-dirs: {stripped} doesn't exist or isn't a directory

这是我使用 cabal 或手动从 Setup.hs 构建包时的输出:

sudo -E  cabal --config-file=/opt/haskell/config/config install hashable -O2  --global --flags="-fllvm" --prefix=/opt/haskell 2>error --upgrade-dependencies --reinstall
Resolving dependencies...
Configuring hashable-1.2.1.0...
Building hashable-1.2.1.0...
Failed to install hashable-1.2.1.0
Last 10 lines of the build log ( /{stripped}/hashable-1.2.1.0.log ):

Data/Hashable/Class.hs:100:15: Warning:
    Literal 15868100553162883236 is out of the Int range -9223372036854775808..9223372036854775807
[2 of 3] Compiling Data.Hashable.Generic ( Data/Hashable/Generic.hs, dist/build/Data/Hashable/Generic.o )

Data/Hashable/Generic.hs:20:1: Warning:
    The import of ‛Bits’ from module ‛Data.Bits’ is redundant
[3 of 3] Compiling Data.Hashable    ( Data/Hashable.hs, dist/build/Data/Hashable.o )
/usr/bin/ld: cannot find  {stripped}: No such file or directory
collect2: error: ld returned 1 exit status

这是 cabal 配置文件:(任何默认值都被剥离)

remote-repo: hackage.haskell.org:http://hackage.haskell.org/packages/archive
remote-repo-cache: /opt/haskell/cabal
world-file: /opt/haskell/cabal/world
extra-prog-path: /opt/haskell/cabal/bin
build-summary: /opt/haskell/cabal/logs/build.log
remote-build-reporting: anonymous
jobs: $ncpus

install-dirs global
  prefix: /opt/haskell/

任何人都可以帮助我或指导我吗?或者至少告诉我 ghc 实际上在哪里保存已卸载软件包的“library-dirs”配置信息?

cabal -V
cabal-install version 1.18.0.2
using version 1.18.1.3 of the Cabal library 

ghc -v
The Glorious Glasgow Haskell Compilation System, version 7.9.20140206

谢谢你。

4

1 回答 1

0

我相信这可能是因为每个包在首次创建时都包含该位置的完整路径。调查。.ghc/YOUR_PLATFORM/package.conf.d(对我来说,它是.ghc/x86_64-darwin-7.6.3/package.conf.d)。您会看到很多.conf文件,每个文件都包含硬编码路径:

[...]
import-dirs: /Users/pejvan/Library/Haskell/ghc-7.6.3/lib/pandoc-types-1.12.3.3/lib
library-dirs: /Users/pejvan/Library/Haskell/ghc-7.6.3/lib/pandoc-types-1.12.3.3/lib
[...]
haddock-interfaces: /Users/pejvan/Library/Haskell/ghc-7.6.3/lib/pandoc-types-1.12.3.3/doc/html/pandoc-types.haddock
haddock-html: /Users/pejvan/Library/Haskell/ghc-7.6.3/lib/pandoc-types-1.12.3.3/doc/html

您可以手动更新文件以使其内容指向正确的位置,也可以编写一个脚本来为您执行此操作。

然后你需要更新 package.cache 文件(可能需要一个 sudo 在这里和那里):

pejvan$ ghc-pkg recache

pejvan$ ghc-pkg recache --user

最后,检查现在是否一切正常: pejvan$ ghc-pkg check

于 2014-06-15T20:13:03.920 回答