Building a statically linked binary which uses Libtooling

I recently found a few bugs in one of the tools I built (github.com/dgrobb/nett) which uses the Libtooling framework. The bugs arose because the framework built the incorrect AST when stdbool.h was included in the source file being analysed. This was back in release 10.0.0

By building my tool against release 12.0.0, these bugs still exist, however somewhere between that and commit 82fbc5d it appears to be fixed. The issue I’m having now is that I can no longer build my program with the -static flag in the later versions due to changes in the included libraries. The primary error message I get is: “attempted static link of dynamic object `/usr/lib/x86_64-linux-gnu/libz.so’” although I suspect /usr/lib/x86_64-linux-gnu/libtinfo.so will also cause issues.

Is there a way around this? I need to build a statically linked binary since the program is being run on an older system with outdated libraries and cannot be built natively.

Thanks in advance,
Danie