Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable clang build #20

Open
CdeMills opened this issue Feb 12, 2022 · 0 comments
Open

enable clang build #20

CdeMills opened this issue Feb 12, 2022 · 0 comments

Comments

@CdeMills
Copy link

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:

  1. cx_Freeze
    generate extra_link_args from EXTRA_LDFLAGS
    cx_Freeze-6.8.3.txt

  2. 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
  1. 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:

  1. ensure that "-flto" is used both during compile and link time
  2. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant