问题描述
在装有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)
有什么主意吗?我已经按照https://www.haskell.org/downloads/和https://www.haskell.org/platform/mac.html(ghcup)中的说明安装了haskell平台。
代码为https://gist.github.com/arademaker/e7ae2e1ef5225807a3e627caa61481da
解决方法
我在文件夹中有一个同名目录!我的错。