Web: Fix version check for missing scalbnf LTO workaround

The check needs to happen after we set `env["CXX"]`.
Follow-up to #81340.
This commit is contained in:
Rémi Verschelde 2023-09-18 16:32:13 +02:00
parent e3e2528ba7
commit 50161808c2
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 9 additions and 7 deletions

View File

@ -118,11 +118,6 @@ def configure(env: "Environment"):
else:
env.Append(CCFLAGS=["-flto"])
env.Append(LINKFLAGS=["-flto"])
# Workaround https://github.com/emscripten-core/emscripten/issues/19781.
cc_version = get_compiler_version(env)
cc_semver = (int(cc_version["major"]), int(cc_version["minor"]), int(cc_version["patch"]))
if cc_semver >= (3, 1, 42):
env.Append(LINKFLAGS=["-Wl,-u,scalbnf"])
# Sanitizers
if env["use_ubsan"]:
@ -204,9 +199,16 @@ def configure(env: "Environment"):
env.Append(LINKFLAGS=["-s", "PTHREAD_POOL_SIZE=8"])
env.Append(LINKFLAGS=["-s", "WASM_MEM_MAX=2048MB"])
if env["dlink_enabled"]:
# Get version info for checks below.
cc_version = get_compiler_version(env)
cc_semver = (int(cc_version["major"]), int(cc_version["minor"]), int(cc_version["patch"]))
if env["lto"] != "none":
# Workaround https://github.com/emscripten-core/emscripten/issues/19781.
if cc_semver >= (3, 1, 42) and cc_semver < (3, 1, 46):
env.Append(LINKFLAGS=["-Wl,-u,scalbnf"])
if env["dlink_enabled"]:
if cc_semver < (3, 1, 14):
print("GDExtension support requires emscripten >= 3.1.14, detected: %s.%s.%s" % cc_semver)
sys.exit(255)