Skip to content

Broken GCC version check in configure script for bin dists (and possibly GHC in general)

Summary

The GHC configure script checks the GCC version to protect against a bug in older GCCs. Unfortunately, this check doesn't actually check GCC's version but whatever happens to be in the CC environment variable. See line 6236 of configure:

fp_cv_gcc_version="`$CC -v 2>&1 | sed -n -e '1,/version /s/.*version [^0-9]*\([0-9.]*\).*/\1/p'`"

The relevant part of configure runs from 6236 through 6259

If you happen to have clang set as CC this will break because 1) this version check is nonsensical agains clang and 2) it incorrectly reports GCC as the compiler, leading to a super confusing debugging experience.

Steps to reproduce

Set CC to a clang version <4.4 (such as the 3.4 found on CentOS 7) and run ./configure in the bindist.

Environment

  • GHC version used: 8.6.5 bindist

Optional:

  • Operating System: Any *nix
  • System Architecture: x64
Edited by Merijn Verstraaten
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information