我无法让haskell的堆栈在我的Mac上运行。
我安装了haskell:
brew cask install haskell-platform
这里指定了:https://www.haskell.org/platform/mac.html#osx-homebrewcask
我也尝试通过可下载的软件包安装在同一个站点上。
我执行以下命令:
stack new my-project
cd my-project
stack setup
stack build
stack exec my-project-exe
根据这里的文件: https://docs.haskellstack.org/en/stable/README/#quick-start-guide
我立即看到了这个:
[1] 43017 killed stack exec my-project-exe
我还尝试过许多安装haskell的方法。我实际上只能使用cabal
来编译和执行某些内容,但我无法让hlint
,hindent
或ghc-mod
工作,它们都是返回与上面相似的消息。我希望能够在我的Mac上使用IntelliJ中的HaskForce,但我从来没有运气让haskell工作。
以下是发生的事情的GIF:https://imgur.com/gallery/afYym7m
我吹走了所有与ghc,stack和cabal相关的东西,然后以这种方式安装 https://haskell-lang.org/get-started
编写小HelloWorld.hs脚本工作正常并显示Hello, World
然而,做
stack new someproj
cd someproj
stack build
导致:
➜ someproj stack build
[1 of 2] Compiling Main ( /Users/trevord2/.stack/setup-exe-src/setup-mPHDZzAJ.hs, /Users/trevord2/.stack/setup-exe-src/setup-mPHDZzAJ.o )
[2 of 2] Compiling StackSetupShim ( /Users/trevord2/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /Users/trevord2/.stack/setup-exe-src/setup-shim-mPHDZzAJ.o )
Linking /Users/trevord2/.stack/setup-exe-cache/x86_64-osx/tmp-Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 ...
someproj-0.1.0.0: configure (lib + exe)
Configuring someproj-0.1.0.0...
someproj-0.1.0.0: build (lib + exe)
Preprocessing library someproj-0.1.0.0...
[1 of 1] Compiling Lib ( src/Lib.hs, .stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/Lib.o )
Preprocessing executable 'someproj-exe' for someproj-0.1.0.0...
[1 of 1] Compiling Main ( app/Main.hs, .stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/someproj-exe/someproj-exe-tmp/Main.o )
Linking .stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/someproj-exe/someproj-exe ...
ld: warning: ignoring file /Users/trevord2/someproj/.stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/libHSsomeproj-0.1.0.0-6corWoTDCA69pE1sqNF8Id.a, file was built for archive which is not the architecture being linked (x86_64): /Users/trevord2/someproj/.stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/libHSsomeproj-0.1.0.0-6corWoTDCA69pE1sqNF8Id.a
Undefined symbols for architecture x86_64:
"_someprojzm0zi1zi0zi0zm6corWoTDCA69pE1sqNF8Id_Lib_someFunc1_closure", referenced from:
_Main_main1_info in Main.o
_S39Z_srt in Main.o
"_someprojzm0zi1zi0zi0zm6corWoTDCA69pE1sqNF8Id_Lib_someFunc1_info", referenced from:
_Main_main_info in Main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
`gcc' failed in phase `Linker'. (Exit code: 1)
-- While building package someproj-0.1.0.0 using:
/Users/trevord2/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-osx/Cabal-1.24.2.0 build lib:someproj exe:someproj-exe --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
我之前见过的,实际上是我最初的问题之一
问题在于:https://github.com/commercialhaskell/stack/issues/3487
在与#haskell IRC上的人交谈之后,他们建议我创建一个问题,因为这是我所理解的非常特殊的行为。我会尽量确保我们在这里发现的东西也被推到那里。