首页 > 解决方案 > 无法`cabal安装doctest`

问题描述

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

我正在使用 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 [...]

标签: haskellinstallationcabalcabal-install

解决方案


推荐阅读