From 7448feed44f81ccd68f2d6509462c8b0bae542d7 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 27 Oct 2025 18:18:49 +0500 Subject: [PATCH] build-all.py - reinitialize wasm cxx flags from cflags to accomodate issue upstream --- nix/build-all.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nix/build-all.py b/nix/build-all.py index 79a5587408..d08a71c570 100644 --- a/nix/build-all.py +++ b/nix/build-all.py @@ -238,6 +238,16 @@ if WASM: missing_vars = [v for v in required_vars if v not in os.environ] assert not missing_vars, f"Some variables required for WASM compilation are missing: {', '.join(missing_vars)}" + # pyodide provide empty `CXXFLAGS`, leading to issues using C++ files compiled with `-fexceptions` + # which is used by OCCT. + # https://github.com/pyodide/pyodide-build/issues/251 + side_module_cxx_flags = os.environ.get("SIDE_MODULE_CXXFLAGS", "") + if side_module_cxx_flags.strip(): + print("SIDE_MODULE_CXXFLAGS are already passed from pyodide build ('{side_module_cxx_flags}').") + print("Maybe it's time to stop overriding them in the script?") + + os.environ["SIDE_MODULE_CXXFLAGS"] = os.environ["SIDE_MODULE_CFLAGS"] + # Set defaults for missing empty environment variables USE_OCCT = os.environ.get("USE_OCCT", "true").lower() == "true"