ENH Print helpful error if ccache was linked against too new glibc (#4127)

Resolves pyodide#4126.
If someone builds emsdk outside of the docker image and then attempts to use it
inside, there will be an error. This detects it and tells people to clean emsdk.
This commit is contained in:
Hood Chatham 2023-09-10 21:08:02 -07:00 committed by GitHub
parent 4c67f2929d
commit 9042e6cb1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 0 deletions

View File

@ -9,6 +9,7 @@ CXX=em++
all: check \
check-emcc \
dist/pyodide.asm.js \
dist/pyodide.js \
dist/pyodide.d.ts \
@ -269,6 +270,10 @@ check:
./tools/dependency-check.sh
check-emcc: emsdk/emsdk/.complete
python3 tools/check_ccache.py
debug :
EXTRA_CFLAGS+=" -D DEBUG_F" \
make

24
tools/check_ccache.py Normal file
View File

@ -0,0 +1,24 @@
import re
import subprocess
import sys
def main():
result = subprocess.run(["emcc", "--version"], capture_output=True, encoding="utf8")
if result.returncode == 0:
return 0
if re.search("GLIBC.*not found.*ccache", result.stderr):
print(
"Emscripten ccache was linked against an incompatible version of glibc.\n"
"Run `make -C emsdk clean` and try again.\n"
"If this error persists, please open an issue to ask for help."
)
else:
print("Something is wrong but I'm not sure what.")
print("Info:")
print(result)
return 1
if __name__ == "__main__":
sys.exit(main())