Kristian Sørdal closed issue #23300: Unable to install and build GHC version 9.* at Glasgow Haskell Compiler / GHC

Kristian Sørdal
2023-04-26T07:34:13Z

I recently needed to reinstall GHC version 9.4.2. In doing so, I ran ghcup install ghc 9.4.2. This fails no matter what I try. The installation process with the -verbose flag yields the following error message:

[ Debug ] Identified Platform as: Darwin
[ Debug ] last access was 45286.964873s ago, cache interval is 300s
[ Info ] downloading: https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-0.0.7.yaml as file /Users/ks/.ghcup/cache/ghcup-0.0.7.yaml
[ Debug ] Read etag: "41e4d2624098952595248d3bdc8ef7af660e2f5a0276a87ace00ae3a6d496e12"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
[ Debug ] Status code was 304, not overwriting
[ Debug ] Parsed etag: "41e4d2624098952595248d3bdc8ef7af660e2f5a0276a87ace00ae3a6d496e12"
[ Debug ] Writing etagsFile /Users/ks/.ghcup/cache/ghcup-0.0.7.yaml.etags
[ Debug ] Decoding yaml at: /Users/ks/.ghcup/cache/ghcup-0.0.7.yaml
[ Warn ] New ghc version available. If you want to install this latest version, run 'ghcup install ghc 9.6.1'
[ Warn ] New cabal version available. If you want to install this latest version, run 'ghcup install cabal 3.10.1.0'
[ Debug ] Requested to install GHC with 9.4.2
[ Info ] downloading: https://downloads.haskell.org/~ghc/9.4.2/ghc-9.4.2-aarch64-apple-darwin.tar.xz as file /Users/ks/.ghcup/tmp/ghcup-25c63b31017fae7e/ghc-9.4.2-aarch64-apple-darwin.tar.xz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 189M 100 189M 0 0 4583k 0 0:00:42 0:00:42 --:--:-- 4224k
[ Info ] verifying digest of: ghc-9.4.2-aarch64-apple-darwin.tar.xz
[ Info ] Unpacking: ghc-9.4.2-aarch64-apple-darwin.tar.xz to /Users/ks/.ghcup/tmp/ghcup-e074f9f879a03a30
[ Info ] Installing GHC (this may take a while)
[ Debug ] Running sh with arguments ["./configure","--prefix=/Users/ks/.ghcup/ghc/9.4.2","--disable-ld-override"]
checking build system type... aarch64-apple-darwin22.2.0
checking host system type... aarch64-apple-darwin22.2.0
checking target system type... aarch64-apple-darwin22.2.0
build platform inferred as: aarch64-apple-darwin
host platform inferred as: aarch64-apple-darwin
target platform inferred as: aarch64-apple-darwin
configure: GHC build : aarch64-apple-darwin
configure: GHC host : aarch64-apple-darwin
configure: GHC target : aarch64-apple-darwin
checking for path to top of build tree... /Users/ks/.ghcup/tmp/ghcup-e074f9f879a03a30/ghc-9.4.2-aarch64-apple-darwin
checking for a BSD-compatible install... /opt/homebrew/bin/ginstall -c
checking whether ln -s works... yes
checking for gsed... /opt/homebrew/bin/gsed
checking for python3... /opt/homebrew/bin/python3
checking for gfind... no
checking for find... /usr/bin/find
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... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking for g++... g++
checking whether the compiler supports GNU C++... yes
checking whether g++ accepts -g... yes
checking for g++ option to enable C++11 features... none needed
checking how to run the C preprocessor... gcc -E
checking for -ld... no
checking for ld... ld
checking for ld.gold object merging bug (binutils 22266)... ld: unknown option: --version
checking whether ld is GNU ld... NO
checking whether ld understands --build-id... no
checking whether ld understands -no_compact_unwind... yes
checking whether ld understands -filelist... yes
checking for -strip... no
checking for strip... strip
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking for llc-14... no
checking for llc-14.0... no
checking for llc14... no
checking for llc-13... no
checking for llc-13.0... no
checking for llc13... no
checking for llc-12... no
checking for llc-12.0... no
checking for llc12... no
checking for llc-11... no
checking for llc-11.0... no
checking for llc11... no
checking for llc-10... no
checking for llc-10.0... no
checking for llc10... no
checking for llc... no
checking for opt-14... no
checking for opt-14.0... no
checking for opt14... no
checking for opt-13... no
checking for opt-13.0... no
checking for opt13... no
checking for opt-12... no
checking for opt-12.0... no
checking for opt12... no
checking for opt-11... no
checking for opt-11.0... no
checking for opt11... no
checking for opt-10... no
checking for opt-10.0... no
checking for opt10... no
checking for opt... no
configure: $CC is not gcc; assuming it's a reasonably new C compiler
checking whether CC supports -no-pie... no
checking for extra options to pass gcc when compiling via C...
checking Setting up CFLAGS, LDFLAGS, IGNORE_LINKER_LD_FLAGS and CPPFLAGS... done
checking Setting up CONF_CC_OPTS_STAGE0, CONF_GCC_LINKER_OPTS_STAGE0, CONF_LD_LINKER_OPTS_STAGE0 and CONF_CPP_OPTS_STAGE0... done
checking Setting up CONF_CC_OPTS_STAGE1, CONF_GCC_LINKER_OPTS_STAGE1, CONF_LD_LINKER_OPTS_STAGE1 and CONF_CPP_OPTS_STAGE1... done
checking Setting up CONF_CC_OPTS_STAGE2, CONF_GCC_LINKER_OPTS_STAGE2, CONF_LD_LINKER_OPTS_STAGE2 and CONF_CPP_OPTS_STAGE2... done
checking C++ standard library flavour... libstdc++
checking for linkage against 'stdc++'... failed
checking for linkage against 'stdc++ supc++'... failed
configure: error: Failed to find C++ standard library
[ Error ] [GHCup-00841] Process "sh" with arguments ["./configure",
[ ... ] "--prefix=/Users/ks/.ghcup/ghc/9.4.2",
[ ... ] "--disable-ld-override"] failed with exit code 1.
[ Error ] Also check the logs in /Users/ks/.ghcup/logs

I've been at this for hours with no luck. Seemingly its an issue with the standard C++ library.

I've seen a similiar issue here, where it was solved by brew uninstall llvm, which I've tried to no avail.

I've tried to install with only clang on my path, with only gcc on my path, with only g++ on my path, and a combination of two or three of them, nothing seems to work.

I even tried ghcup nuke, and did a comlete reinstall og ghcup, which didn't work either.

Operating System: OSX

System Architecture: ARM64 / M1 Pro

Any help would be appreciated.