Skip to content

enable clang build #20

@CdeMills

Description

@CdeMills

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions