Description
Tested versions
Reproducible with Godot 4.4
Not reproducible with Godot 4.3
System information
Godot v4.4.1.rc (afaa0cd4b) - Ubuntu 22.04.5 LTS 22.04 on X11 - X11 display driver, Multi-window, 2 monitors - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1070 (nvidia; 535.183.01) - Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz (8 threads)
Issue description
I encountered an unusual build error while porting my project from Godot 4.3 to 4.4. My project consists of several custom modules registering 94 classes to ClassDB
and a small GDExtension written in C++.
Godot 4.4 itself builds without errors, and godot-cpp for 4.4 also compiles successfully. However, building my extension fails with the following error:
$ scons platform=linux dev_build=yes compiledb=true precision=double disable_exceptions=false verbose=true
scons: Reading SConscript files ...
Auto-detected 8 CPU cores available for build parallelism. Using 7 cores by default. You can override it with the -j argument.
Building for architecture x86_64 on platform linux
scons: done reading SConscript files.
scons: Building targets ...
ar rc <godot-cpp>/bin/libgodot-cpp.linux.template_debug.dev.double.x86_64.a <skipping a very long list of absolute paths to *.o files>
scons: *** [<godot-cpp-private-fork>/bin/libgodot-cpp.linux.template_debug.dev.double.x86_64.a] sh: Argument list too long
scons: building terminated because of errors.
In the ar rc
command, 1050 object files are listed, including the 94 from my project. The total length of the arguments is 131,107 characters. I believe the error occurs because the arguments are interpreted as a single entity, exceeding the system's limit of MAX_ARG_STRLEN (131,072).
To confirm this, I commented out some of my GDREGISTER_CLASS
calls to reduce the total argument length below the threshold, and the build succeeded. Another potential workaround could be relocating my project to a directory with a shorter path (though I haven’t tested this; my current project path is only 47 characters long).
As Godot continues to grow, I suspect more users on similar Unix-like systems will encounter this limitation.
I'm unsure whether to report this issue to godot-cpp, or even scons directly, given its potential impact on Godot’s documentation. Please let me know if I should transfer this bug report elsewhere.
Notes:
- The issue occurs with both scons 4.0 and 4.9.
- Enabling the scons stack trace (
--debug=stacktrace
) produces the following error when the build fails:
scons: internal stack trace:
File "/home/mla/.local/lib/python3.10/site-packages/SCons/Taskmaster/Job.py", line 737, in _work
task.execute()
File "/home/mla/.local/lib/python3.10/site-packages/SCons/Script/Main.py", line 224, in execute
SCons.Taskmaster.OutOfDateTask.execute(self)
File "/home/mla/.local/lib/python3.10/site-packages/SCons/Taskmaster/__init__.py", line 263, in execute
raise buildError
Steps to reproduce
Increase the number of classes registered to ClassDB
then build the GDextension C++ example
Minimal reproduction project (MRP)
Let me know if you need one (it's not a trivial task)