Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
422 views
in Technique[技术] by (71.8m points)

haskell - 如何修复hdevtools-“ GHC_PACKAGE_PATH不兼容。”错误(How to fix hdevtools - “GHC_PACKAGE_PATH is incompatible..” error)

I'm a haskell beginner, I use the advent of code as learning examples.

(我是一位Haskell初学者,我使用代码的出现作为学习示例。)

When setting up for this year I reinstalled stack (on a new machine, however copied most dotfiles over) and was starting from my last years notes and was not able to get hdevtools working again.

(在今年设置时,我重新安装了stack(在一台新计算机上,但是复制了大多数dotfiles),并且从上一年的笔记开始,并且无法使hdevtools重新工作。)

I have set up a new project with stack new advent2019 .

(我已经建立了一个新项目,其中包含stack new advent2019 。)

In case it matters stack build on the "empty" project seems to take several minutes - seems much longer than last year.

(以防万一,在“空”项目上stack build似乎需要几分钟-似乎比去年更长。)

I install hdevtools with stack build hdevtools .

(我使用stack build hdevtools安装stack build hdevtools 。)

When I run stack exec hdevtools -- check src/Lib.hs I get following error:

(当我运行stack exec hdevtools -- check src/Lib.hs以下错误:)

Cabal error: hdevtools: Use of GHC's environment variable GHC_PACKAGE_PATH is incompatible
with Cabal. Use the flag --package-db to specify a package database (it can be
used multiple times).

So far I tried:

(到目前为止,我尝试了:)

  • I checked my shell and did an rg --no-ignore over my home directory to confirm GHC_PACKAGE_PATH is not set by me.

    (我检查了我的外壳程序,并在主目录上执行了rg --no-ignore ,以确认我未设置GHC_PACKAGE_PATH 。)

    Also over the project directory.

    (同样在项目目录上。)

  • I was not able to figure out how to use the mentioned --package-db flag - putting it after hdevtools I get an unknown flag error, putting it to stack I get an invalid option .

    (我无法弄清楚如何使用提到的--package-db标志-将其放在hdevtools之后,出现unknown flag错误,将其放入堆栈,得到invalid option 。)

  • stack exec --no-ghc-package-path hdevtools -- check src/Lib.hs - mentioned here

    (stack exec --no-ghc-package-path hdevtools -- check src/Lib.hs 这里提到)

  • I deleted all possible related files: ~/.local/bin/hdevtools , everything from ~/.stack , all ~/.ghc* .

    (我删除了所有可能的相关文件: ~/.local/bin/hdevtools ,所有从~/.stack所有~/.ghc* 。)

None helped with the error.

(没有人帮助解决错误。)

I suppose I overlooked something obvious - however can you help point it out?

(我想我忽略了一些显而易见的事情-但是您能帮忙指出吗?)

For completeness:

(为了完整性:)

  • on OS X, 10.15.1

    (在OS X 10.15.1上)

  • stack --version : Version 1.9.3, Git revision 40cf7b37526b86d1676da82167ea8758a854953b (6211 commits) x86_64 hpack-0.31.1

    (stack --versionVersion 1.9.3, Git revision 40cf7b37526b86d1676da82167ea8758a854953b (6211 commits) x86_64 hpack-0.31.1)

  • stack ghc -- --version : The Glorious Glasgow Haskell Compilation System, version 8.6.5

    (stack ghc -- --version The Glorious Glasgow Haskell Compilation System, version 8.6.5The Glorious Glasgow Haskell Compilation System, version 8.6.5)

  • stack path :

    (stack path :)

stack-root: /Users/me/.stack
project-root: /Users/me/Code/advent2019
config-location: /Users/me/Code/advent2019/stack.yaml
bin-path: /Users/me/.stack/snapshots/x86_64-osx/lts-14.16/8.6.5/bin:/Users/me/.stack/compiler-tools/x86_64-osx/ghc-8.6.5/bin:/Users/me/.stack/programs/x86_64-osx/ghc-8.6.5/bin:/usr/local/texlive/2018basic/bin/x86_64-darwin:/Users/me/.local/bin/:/Users/me/.gem/bin:/Users/me/.yarn/bin:/Users/me/Library/Python/3.7/bin/:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Library/TeX/texbin:.:/Applications/Wireshark.app/Contents/MacOS
programs: /Users/me/.stack/programs/x86_64-osx
compiler-exe: /Users/me/.stack/programs/x86_64-osx/ghc-8.6.5/bin/ghc
compiler-bin: /Users/me/.stack/programs/x86_64-osx/ghc-8.6.5/bin
compiler-tools-bin: /Users/me/.stack/compiler-tools/x86_64-osx/ghc-8.6.5/bin
local-bin: /Users/me/.local/bin
extra-include-dirs: 
extra-library-dirs: 
snapshot-pkg-db: /Users/me/.stack/snapshots/x86_64-osx/lts-14.16/8.6.5/pkgdb
local-pkg-db: /Users/me/Code/advent2019/.stack-work/install/x86_64-osx/lts-14.16/8.6.5/pkgdb
global-pkg-db: /Users/me/.stack/programs/x86_64-osx/ghc-8.6.5/lib/ghc-8.6.5/package.conf.d
ghc-package-path: /Users/me/Code/advent2019/.stack-work/install/x86_64-osx/lts-14.16/8.6.5/pkgdb:/Users/me/.stack/snapshots/x86_64-osx/lts-14.16/8.6.5/pkgdb:/Users/me/.stack/programs/x86_64-osx/ghc-8.6.5/lib/ghc-8.6.5/package.conf.d
snapshot-install-root: /Users/me/.stack/snapshots/x86_64-osx/lts-14.16/8.6.5
local-install-root: /Users/me/Code/advent2019/.stack-work/install/x86_64-osx/lts-14.16/8.6.5
snapshot-doc-root: /Users/me/.stack/snapshots/x86_64-osx/lts-14.16/8.6.5/doc
local-doc-root: /Users/me/Code/advent2019/.stack-work/install/x86_64-osx/lts-14.16/8.6.5/doc
dist-dir: .stack-work/dist/x86_64-osx/Cabal-2.4.0.1
/Users/me/Code/advent2019/.stack-work/install/x86_64-osx/lts-14.16/8.6.5/hpc
local-bin-path: /Users/me/.local/bin
ghc-paths: /Users/me/.stack/programs/x86_64-osx
  ask by bdecaf translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...