Skip to content

Commit ad75107

Browse files
committed
Tolerate "cc --version" failure, use "C" compiler by default
1 parent dc6d476 commit ad75107

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

‎Programs/_getcompiler.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828

2929
int main()
3030
{
31-
return 1;
3231
const char *compiler = COMPILER;
3332
printf("%s\n", compiler);
3433
return 0;

‎Tools/build/generate_getbuildinfo.py‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ def get_compiler():
137137
compiler = run_command([runner, getcompiler], check=False)
138138
else:
139139
compiler = run_command([getcompiler], check=False)
140-
141140
if compiler:
142141
return compiler
143142

@@ -147,9 +146,14 @@ def get_compiler():
147146
exit_error(f"ERROR: Unable to locate CC in Makefile")
148147

149148
cmd = shlex.split(CC)
150-
output = run_command([*cmd, '--version'])
151-
# Get the first line
152-
return output.splitlines()[0]
149+
output = run_command([*cmd, '--version'], check=False)
150+
if output:
151+
# Get the first line
152+
return output.splitlines()[0]
153+
154+
# Default compiler name when everything else failed
155+
# (see Programs/_getcompiler.c)
156+
return 'C'
153157

154158

155159
def main():

0 commit comments

Comments
 (0)