Crafter.Build/implementations
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Jorijn van der Graaf 93eca17e57
fix(build): give a link its objects in a response file
Build() wrote the path of every object of a configuration into its
link or archive command. A command is run by a shell, which is given
it as one argument, and Linux holds one argument to 32 pages: 131,072
bytes with pages of 4 KiB, the terminating byte included. Once the
objects' paths left the command longer than that, popen started no
shell and the build ended with "popen() failed!". Issue #50 notes the
limit, and that a response file for the objects would take it away.

The step now reads its objects from a file that the command names with
@, <output name>.objects in the build directory, one object to a line.
clang and llvm-ar both take arguments from such a response file, so
the link of an executable or a shared library and the archive step of
a static library are handed their objects the same way, and the
command is as long for a thousand sources as for one. Build() keeps
the objects as a list for that, where it joined their paths into the
command as it went over the sources. Each line is quoted for the
reader of a response file, which differs from the shell's: it takes a
backslash inside quotes to quote the character after it.

The file is written before every run of the step, and one that cannot
be written fails the build: the list of an earlier build would
otherwise stay in its place and the step would read its objects. It is
written under a name of its own beside its place and moved there, as
the archive of a static library is, so that a step of another
crafter-build which reads the list at that moment reads the list it
opened, whole, or the new one.

The record that decides whether an unchanged build links again held
the command, which held the objects. It now holds the command and,
under it, the list. The command only names the file, so taking a
source out of a configuration can leave the command as it was, with no
object newer than the output, as the second build of
StaticLibSourceRemoved does: the list is then all that says the step
has to run again.
2026-11-19 10:33:33 +01:00
..
Crafter.Build-Agents.cpp feat: let a project file return several configurations 2026-11-15 02:16:06 +01:00
Crafter.Build-Asset.cpp linting 2026-07-23 01:24:42 +02:00
Crafter.Build-Clang.cpp fix(build): give a link its objects in a response file 2026-11-19 10:33:33 +01:00
Crafter.Build-External.cpp feat: let a project file return several configurations 2026-11-15 02:16:06 +01:00
Crafter.Build-Flatpak.cpp feat: install a Flatpak's data under /app/share 2026-11-09 01:55:31 +01:00
Crafter.Build-Implementation.cpp feat(build): run a build's steps on one worker per hardware thread 2026-11-13 17:59:55 +01:00
Crafter.Build-Interface.cpp feat(build): run a build's steps on one worker per hardware thread 2026-11-13 17:59:55 +01:00
Crafter.Build-Jobs.cpp feat(build): run a build's steps on one worker per hardware thread 2026-11-13 17:59:55 +01:00
Crafter.Build-Lint.cpp feat: let a project file return several configurations 2026-11-15 02:16:06 +01:00
Crafter.Build-Platform.cpp feat: let a project file return several configurations 2026-11-15 02:16:06 +01:00
Crafter.Build-Progress.cpp refactor: drop Windows host support 2026-10-02 22:03:34 +02:00
Crafter.Build-Script.cpp feat: let a project file return several configurations 2026-11-15 02:16:06 +01:00
Crafter.Build-Shader.cpp fix: rebuild and relink on what changed, submodules at their revisions, and mingw found where it is 2026-10-20 20:20:29 +02:00
Crafter.Build-Test.cpp feat: let a project file return several configurations 2026-11-15 02:16:06 +01:00
Crafter.Build-Toolchain.cpp feat(cuda): link the CUDA runtime of the toolkit that compiles the .cu 2026-11-11 19:34:52 +01:00
main.cpp refactor: drop Windows host support 2026-10-02 22:03:34 +02:00