微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

不能`cabal install doctest`

如何解决不能`cabal install doctest`

我在尝试安装 cabal 软件包 doctest(以及其他一些软件包)时遇到构建错误

我使用 Intel x86-64 芯片在 11.1 版上运行 MacOS。

如果有人能帮助我找出此构建失败的原因,我将不胜感激。我无法在 Internet 上找到有关此错误的任何信息。非常矛盾的警告说 building for macOS-x86_64 but attempting to link with file built for macOS-x86_64 使我最困惑。

完整的构建日志如下:

[Zack:...OMP1130/labs/comp1100-lab03]$ cabal v2-install doctest
Resolving dependencies...
Build profile: -w ghc-8.6.5 -O1
In order,the following will be built (use -v for more details):
 - doctest-0.18.1 (exe:doctest) (requires build)
Starting     doctest-0.18.1 (exe:doctest)
Building     doctest-0.18.1 (exe:doctest)

Failed to build exe:doctest from doctest-0.18.1.
Build log ( /Users/Zack/.cabal/logs/ghc-8.6.5/dctst-0.18.1-044b1b17.log ):
Configuring executable 'doctest' for doctest-0.18.1..
Warning: The package has an extraneous version range for a dependency on an
internal library: doctest >=0 && ==0.18.1,doctest >=0 && ==0.18.1. This
version range includes the current package but isn't needed as the current
package's library will always be used.
Preprocessing executable 'doctest' for doctest-0.18.1..
Building executable 'doctest' for doctest-0.18.1..
[1 of 2] Compiling Main             ( driver/Main.hs,dist/build/doctest/doctest-tmp/Main.o )
[2 of 2] Compiling Paths_doctest    ( dist/build/doctest/autogen/Paths_doctest.hs,dist/build/doctest/doctest-tmp/Paths_doctest.o )
Linking dist/build/doctest/doctest ...
ld: warning: ignoring file /Users/Zack/.cabal/store/ghc-8.6.5/syb-0.7.2.1-8996991c/lib/libHSsyb-0.7.2.1-8996991c.a,building for macOS-x86_64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/Zack/.cabal/store/ghc-8.6.5/ghc-pths-0.1.0.12-5d9fa1db/lib/libHSghc-pths-0.1.0.12-5d9fa1db.a,building for macOS-x86_64 but attempting to link with file built for unkNown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file /Users/Zack/.cabal/store/ghc-8.6.5/dctst-0.18.1-d578345b/lib/libHSdctst-0.18.1-d578345b.a,building for macOS-x86_64 but attempting to link with file built for unkNown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file /Users/Zack/.cabal/store/ghc-8.6.5/xcptns-0.10.4-3ecc6514/lib/libHSxcptns-0.10.4-3ecc6514.a,building for macOS-x86_64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/Zack/.cabal/store/ghc-8.6.5/cd-pg-0.2.1-e0f661a5/lib/libHScd-pg-0.2.1-e0f661a5.a,building for macOS-x86_64 but attempting to link with file built for unkNown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file /Users/Zack/.cabal/store/ghc-8.6.5/bs-cmpt-0.11.2-742fbb99/lib/libHSbs-cmpt-0.11.2-742fbb99.a,building for macOS-x86_64 but attempting to link with file built for unkNown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
Undefined symbols for architecture x86_64:
  "_dctstzm0zi18zi1zmd578345b_Run_doctest1_closure",referenced from:
      _udjE_srt in Main.o
  "_dctstzm0zi18zi1zmd578345b_Run_doctest1_info",referenced from:
      _cdjy_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)
cabal: Failed to build exe:doctest from doctest-0.18.1. See the build log
above for details.

我尝试重新安装 XCode 命令行工具,并验证 $(which ranlib) -V 具有以下输出

Apple Inc. version cctools-977.1
error: /Library/Developer/CommandLinetools/usr/bin/ranlib: no archives specified
Usage: /Library/Developer/CommandLinetools/usr/bin/ranlib [-sactfqLT] [-] archive [...]

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。