Tests: failure when LTO is enabled
CMake fails to execute its build-time tests on many architectures when compiled with an LTO enabled toolchain. For example on Ubuntu/s390x (GCC-12 + LTO) we saw the following failure:
CustomCommand test fails (LP: #2015872):
No INFO:symbol[pcStatic] found in: /<<PKGBUILDDIR>>/Build/Tests/CustomCommand/bin/libpcStatic.a
Instead, it produces the following strings (`strings bin/libpcStatic.a | grep INFO`):
INFO:symbol[]
INFO:symbol[pcStatic]
We also observed failures on amd64, arm64 and ppc64el in addition to s390x: https://git.launchpad.net/ubuntu/+source/lto-disabled-list/commit/?h=ubuntu/devel&id=57f7f783
This can be redproduced by compling CMake, adding the flags -flto=auto -ffat-lto-objects
to CFLAGS, CXXFLAGS, OBJCFLAGS, ...
and the flag -flto=auto
to LDFLAGS
For reference: