在macOS上构建的堆栈

问题描述 投票:4回答:1

我是haskell的新手。我有最简单的简单程序。

#!/usr/bin/env stack
-- stack --resolver lts-13.7 script

module Main where

import Lib

main :: IO ()
main = putStrLn "Hello World"

它确实适用于stack

 $stack ./Main.hs
Hello World
(base) 19:48:11/app $

但是它在任何其他媒介上都遭受了相当可怕的消亡:

$stack build --test --haddock --no-haddock-hyperlink-source;
Stack has not been tested with GHC versions above 8.6, and using 8.8.3, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail
[1 of 2] Compiling Main             ( /Users/steve/.stack/setup-exe-src/setup-mPHDZzAJ.hs, /Users/steve/.stack/setup-exe-src/setup-mPHDZzAJ.o )
[2 of 2] Compiling StackSetupShim   ( /Users/steve/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /Users/steve/.stack/setup-exe-src/setup-shim-mPHDZzAJ.o )
Linking /Users/steve/.stack/setup-exe-cache/x86_64-osx/tmp-Cabal-simple_mPHDZzAJ_3.0.1.0_ghc-8.8.3 ...
ld64.lld: warning: ignoring unknown argument: --gc-sections
ld64.lld: warning: ignoring unknown argument: -u
(maybe 50 of these ..)
ld64.lld: warning: ignoring unknown argument: -u
ld64.lld: warning: ignoring unknown argument: -search_paths_first
ld64.lld: warning: ignoring unknown argument: -dead_strip_dylibs
ld64.lld: warning: -sdk_version is required when emitting min version load command.  Setting sdk version to match provided min version
Cannot open /Users/steve/.stack/setup-exe-src/setup-mPHDZzAJ.o: bad relocation (Invalid pointer diff) in section __TEXT/__text (r1_address=21c, r1_type=5, r1_extern=1, r1_length=2, r1_pcrel=0, r1_symbolnum=37), (r2_address=21c, r2_type=0, r2_extern=1, r2_length=2, r2_pcrel=0, r2_symbolnum=30)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
`gcc' failed in phase `Linker'. (Exit code: 1)

--  While building simple Setup.hs using:
      /Users/steve/.stack/programs/x86_64-osx/ghc-8.8.3/bin/ghc-8.8.3 -rtsopts -threaded -clear-package-db -global-package-db -hide-all-packages -package base -main-is StackSetupShim.mainOverride -package Cabal-3.0.1.0 /Users/steve/.stack/setup-exe-src/setup-mPHDZzAJ.hs /Users/steve/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs -o /Users/steve/.stack/setup-exe-cache/x86_64-osx/tmp-Cabal-simple_mPHDZzAJ_3.0.1.0_ghc-8.8.3
    Process exited with code: ExitFailure 1

我尝试搜索这些,但没有遇到明显的匹配/解决方案。提示?

更新 haskellstack的安装方式如下:

brew install haskell-stack

另一个更新我试图从haskell platform导航安装。

请求者在左侧字段中不是处于关闭状态,但遵循Haskell platform https://www.haskell.org/platform/]提供的说明>

enter image description here

那里有no

下载链接,所以我们对download ghcup进行了谷歌搜索,将我们引至https://www.haskell.org/ghcup/

然后运行命令

curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh

enter image description here

结果是:

$ curl --proto'= https'--tlsv1.2 -sSfhttps://get-ghcup.haskell.org| sh

这确实正确安装了ghcup

 $ghcup
ghcup 0.0.8
GHC up toolchain installer

USAGE:
    ghcup [FLAGS] <SUBCOMMAND>

