为什么 ghc 8.8.4 无法编译 ghci 可以加载的文件?



在安装了haskell平台的Mac OS 10.15.7中,我有一个奇怪的行为。代码在ghci中运行良好,但编译期间的链接不起作用:

% ghc Merge.hs
Loaded package environment from /Users/ar/.ghc/x86_64-darwin-8.8.4/environments/default
[1 of 1] Compiling Main             ( Merge.hs, Merge.o ) [Optimisation flags changed]
Linking Merge ...
ld: can't open output file for writing: Merge, errno=21 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)

但ghci运行良好:

% ghci Merge.hs
GHCi, version 8.8.4: https://www.haskell.org/ghc/  :? for help
Loaded package environment from /Users/ar/.ghc/x86_64-darwin-8.8.4/environments/default
[1 of 1] Compiling Main             ( Merge.hs, interpreted )
Ok, one module loaded.
*Main>

此外,% stack runghc -- Merge工作,但

% stack ghc -- Merge
[1 of 1] Compiling Main             ( Merge.hs, Merge.o ) [Data.Aeson changed]
Linking Merge ...
ld: can't open output file for writing: Merge, errno=21 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)

知道吗?我已经按照中的说明安装了haskell平台https://www.haskell.org/downloads/具有https://www.haskell.org/platform/mac.html(ghcup(。

代码为https://gist.github.com/arademaker/e7ae2e1ef5225807a3e627caa61481da

我在文件夹中有一个同名目录!我的错误。

最新更新