Please note that the native and cross-compilation instructions that @Stennie_X linked to already include the --separate-debug flag, which will already split out the debug symbols into separate files. So you will get reasonably sized binaries from those processes. You can shrink those binaries a little further yet with strip, but I don’t necessarily recommend this, as it will strip out symbol table information that will result in uninterpretable backtraces should the process crash, and the savings aren’t that big. You do still need a lot of storage space to actually build (and a lot of cores if you want reasonable build throughput), which is why I really commend going the cross-compile path if you can. The RPi just isn’t suited to building software of this size from source. The cross-compilation instructions aren’t particularly challenging, and you just need access to a reasonably performant x86_64 machine running Ubuntu to do it.
2 Likes