Extremely long build times


I’m working on project targetting Raspberry Pi OS (Linux) and I’m experiencing extremely long build times (> 6 minutes).

Environment Status Duration

RPI4Bullseye SUCCESS 00:06:15.321

The project links a lot of static libraries which results in a binary of approx 40Mb. (For various reasons I cannot use dynamic/shared libraries.)

I tried to set lib_ldf_mode to ‘deep+’ and ‘chain+’, but this has little or no impact on the build time.

I’m not 100% sure, but as I remember there has been a large increase in the build time (going from estimated +/- 1 min to > 6min) after I added the Open62541 OPC-UA library. Unfortunately I cannot easily remove this library since it has been used in many different places thourghout the code.

Do you have any suggestions how to improve the build time (without excluding libraries)?



  • Using remote ssh to develop and build directly on the Pi.
  • Raspberry Pi4 8Gb running Pi OS Lite x64
  • Using g++ (Debian 10.2.1-6) 10.2.1 20210110