Waf fails to configure C compiler on github actions

61 Views Asked by At

When I run ./waf configure -v locally, I get

Checking for 'gcc' (C compiler)          : 13:52:02 runner ['/usr/bin/gcc', '-dM', '-E', '-']
/usr/bin/gcc 
Checking for 'gcc' (C compiler)          : 13:52:02 runner ['clang', '-dM', '-E', '-']
not found 
Checking for 'clang' (C compiler)        : 13:52:02 runner ['clang', '-dM', '-E', '-']
clang 
Checking for 'gcc' (C compiler)          : 13:52:02 runner ['/usr/bin/gcc', '-dM', '-E', '-']
/usr/bin/gcc 
Checking for 'gcc' (C compiler)          : 13:52:02 runner ['clang', '-dM', '-E', '-']
not found 
Checking for 'clang' (C compiler)        : 13:52:02 runner ['clang', '-dM', '-E', '-']
clang 
Checking for 'gcc' (C compiler)          : 13:52:02 runner ['x86_64-w64-mingw32-gcc', '-dM', '-E', '-']
x86_64-w64-mingw32-gcc

However, when I run it on github actions, I NEED it to specifically use clang-15 and gcc-13 which are installed manually. It actually does discover clang-15 on its own if I just run ./waf configure -v, but it still gives up for absolutely no reason.

If I run it with CC=clang-15 ./waf configure -v it still fails with the same error.

The error for just ./waf configure -v is

 Checking for 'gcc' (C compiler)          : 19:30:07 runner ['/usr/bin/gcc', '-dM', '-E', '-']
/usr/bin/gcc 
Checking for 'gcc' (C compiler)          : 19:30:08 runner ['clang', '-dM', '-E', '-']
not found 
Checking for 'clang' (C compiler)        : 19:30:10 runner ['clang', '-dM', '-E', '-']
clang 
Checking for 'gcc' (C compiler)          : 19:30:10 runner ['/usr/bin/gcc', '-dM', '-E', '-']
/usr/bin/gcc 
Checking for 'gcc' (C compiler)          : 19:30:10 runner ['clang', '-dM', '-E', '-']
not found 
Checking for 'clang' (C compiler)        : 19:30:10 runner ['clang', '-dM', '-E', '-']
clang 
Checking for 'gcc' (C compiler)          : not found 
Checking for 'clang' (C compiler)        : not found 
Checking for 'icc' (C compiler)          : not found 
could not configure a C compiler!

The astute reader will notice that (a) these outputs are different, and (b) on gha, Waf has very mysteriously decided that it will refuse to work even though it patently found clang and /usr/bin/gcc successfully.

What is going on here? This doesn't make any sense at all. It's incoherent.

Like, fair play it's finding different compilers on my system vs gha; they have different compilers installed so this makes sense. But, truly, WHY is it attempting to find icc on gha but not my computer, and WHY is it giving up due to not finding a C compiler on gha but not my computer when, again, it finds a C compiler on both?

I certainly have no idea what could possibly be causing this failure, but it should be obvious already to anyone who does. Nevertheless, here is the gha workflow and here is the wscript (beware it's chonky).

I've searched Waf's gitlab issues, stackoverflow, and google, but I didn't find much useful. I did find that Waf will display the output of the compiler on an empty program if you look in its log files, since this was relevant in one gitlab issue where the user had a custom compiler that Waf didn't recognize, but I really have gcc and clang so this should not be the problem. I also found that there's some way to make ubuntu use clang-15 and gcc-13 by default, I think this might actually help but I remember it (shock of shocks) not working on gha in the past.

EDIT: To be clear, I was thinking of update-alternatives, and when using update-alternatives to change gcc-13 and clang-15 to the deaults, there is no change to the Waf failure. However, I did verify by adding gcc --version etc to the gha script that the default gcc correctly becomes gcc-13 and the default clang becomes ... clang-14 (wild).

0

There are 0 best solutions below