首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何改变ghc-pkg中的库-dirs

如何改变ghc-pkg中的库-dirs
EN

Stack Overflow用户
提问于 2014-02-08 06:33:42
回答 1查看 1K关注 0票数 0

我试着从源头上编译haskell ghc。我尝试从/usr/以外的不同文件夹配置我的阴谋配置。从一开始,它总是成功地构建任何包。

在某个时候(在安装了包阴谋安装之后),我改变了我的配置,以包含另一个“库-脏”。然后,会发生一些错误(可能是因为将错误的字符串插入到阴谋配置中的字段"library-dirs“中)。因此,我再次尝试重新配置我的cabal配置文件(我甚至删除了配置文件并尝试清理ghc包缓存)和注释字段"library-dirs“选项,但仍然失败。我还尝试删除了cabal目录(一个目录,在这个目录中,cabal保存有关包的缓存)。

这是使用“ghc检查”时的输出:

代码语言:javascript
复制
Warning: library-dirs: {stripped} doesn't exist or isn't a directory

现在,当我使用Setup.hs构建包或手动构建包时,这就是输出:

代码语言:javascript
复制
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

这是一个阴谋配置文件:(任何默认值都会被删除)

代码语言:javascript
复制
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到底在哪里为卸载的包保存“库-dirs”配置的信息?

代码语言:javascript
复制
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

谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-06-15 20:13:03

我认为这可能是因为每个包都包含第一次创建时到达位置的完整路径。调查一下。.ghc/YOUR_PLATFORM/package.conf.d(对我来说,是.ghc/x86_64-darwin-7.6.3/package.conf.d)。您将看到许多.conf文件,每个文件都包含硬编码路径:

代码语言:javascript
复制
[...]
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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21642861

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档