[下一行:cabal。谷歌搜索导致我:https://hackage.haskell.org/package/cabal-install

enter image description here

我下载了cabal-install tarball https://hackage.haskell.org/package/cabal-install-3.2.0.0/cabal-install-3.2.0.0.tar.gz

这个人不是那么合作。错误的简短版本是:

ld64.lld: warning: ignoring unknown argument: -u
ld64.lld: warning: ignoring unknown argument: -search_paths_first
ld64.lld: warning: ignoring unknown argument: -dead_strip_dylibs
ld64.lld: warning: -sdk_version is required when emitting min version load command.  Setting sdk version to match provided min version
Cannot open ./Distribution/Compat/Async.o: bad relocation (Invalid pointer diff) in section __TEXT/__text (r1_address=2338, r1_type=5, r1_extern=1, r1_length=3, r1_pcrel=0, r1_symbolnum=243), (r2_address=2338, r2_type=0, r2_extern=1, r2_length=3, r2_pcrel=0, r2_symbolnum=237)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
`gcc' failed in phase `Linker'. (Exit code: 1)

Error during cabal-install bootstrap:
Compiling the Setup script failed.

完整版本的错误是:

$./bootstrap.sh 
mktemp: illegal option -- p
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix 
Using gcc for C compiler. If this is not what you want, set CC.
Using /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld instead.
Checking installed packages for ghc-8.8.3...
deepseq is already installed and the version is ok.
binary is already installed and the version is ok.
time is already installed and the version is ok.
transformers is already installed and the version is ok.
mtl is already installed and the version is ok.
text is already installed and the version is ok.
parsec is already installed and the version is ok.
network-uri-2.6.1.0 will be downloaded and installed.
network-2.7.0.0 will be downloaded and installed.
HTTP-4000.3.12 will be downloaded and installed.
zlib-0.6.2 will be downloaded and installed.
random-1.1 will be downloaded and installed.
stm is already installed and the version is ok.
hashable-1.2.7.0 will be downloaded and installed.
async-2.2.1 will be downloaded and installed.
base16-bytestring-0.1.1.6 will be downloaded and installed.
base64-bytestring-1.0.0.1 will be downloaded and installed.
cryptohash-sha256-0.11.101.0 will be downloaded and installed.
resolv-0.1.1.1 will be downloaded and installed.
mintty-0.1.2 will be downloaded and installed.
echo-0.1.3 will be downloaded and installed.
edit-distance-0.2.2.1 will be downloaded and installed.
ed25519-0.0.5.0 will be downloaded and installed.
tar-0.5.1.0 will be downloaded and installed.
digest-0.0.1.2 will be downloaded and installed.
lukko-0.1.1 will be downloaded and installed.
hackage-security-0.6.0.0 will be downloaded and installed.
Cabal-3.2.0.0 will be downloaded and installed.

Downloading Cabal-3.2.0.0...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  753k    0  753k    0     0  2879k      0 --:--:-- --:--:-- --:--:-- 2888k
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 27320    0 27320    0     0   188k      0 --:--:-- --:--:-- --:--:--  189k
[  1 of 236] Compiling Distribution.Compat.Async ( Distribution/Compat/Async.hs, Distribution/Compat/Async.o )
[  2 of 236] Compiling Distribution.Compat.Binary ( Distribution/Compat/Binary.hs, Distribution/Compat/Binary.o )
[  3 of 236] Compiling Distribution.Compat.Directory ( Distribution/Compat/Directory.hs, Distribution/Compat/Directory.o )
[  4 of 236] Compiling Distribution.Compat.Exception ( Distribution/Compat/Exception.hs, Distribution/Compat/Exception.o )
[  5 of 236] Compiling Distribution.Compat.FilePath ( Distribution/Compat/FilePath.hs, Distribution/Compat/FilePath.o )
[  7 of 236] Compiling Distribution.Compat.Internal.TempFile ( Distribution/Compat/Internal/TempFile.hs, Distribution/Compat/Internal/TempFile.o )

( 200 other compiling lines ..)

[230 of 236] Compiling Distribution.Simple.Configure ( Distribution/Simple/Configure.hs, Distribution/Simple/Configure.o )
[231 of 236] Compiling Distribution.Simple.SrcDist ( Distribution/Simple/SrcDist.hs, Distribution/Simple/SrcDist.o )
[232 of 236] Compiling Distribution.Simple.Build ( Distribution/Simple/Build.hs, Distribution/Simple/Build.o )
[233 of 236] Compiling Distribution.Simple.Haddock ( Distribution/Simple/Haddock.hs, Distribution/Simple/Haddock.o )
[234 of 236] Compiling Distribution.Simple.Doctest ( Distribution/Simple/Doctest.hs, Distribution/Simple/Doctest.o )
[235 of 236] Compiling Distribution.Simple ( Distribution/Simple.hs, Distribution/Simple.o )
[236 of 236] Compiling Main             ( Setup.hs, Setup.o )
Linking Setup ...
ld64.lld: warning: ignoring unknown argument: --gc-sections
ld64.lld: warning: ignoring unknown argument: -u

(80 other similar lines..)

ld64.lld: warning: ignoring unknown argument: -u
ld64.lld: warning: ignoring unknown argument: -u
ld64.lld: warning: ignoring unknown argument: -u
ld64.lld: warning: ignoring unknown argument: -search_paths_first
ld64.lld: warning: ignoring unknown argument: -dead_strip_dylibs
ld64.lld: warning: -sdk_version is required when emitting min version load command.  Setting sdk version to match provided min version
Cannot open ./Distribution/Compat/Async.o: bad relocation (Invalid pointer diff) in section __TEXT/__text (r1_address=2338, r1_type=5, r1_extern=1, r1_length=3, r1_pcrel=0, r1_symbolnum=243), (r2_address=2338, r2_type=0, r2_extern=1, r2_length=3, r2_pcrel=0, r2_symbolnum=237)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
`gcc' failed in phase `Linker'. (Exit code: 1)

Error during cabal-install bootstrap:
Compiling the Setup script failed.

和另一个更新

[来自@bradm的评论,我已经尝试过Haskell Stack http://docs.haskellstack.org/en/stable/README/#how-to-install。同样的错误发生在我的问题开始时。我仔细检查了堆栈是新安装的,并显示了现在的时间戳。它在新的虚拟项目中的堆栈设置上失败,并且具有很长的难看错误(包括Main.o错误重定位上的链接器错误)的相同特征。这是它的核心(与顶部相同):

Cannot open /Users/steve/.stack/setup-exe-src/setup-mPHDZzAJ.o: bad relocation (Invalid pointer diff) in section __TEXT/__text (r1_address=21c, r1_type=5, r1_extern=1, r1_length=2, r1_pcrel=0, r1_symbolnum=37), (r2_address=21c, r2_type=0, r2_extern=1, r2_length=2, r2_pcrel=0, r2_symbolnum=30)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
`gcc' failed in phase `Linker'. (Exit code: 1)

--  While building simple Setup.hs using:
      /Users/steve/.stack/programs/x86_64-osx/ghc-8.8.3/bin/ghc-8.8.3 
     -rtsopts -threaded -clear-package-db -global-package-db -hide-all-packages -package base -main-is StackSetupShim.mainOverride -package Cabal-3.0.1.0 /Users/steve/.stack/setup-exe-src/setup-mPHDZzAJ.hs /Users/steve/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs -o /Users/steve/.stack/setup-exe-cache/x86_64-osx/tmp-Cabal-simple_mPHDZzAJ_3.0.1.0_ghc-8.8.3
    Process exited with code: ExitFailure 1

我是Haskell的新手。我有最简单的简单程序。 #!/ usr / bin / env堆栈-堆栈--resolver lts-13.7脚本模块Main导入Lib main main :: IO()main = putStrLn“ Hello World” It ...

haskell haskell-stack
1个回答
0
投票
我刚刚发现了这个已知的错误:https://github.com/commercialhaskell/stack/issues/4373
© www.soinside.com 2019 - 2024. All rights reserved.