Godot Version
4.3 (Arch Linux)
Question
I’ve been using Godot for about a week, starting with version 4.2.2, and had no issues using GDExtension with C++. However, after upgrading to version 4.3, I encountered a problem when trying to compile my GDExtension for Android.
When I compile the Godot C++ binding (godot-cpp
) with scons platform=linux api_file=4.3
, it compiles without any issues. But when I try to compile my GDExtension with scons platform=android
, I get a SCons error during linking that says:
scons: *** [libgodot-cpp.android.template_debug.arm64.a] sh: Argument list too long
scons: building terminated because of errors.
This error did not occur in version 4.2.2, where I was able to successfully compile both Linux and Android versions of my GDExtension. Interestingly, using scons platform=linux
for my GDExtension still works fine, so the issue seems specific to Android (ARM64) when linking against the Godot 4.3 C++ binding (godot-cpp
).
Since I’m new to Godot (just 3 days in) and its build system (SCons), I might be making a mistake, but given that everything worked in 4.2.2, I suspect it could be an issue with the new version. I’m not new to game development, and I consider myself a competent C++ programmer, so I’m not completely lost.
Thank you for any help you can provide. Here’s my setup and the exact error message:
Error Message
Building for architecture x86_64 on platform linux
scons: done reading SConscript files.
scons: Building targets ...
Linking Static Library /home/richmariii/Dev/GodotProjects/RetroVision/godot-src/godot-cpp/bin/libgodot-cpp.linux.template_debug.x86_64.a ...
Linking Static Library /home/richmariii/Dev/GodotProjects/RetroVision/godot-src/godot-cpp/bin/libgodot-cpp.android.template_debug.arm64.a ...
Compiling shared src/LibRetroFrontEnd.cpp ...
Compiling shared src/RegisterTypes.cpp ...
scons: *** [/home/richmariii/Dev/GodotProjects/RetroVision/godot-src/godot-cpp/bin/libgodot-cpp.android.template_debug.arm64.a] sh: Argument list too long
scons: building terminated because of errors.
Ranlib Library /home/richmariii/Dev/GodotProjects/RetroVision/godot-src/godot-cpp/bin/libgodot-cpp.linux.template_debug.x86_64.a ...
Linking Shared Library bin/libRetro.linux.template_debug.x86_64.so ...
scons: done building targets.
SCons Build File
#!/usr/bin/env python
import os
import sys
env = SConscript("../../godot-src/godot-cpp/SConstruct")
# For reference:
# - CCFLAGS are compilation flags shared between C and C++
# - CFLAGS are for C-specific compilation flags
# - CXXFLAGS are for C++-specific compilation flags
# - CPPFLAGS are for pre-processor flags
# - CPPDEFINES are for pre-processor defines
# - LINKFLAGS are for linking flags
env.Append(CPPPATH=["src/"])
sources = Glob("src/*.cpp")
if env["platform"] == "macos":
library = env.SharedLibrary(
"bin/libRetro.{}.{}.framework/libRetro.{}.{}".format(
env["platform"], env["target"], env["platform"], env["target"]
),
source=sources,
)
else:
library = env.SharedLibrary(
"bin/libRetro{}{}".format(env["suffix"], env["SHLIBSUFFIX"]),
source=sources,
)
Default(library)