5

Does anyone know how to fix this error? I am currently trying to install Haskell on Mac using the instructions from https://www.haskell.org/ghcup/.

Installation starts with the following command line:

curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh

However at a certain moment I receive this error:

Build failed with NonZeroExit 77 "./configure" ["--prefix=/Users/not_root/.ghcup/ghc/8.8.3"]
Check the logs at ~/.ghcup/logs and the build directory"/var/folders/n0/g0qh09_s46ndjzmy1jctj7f00000gr/T/ghcup-iyHoc8/ghc-8.8.3" for more clues.

"ghcup --cache install" failed!

This are the log files: ghc-configure.log:

checking for gcc... gcc
checking whether ln -s works... yes
checking for gsed... sed
checking XCode version... xcode-select: error: tool 'xcodebuild'requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
not found (too old?)
checking for gcc... gcc
checking whether the C compiler works... no
checking for gsed... sed
checking XCode version... xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
not found (too old?)
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/private/var/folders/n0/g0qh09_s46ndjzmy1jctj7f00000gr/T/ghcup-iyHoc8/ghc-8.8.3':
checking XCode version... xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
not found (too old?)
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/private/var/folders/n0/g0qh09_s46ndjzmy1jctj7f00000gr/T/ghcup-iyHoc8/ghc-8.8.3':
configure: error: C compiler cannot create executables
not found (too old?)
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/private/var/folders/n0/g0qh09_s46ndjzmy1jctj7f00000gr/T/ghcup-iyHoc8/ghc-8.8.3':
configure: error: C compiler cannot create executables
See `config.log' for more details

This is the ghcup.log:

Debug:  Receiving download info from: GHCupURL
Debug:  Unable to get/parse Last-Modified header
Debug:  Requested to install GHC with Version {_vEpoch = Nothing, _vChunks = [[Digits 8],[Digits 8],[Digits 3]], _vRel = []}
Debug:  Identified Platform as: PlatformResult {_platform = Darwin, _distroVersion = Just (General (Version {_vEpoch = Nothing, _vChunks = [[Digits 10],[Digits 15]], _vRel = []}))}
Info: downloading: https://downloads.haskell.org/~ghc/8.8.3/ghc-8.8.3-x86_64-apple-darwin.tar.xz
Info: verifying digest of: /Users/not_root/.ghcup/cache/ghc-8.8.3-x86_64- apple-darwin.tar.xz
Info: Unpacking: /Users/not_root/.ghcup/cache/ghc-8.8.3-x86_64-apple-darwin.tar.xz
Info: Installing GHC (this may take a while)
Error: Build failed with NonZeroExit 77 "./configure" ["--prefix=/Users/not_root/.ghcup/ghc/8.8.3"]
Check the logs at ~/.ghcup/logs and the build directory "/var/folders/n0/g0qh09_s46ndjzmy1jctj7f00000gr/T/ghcup-iyHoc8/ghc-8.8.3" for more clues.
JustinK98
  • 61
  • 1
  • 3

2 Answers2

3

When I had this same issue, I got it working by running xcode-select --install in my terminal to update the macOS command line development tools, as suggested in "Installing haskell on mac OS" on /r/haskell.

plgaurin
  • 31
  • 2
0

This is probably related to improperly installed or outdated XCode command line tools. Unfortunately, it looks like xcode-select --install doesn't work anymore (this is what another answer from 2 years ago suggests).

So try the following:

  • make sure XCode is installed and in the latest version (do this in App Store)
  • if it has been recently updated or installed, you must launch the whole XCode app
  • it will most likely ask for your (root) password after this first launch, which will allow XCode to install/update the XCode command line tools (that's what you need)
  • you can then quit XCode
  • it might make sense to restart the zsh terminal (e.g. iTerm if you use it)
  • try again launching the curl ... Haskell installation script from the terminal (iTerm) and now it's very likely it'll work OK
jrx1301
  • 163
  • 2
  • 8