ghc 找不到我的 cabal 安装的软件包

发布于 2024-10-11 18:07:23 字数 870 浏览 4 评论 0原文

我安装了 ghc 6.12.3,然后安装了 Haskell Platform。我正在尝试编译一个测试程序:

$ ghc test.hs
test.hs:3:0:
    Failed to load interface for `Bindings':
      Use -v to see a list of the files searched for.

所以,自然地,我做

cabal install Bindings

的工作正常,并将包放在 ~/.cabal/lib/bindings-0.1.2 问题是,当我用 ghc 再次编译时,它仍然没有找到我用 cabal 安装的包。 在详细模式下编译给出:

ghc -v test.hs
Using binary package database: /home/ludflu/ghc/lib/ghc-6.12.3/package.conf.d/package.cache
Using binary package database: /home/ludflu/.ghc/x86_64-linux 6.12.3/package.conf.d/package.cache

正如另一个 stackoverflow 用户所建议的,我尝试过:

ghc-pkg describe rts > rts.pkg
vi rts.pkg                      # add the /home/ludflu/.cabal/lib to `library-dirs` field
ghc-pkg update rts.pkg

但无济于事。如何将 .cabal 添加到要搜索的包目录列表中? 谢谢你!

I've installed ghc 6.12.3, and then the Haskell Platform. I'm trying to compile a test program:

$ ghc test.hs
test.hs:3:0:
    Failed to load interface for `Bindings':
      Use -v to see a list of the files searched for.

so, naturally, I do

cabal install Bindings

Which works fine, and places the package in ~/.cabal/lib/bindings-0.1.2 The problem is, that when I go to compile again with ghc, it still doesn't find the package I've installed with cabal.
compiling in verbose mode gives:

ghc -v test.hs
Using binary package database: /home/ludflu/ghc/lib/ghc-6.12.3/package.conf.d/package.cache
Using binary package database: /home/ludflu/.ghc/x86_64-linux 6.12.3/package.conf.d/package.cache

As suggested by another stackoverflow user, I tried:

ghc-pkg describe rts > rts.pkg
vi rts.pkg                      # add the /home/ludflu/.cabal/lib to `library-dirs` field
ghc-pkg update rts.pkg

But to no avail. How to I add the .cabal to the list of package directories to search?
Thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

很酷不放纵 2024-10-18 18:07:23

您可以使用 ghc-pkg list 检查安装了哪些软件包。您可能需要使用 -package 将软件包指定为 ghc ,或者我相信添加 --make 将触发对依赖项(包括包)的追踪。

编辑:绑定包确实已过时,请参阅黑客页面< /a>.这不是包管理问题,唯一可用的模块是 Bindings.Deprecated,您完全可以加载它,即使它是一个空模块。我相信相关部分已分解为 bindings-,因此如果您需要绑定功能,您应该查看这些包。

You can check which packages are installed with ghc-pkg list. It may be that you need to either specify the packages to ghc with -package <pkgname> or I believe adding --make to will trigger a chasing down of dependencies, including packages.

Edit: the bindings package is obsolete indeed, see the hackage page. This isn't a package management problem, the only module available is Bindings.Deprecated, which you are perfectly able to load, even though it is an empty module. I believe the relevant parts have been broken out into bindings-<module>, so if you want the bindings functionality you should look to those packages.

南冥有猫 2024-10-18 18:07:23

http://www.haskell.org/haskellwiki/Cabal-install

一件事是特别要注意的是,cabal 默认情况下在本地安装软件包,而

runhaskell Setup configure
runhaskell Setup build
runhaskell Setup install

默认情况下命令全局安装。如果全局安装软件包,则本地软件包将被忽略。 cabal-install 的默认设置可以通过编辑配置文件来修改。

我在使用 runhaskell 命令时遇到了同样的错误。我在包含 .cabal 文件的目录中使用了 cabal,并且能够解决该错误。

http://www.haskell.org/haskellwiki/Cabal-install

One thing to be especially aware of, is that the packages are installed locally by default by cabal, whereas the commands

runhaskell Setup configure
runhaskell Setup build
runhaskell Setup install

install globally by default. If you install a package globally, the local packages are ignored. The default for cabal-install can be modified by editing the configuration file.

I was getting the same error with the runhaskell command. I used the cabal in the directory that had the .cabal file and was able to resolve the error.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文