Repository navigation
Fix build system on Windows and test it deliberately - #1389
Merged
Merged
Conversation
8 tasks done
salkinium
force-pushed
the
feature/windows_compat
branch
3 times, most recently
from
October 12, 2026 21:47
1bfc853 to
96c4a6d
Compare
salkinium
marked this pull request as ready for review
October 13, 2026 07:56
salkinium
force-pushed
the
feature/windows_compat
branch
2 times, most recently
from
October 13, 2026 09:19
8720316 to
21c983e
Compare
lbuild v1.23 returns relative paths with forward slashes on all hosts, so counting the native separator found no header on Windows and modm/processing.hpp stayed empty.
It returns all relative paths with forward slashes, also on Windows.
Archiving many object files exceeds the command line length on Windows. SCons only writes the file when the command is too long. It uses forward slashes, since ar reads a backslash in a response file as an escape.
It is only for Cortex-M55 and SCons does not preprocess .S files on Windows, so its include guard has no effect there.
An application with about a hundred source files exceeds the 8191 characters that cmd.exe accepts when linking with SCons on Windows. The linker reads a backslash in a response file as an escape character. The target and sources are written with forward slashes, but SCons has no such form for the library paths, libraries and link flags, which contain absolute Windows paths. Their backslashes are escaped instead, only for the link command of the program.
Paths were written with backslashes on Windows and every use in a template had to opt into escaping them with the modm.windowsify filter. Wherever that was forgotten, a path like generated\nanopb or generated\xpcc turned into an escape sequence or a syntax error. lbuild now returns all relative paths with forward slashes, which all tools accept on Windows as well. This makes the modm.windowsify and modm.posixify filters and their escape levels unnecessary.
All application sources are passed as arguments, which exceeds the 8191 characters that cmd.exe accepts for about a hundred files, and SCons did not even report that as an error. The interpreter is also only called python3 on Windows if it was installed by the GitHub setup-python action.
A 64-bit Windows executable is loaded at an address that does not fit into an Intel Hex file, so objcopy failed every hosted CMake build.
lxml passes the DTD of an XML file with an absolute Windows path as a file URL, which was not recognized as an existing file, so the DTD was searched for in the wrong folder. Together with the forward slashes in the SConstruct this lets the XPCC examples compile on Windows again.
The CMake generator was never tested on Windows. The commands were written for a POSIX shell, they now only use CMake itself. MinGW Makefiles are generated on Windows, since they run their commands with cmd.exe and need nothing but the make that comes with MinGW.
The STM32 examples were whole board folders, so Windows bugs in the build system were only found if an affected example happened to be in one of them. The list now names examples with preprocessed assembly, generated paths, many object files, CMake and CompilationDB. The Nanopb generator needs protobuf and grpcio-tools.
Outside of a Git repository or without Git installed the two timestamps fell back to the string "Unknown", which was generated as a char pointer and conflicted with their uint32_t declaration, so info_git.c did not compile.
salkinium
force-pushed
the
feature/windows_compat
branch
from
October 13, 2026 09:39
21c983e to
7d99e46
Compare
16 of 18 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Our Windows CI compiled whatever examples happened to be in its list, so Windows-only bugs in the build system showed up at random whenever the list changed, most recently in #1118. This fixes the ones I found and makes the Windows job compile examples picked for what can actually break there. Turns out it's always one of the same three things, meh.
Requires lbuild v1.23.0 (modm-io/lbuild#88), which returns all relative paths with forward slashes on every host.
.Sfiles on Windows, since the file system is case-insensitive: the LVGL Helium assembly (Cortex-M55 only) is not copied anymore. RTT was already fixed in Add board connections, hosted configuration and fixes for deduplicated examples #1387.cmd.exe: the archive and link commands now use a response file. LVGL alone is about 60000 characters of object files, lol. SCons only writes the file if the command is too long.generated\nanopb,generated\xpccandgenerated\tests: fixed at the source in lbuild instead of in modm, so the minimum lbuild version is now v1.23.0. This removes themodm.windowsifyandmodm.posixifyfilters and theescape_levelcompletely, since having to remember them for every single path is what caused these bugs in the first place.modm/processing.hppcounted the native path separator to find its headers, which would have left it empty on Windows with the new lbuild, whoops.scons compilation_dbpassed all sources throughcmd.exeand failed silently with exit code 0, whoops. The builder is now called without a shell..binand.hexfiles anymore,objcopy -Oihexfails on a 64-bit Windows executable.file:/C:/...paths..gitignoreused backslashes, which ignores nothing.0instead of"Unknown"without Git, which did not compile asuint32_ton any OS.examples_compile.pyalso compiles CMake examples on Windows using the "MinGW Makefiles" generator. Make stays excluded, it's documented as unsupported.Missing: The
modm.posixifyfilter is gone, in case any external repository used it. The Wine container has no Git, so thelinux/gitexample and the hosted unit tests did not run locally and rely on the CI here. The link command limit has no test, since no example has enough source files: I only forced it by loweringMAXLINELENGTH. OpenOCD with forward slashes in its config is reasoned from itsstartup.tcl, not run.Conflicts with #1118, which moves all examples and has its own copy of the first two commits. I'll rebase whichever gets merged second.