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/

誰でも私を助けたり、案内してくれますか? または、少なくとも、アンインストールされたパッケージの "library-dirs" 構成の情報を ghc が実際に保存している場所を教えてください。

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 に答える