ghc-pkg:找不到包ghc-7.10.2.20150906

时间:2015-11-24 17:44:18

标签: haskell ghc

我需要公开一个包ghc-7.10.2.20150906。 当我使用" ghc-pkg list"时,我看到:enter image description here

但是当我试图通过sudo ghc-pkg expose ghc-7.10.2.20150906公开ghc-7.10.2.20150906时,我收到一条消息:

  

ghc-pkg:找不到包ghc-7.10.2.20150906

问题是什么?还是有其他方式来揭露它?

Cabal文件:

-- This is the configuration file for the 'cabal' command line tool.

-- The available configuration options are listed below.
-- Some of them have default values listed.

-- Lines (like this one) beginning with '--' are comments.
-- Be careful with spaces and indentation because they are
-- used to indicate layout for nested sections.


remote-repo: hackage.haskell.org:http://hackage.haskell.org/packages/archive
remote-repo-cache: /home/valoisa/.cabal/packages
-- local-repo:
-- logs-dir:
world-file: /home/valoisa/.cabal/world
-- verbose: 1
-- compiler: ghc
-- with-compiler:
-- with-hc-pkg:
-- scratchdir:
-- program-prefix: 
-- program-suffix: 
-- library-vanilla: True
-- library-profiling: False
-- shared:
-- executable-dynamic: False
-- executable-profiling: False
-- optimization: True
-- library-for-ghci: False
-- split-objs: False
-- executable-stripping: True
-- user-install: True
-- package-db:
-- flags:
-- extra-include-dirs:
-- extra-lib-dirs:
extra-prog-path: /home/valoisa/.cabal/bin
-- tests: False
-- library-coverage: False
-- benchmarks: False
-- cabal-lib-version:
-- constraint:
-- preference:
-- solver: choose
-- documentation: False
-- doc-index-file: $datadir/doc/index.html
-- max-backjumps: 2000
-- reorder-goals: False
-- shadow-installed-packages: False
-- strong-flags: False
-- reinstall: False
-- avoid-reinstalls: False
-- force-reinstalls: False
-- upgrade-dependencies: False
-- root-cmd:
-- symlink-bindir:
build-summary: /home/valoisa/.cabal/logs/build.log
-- build-log:
remote-build-reporting: anonymous
-- one-shot: False
jobs: $ncpus
-- username:
-- password:

install-dirs user
  -- prefix: /home/valoisa/.cabal
  -- bindir: $prefix/bin
  -- libdir: $prefix/lib
  -- libsubdir: $arch-$os-$compiler/$pkgid
  -- libexecdir: $prefix/libexec
  -- datadir: $prefix/share
  -- datasubdir: $arch-$os-$compiler/$pkgid
  -- docdir: $datadir/doc/$arch-$os-$compiler/$pkgid
  -- htmldir: $docdir/html
  -- haddockdir: $htmldir
  -- sysconfdir: $prefix/etc

install-dirs global
  -- prefix: /usr/local
  -- bindir: $prefix/bin
  -- libdir: $prefix/lib
  -- libsubdir: $arch-$os-$compiler/$pkgid
  -- libexecdir: $prefix/libexec
  -- datadir: $prefix/share
  -- datasubdir: $arch-$os-$compiler/$pkgid
  -- docdir: $datadir/doc/$arch-$os-$compiler/$pkgid
  -- htmldir: $docdir/html
  -- haddockdir: $htmldir
  -- sysconfdir: $prefix/etc

program-locations 
  -- alex-location:
  -- ar-location:
  -- c2hs-location:
  -- cpphs-location:
  -- ffihugs-location:
  -- gcc-location:
  -- ghc-location:
  -- ghc-pkg-location:
  -- greencard-location:
  -- haddock-location:
  -- happy-location:
  -- hmake-location:
  -- hpc-location:
  -- hsc2hs-location:
  -- hscolour-location:
  -- hugs-location:
  -- jhc-location:
  -- ld-location:
  -- lhc-location:
  -- lhc-pkg-location:
  -- nhc98-location:
  -- pkg-config-location:
  -- ranlib-location:
  -- strip-location:
  -- tar-location:
  -- uhc-location:

program-default-options 
  -- alex-options:
  -- ar-options:
  -- c2hs-options:
  -- cpphs-options:
  -- ffihugs-options:
  -- gcc-options:
  -- ghc-options:
  -- ghc-pkg-options:
  -- greencard-options:
  -- haddock-options:
  -- happy-options:
  -- hmake-options:
  -- hpc-options:
  -- hsc2hs-options:
  -- hscolour-options:
  -- hugs-options:
  -- jhc-options:
  -- ld-options:
  -- lhc-options:
  -- lhc-pkg-options:
  -- nhc98-options:
  -- pkg-config-options:
  -- ranlib-options:
  -- strip-options:
  -- tar-options:
  -- uhc-options:

1 个答案:

答案 0 :(得分:2)

通常,当您编写更大的Haskell项目时,您将指定要在项目特定的Cabal文件中使用的包,这是一个使用"//*[@id='Some_id']/div[1]/table/tbody/tr[@class='even']/td/a[contains(text (), 'Show')]" 包和{base包的极小示例{1}}包,ghc

example.cabal

要在此项目中使用GHC 7.10.3快照,请运行name: example version: 0.1.0.0 build-type: Simple cabal-version: >=1.10 library exposed-modules: AModule build-depends: base >= 4.7 && < 5 , ghc default-language: Haskell2010 ,然后使用cabal configure --with-compiler=PATH/TO/ghc-7.10.3在GHCi会话中使用相关包访问项目。

如果你真的想公开cabal repl包,你的问题似乎是ghc调用不是来自7.10.3快照的ghc-pkg,如行所示

  

标志数据库堆栈:[&#34; /home/valoisa/.ghc/x86_64-linux-7.10.2/package.conf.d",&#34; / usr / local / lib / ghc- 7.10.2 / package.conf.d&#34;]

在您发布的sudo ghc-pkg的{​​{3}}中。

我可以看到两种可能的解决方案

  1. 不要使用sudo ghc-pkg -v2 expose ghc,因为似乎使用了sudo的正确版本(我无法想到在这里使用sudo的任何理由)。
  2. 通过指定程序的完整路径,使用正确的ghc-pkg