piaware_builder
piaware_builder copied to clipboard
enable clang build
Hello, following the release of debian 11 arm64 for Raspberry PI, I switched my RPI 3B and tried to compile piaware with clang and optimizations permitting to later increase the safety with the CFI flags.
I managed the build to succeed using this command line
env CC="clang" CXX=clang++ LDSHARED="clang -shared" EXTRA_LDFLAGS="-flto" DEB_BUILD_OPTIONS="hardening=+all optimize=+lto" dpkg-buildpackage -b --no-sign
with a few patches:
-
cx_Freeze generate extra_link_args from EXTRA_LDFLAGS cx_Freeze-6.8.3.txt
-
mlat_client
- debian/rules: switch to pybuild
- modes_message.c: clang spotted an error at line 94: use of || where | is expected
- setup.py: generate extra_link_args from EXTRA_LDFLAGS mlat_client.txt
- tcllauncher This one was more difficult. The build process makes use of a LINK_CC variable, which may reflect the use of a framework called swiftc. The modification has to occur in configure.in tcllauncher.txt
The purpose:
- ensure that "-flto" is used both during compile and link time
- ensure that shared libs are build using "clang -shared" instead of "clang". The second expression fails as it tries to link to crt.o and complain about "main" being undefined.
I also disabled building the dump_978 module: clang complains about extensions (recursive namespace) with are defined only in C++-17
Regards
Pascal