我正在嘗試在 Windows 上使用 cabal(使用巧克力安裝),它正在尋找“ar”,這是一個 GNU 實用程式,我不知道如何安裝它。
# In powershell or git bash
git clone https://github.com/haskell/text
cd text
cabal build --with-gcc=msys2
錯誤訊息摘錄(是的,我故意使用 8.2.2,-w ghc-8.2.2):
Failed to build call-stack-0.4.0.
Build log (
C:\cabal\logs\ghc-8.2.2\call-stack-0.4.0-99b0801375eba6b85bc1a82c10630c85f20debfa.log
):
Preprocessing library for call-stack-0.4.0..
Building library for call-stack-0.4.0..
[1 of 3] Compiling Data.SrcLoc ( src\Data\SrcLoc.hs, dist\build\Data\SrcLoc.o )
[2 of 3] Compiling Data.CallStack ( src\Data\CallStack.hs, dist\build\Data\CallStack.o )
[3 of 3] Compiling Paths_call_stack ( dist\build\autogen\Paths_call_stack.hs, dist\build\Paths_call_stack.o )
cabal.exe: The program 'ar' is required but it could not be found.
(and a whole lot more identical errors for other packages)
uj5u.com熱心網友回復:
您可能需要安裝 GCC,據我通過查看我機器上的 MSYS2 設定可以看出,最初的 MSYS2 安裝似乎沒有附帶 GCC。這將通過 pacman 在 MSYS shell 上完成(有關 MSYS2 shell 和子系統的入門,請參閱MSYS2 wiki ):
# Updates the package database and the currently installed packages.
# If the shell closes at the end of the update, reopen it and rerun.
pacman -Syu
# Installs gcc.
pacman -S mingw-w64-x86_64-gcc
特別是,ar作為 的一部分安裝mingw-w64-x86_64-binutils,它是 的依賴項mingw-w64-x86_64-gcc。
補充筆記:
GCC 將安裝到
mingw64\bin您的 MSYS2 根目錄下。您可能希望將該位置添加到您的 PATH 中。如您所見,如果您通過 Chocolatey 管理工具,
choco install mingw將建立基本的 MinGW 開發工具鏈,其中包括 GCC。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/423012.html
標籤:
