From db53da252935d88df2bc2e169870fba6beae07b0 Mon Sep 17 00:00:00 2001 From: Arctis_Fireblight <6182060+Arctis-Fireblight@users.noreply.github.com> Date: Sat, 16 May 2026 01:22:16 -0500 Subject: [PATCH 1/4] Fix: Linux CI failing due to too many arguments in ar command Added logic to linux.py split long `.o` file lists into commands of 512 or less. --- tools/linux.py | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/tools/linux.py b/tools/linux.py index ae80198..7c63284 100644 --- a/tools/linux.py +++ b/tools/linux.py @@ -12,6 +12,56 @@ def exists(env): return True +def configure(env): + import subprocess + + def mySubProcess(cmdline, env): + import shlex + + kwargs = {} + args = shlex.split(cmdline) + + proc = subprocess.Popen( + args, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + shell=False, + env=env, + **kwargs, + ) + data, err = proc.communicate() + rv = proc.wait() + if rv: + print("=====") + print(err.decode("utf-8")) + print("=====") + return rv + + def mySpawn(sh, escape, cmd, args, env): + rv = 0 + if len(args) > 512 and cmd.endswith("ar"): + cmdline = cmd + " " + args[1] + " " + args[2] + " " + for i in range(3, len(args), 510): + batch = args[i : i + 510] + line = cmdline + " ".join(batch) + print(line) + rv = mySubProcess(line, env) + if rv: + break + else: + newargs = " ".join(args[1:]) + cmdline = cmd + " " + newargs + if cmd.endswith("ar"): + print(cmdline) + rv = mySubProcess(cmdline, env) + + return rv + + env["SPAWN"] = mySpawn + env.Replace(ARFLAGS=["q"]) + + def generate(env): if env["use_llvm"]: clang.generate(env) @@ -49,3 +99,5 @@ def generate(env): env["lto"] = "full" common_compiler_flags.generate(env) + + configure(env) From c18312fa544b715fa7216348159bb2d768d59760 Mon Sep 17 00:00:00 2001 From: Arctis_Fireblight <6182060+Arctis-Fireblight@users.noreply.github.com> Date: Sat, 16 May 2026 02:16:11 -0500 Subject: [PATCH 2/4] Perf: Optimized the line split logic in `mySpawn()` to generate fewer commands. In `my_spawn.py`, the command line length cannot exceed 32000 characters on windows. The previous implementation would break down linking to one `.obj` file at a time which was extremely slow. The new batching logic instead will batch as many `.obj` files as possible into a single linking operation resulting in significantly faster build times when compiling using MinGW on Windows. --- tools/my_spawn.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tools/my_spawn.py b/tools/my_spawn.py index 45412b6..c297673 100644 --- a/tools/my_spawn.py +++ b/tools/my_spawn.py @@ -37,9 +37,23 @@ def mySpawn(sh, escape, cmd, args, env): rv = 0 if len(cmdline) > 32000 and cmd.endswith("ar"): - cmdline = cmd + " " + args[1] + " " + args[2] + " " - for i in range(3, len(args)): - rv = mySubProcess(cmdline + args[i], env) + cmdline_base = cmd + " " + args[1] + " " + args[2] + " " + + i = 3 + while i < len(args): + batch_args = [] + current_len = len(cmdline_base) + + while i < len(args) and current_len + len(args[i]) + 1 < 32000: + batch_args.append(args[i]) + current_len += len(args[i]) + 1 + i += 1 + + if not batch_args: # Should not happen unless a single arg is > 32000 + batch_args.append(args[i]) + i += 1 + + rv = mySubProcess(cmdline_base + " ".join(batch_args), env) if rv: break else: From fef86c27324455b4eb2252293758df3e5333dadc Mon Sep 17 00:00:00 2001 From: Arctis_Fireblight <6182060+Arctis-Fireblight@users.noreply.github.com> Date: Sat, 16 May 2026 02:40:54 -0500 Subject: [PATCH 3/4] Perf: removed stdout and stderr connection to spawned processes when compiling with MinGW and on linux The lines removed were forcing Scons to effectively run single threaded. --- tools/linux.py | 7 ------- tools/my_spawn.py | 7 ------- 2 files changed, 14 deletions(-) diff --git a/tools/linux.py b/tools/linux.py index 7c63284..ea7bb27 100644 --- a/tools/linux.py +++ b/tools/linux.py @@ -24,18 +24,11 @@ def mySubProcess(cmdline, env): proc = subprocess.Popen( args, stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, shell=False, env=env, **kwargs, ) - data, err = proc.communicate() rv = proc.wait() - if rv: - print("=====") - print(err.decode("utf-8")) - print("=====") return rv def mySpawn(sh, escape, cmd, args, env): diff --git a/tools/my_spawn.py b/tools/my_spawn.py index c297673..1f744c9 100644 --- a/tools/my_spawn.py +++ b/tools/my_spawn.py @@ -17,18 +17,11 @@ def mySubProcess(cmdline, env): proc = subprocess.Popen( cmdline, stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, startupinfo=startupinfo, shell=False, env=env, ) - data, err = proc.communicate() rv = proc.wait() - if rv: - print("=====") - print(err.decode("utf-8")) - print("=====") return rv def mySpawn(sh, escape, cmd, args, env): From 2e6daa0b3fb212ef2907baecf9c28ed63780c820 Mon Sep 17 00:00:00 2001 From: Arctis_Fireblight <6182060+Arctis-Fireblight@users.noreply.github.com> Date: Sat, 16 May 2026 03:20:53 -0500 Subject: [PATCH 4/4] CI: Remove MinGW configuration from Windows CI workflow This job takes well over an hour to run even with the recent performance boosts. Something is very clearly wrong with how Scons is interacting with MinGW since the CMake jobs complete within a few minutes. Given this is not a common configuration, we are disabling this workflow and will rely on the CMake version of this test to check MinGW compatibility instead. --- .github/workflows/ci-scons.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/ci-scons.yml b/.github/workflows/ci-scons.yml index a9baee4..d3a569d 100644 --- a/.github/workflows/ci-scons.yml +++ b/.github/workflows/ci-scons.yml @@ -48,15 +48,6 @@ jobs: run-tests: false cache-name: windows-x86_64-msvc - - name: 🏁 Windows (x86_64, MinGW) - os: windows-2022 - platform: windows - artifact-name: redot-cpp-linux-mingw-x86_64-release - artifact-path: bin/libredot-cpp.windows.template_release.x86_64.a - flags: use_mingw=yes - run-tests: false - cache-name: windows-x86_64-mingw - - name: 🍎 macOS (universal) os: macos-latest platform: macos