The error occurs because you’re using -Wl,-Bstatic, which makes the linker try to statically link all libraries, including system ones like libgcc_s, which usually only exist as shared libraries on Linux. To fix this and statically link only SDL, modify your command to switch back to dynamic linking after SDL:
c++ -std=c++23 -ISDL/include main.cpp -LSDL/build -Wl,-Bstatic -lSDL3 -Wl,-Bdynamic
This links SDL statically while keeping the rest dynamic. Fully static builds require static versions of all libraries (like libc and libstdc++), which are uncommon on most Linux systems.