From 8740fdf1f654b155721dc362eeaeffc30698f2f2 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Sat, 10 Aug 2024 20:57:53 +0200 Subject: [PATCH] Support somewhat recent clang versions on Windows (GH-15324) Prior to clang 10.0.0, `clang-cl -v` apparently always appended some fine grained version information in parentheses[1]; this is no longer the case, so the build fails early because the compiler version could not be detected. Since we never used this fine grained version info, we no longer check for it. As of clang 13.0.0, the `/fallback` command option has been removed[2], so we only set the flag for older clang versions. [1] [2] --- win32/build/confutils.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/win32/build/confutils.js b/win32/build/confutils.js index 2074b9a90d2..b72950954c0 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -3070,7 +3070,7 @@ function toolset_get_compiler_version() var command = 'cmd /c ""' + PHP_CL + '" -v"'; var full = execute(command + '" 2>&1"'); - if (full.match(/clang version ([\d\.]+) \((.*)\)/)) { + if (full.match(/clang version ([\d\.]+)/)) { version = RegExp.$1; version = version.replace(/\./g, ''); version = version/100 < 1 ? version*10 : version; @@ -3324,7 +3324,9 @@ function toolset_setup_common_cflags() } else { ADD_FLAG('CFLAGS', '-m64'); } - ADD_FLAG("CFLAGS", " /fallback "); + if (CLANGVERS < 1300) { + ADD_FLAG("CFLAGS", " /fallback "); + } ADD_FLAG("CFLAGS", "-Xclang -fmodules"); var vc_ver = probe_binary(PATH_PROG('cl', null));