File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -520,6 +520,7 @@ fn (mut v Builder) cc() {
520
520
vexe := pref.vexe_path ()
521
521
vdir := os.dir (vexe)
522
522
mut tried_compilation_commands := []string {}
523
+ mut tcc_output := os.Result{}
523
524
original_pwd := os.getwd ()
524
525
for {
525
526
// try to compile with the choosen compiler
@@ -659,6 +660,7 @@ fn (mut v Builder) cc() {
659
660
exit (101 )
660
661
}
661
662
if v.pref.retry_compilation {
663
+ tcc_output = res
662
664
v.pref.ccompiler = pref.default_c_compiler ()
663
665
if v.pref.is_verbose {
664
666
eprintln ('Compilation with tcc failed. Retrying with $v.pref.ccompiler ...' )
@@ -676,7 +678,14 @@ fn (mut v Builder) cc() {
676
678
}
677
679
}
678
680
if ! v.pref.show_c_output {
679
- v.post_process_c_compiler_output (res)
681
+ // if tcc failed once, and the system C compiler has failed as well,
682
+ // print the tcc error instead since it may contain more useful information
683
+ // see https://discord.com/channels/592103645835821068/592115457029308427/811956304314761228
684
+ if res.exit_code != 0 && tcc_output.output != '' {
685
+ v.post_process_c_compiler_output (tcc_output)
686
+ } else {
687
+ v.post_process_c_compiler_output (res)
688
+ }
680
689
}
681
690
// Print the C command
682
691
if v.pref.is_verbose {
You can’t perform that action at this time.
0 commit comments