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

Support host builds using clang toolchain #2798

Merged
merged 3 commits into from
Jun 12, 2024

Conversation

mikee47
Copy link
Contributor

@mikee47 mikee47 commented Jun 11, 2024

This PR adds the CLANG_BUILD for host builds. The toolchain detection logic is in the main build.mk file as there might be future support for clang toolchains for actual devices. It's also a revision to the existing logic which checks GCC compiler version.

Try it out using make SMING_SOC=host CLANG_BUILD=1.
To build with a specific (installed) version of clang, for example clang-15, use CLANG_BUILD=15 .
Further customisation can be made by editing Sming/Arch/Host/build.mk.

Clang-tidy support (#2648) is also improved as there are some compiler flag differences between GCC and clang which are now shared between CLANG_TIDY and CLANG_BUILD operation.

An extra CI build has been added using clang.

Further to #2773, the default toolchain for macos is a version of clang (Apple Clang). This PR doesn't quite support that because there are other issues to address, but it's a step in the right direction.

Whilst currently only for Host, toolchain detection logic is in main build.mk file for Sming.
This paves the way for clang embedded toolchains.

Requires extended toolchain version detection.
CLANG_TIDY can use same settings as for regular clang build
Rename `GCC_VERSION` as `COMPILER_VERSION`, add `COMPILER_NAME`
Full compiler version strings can include spaces, e.g. "Apple clang version 11.0.0 (clang-1100.0.33.17)"
Interpreted as "Apple-clang", "11.0.0"

Notice printed if using clang, but only once in any given build invocation.
@slaff slaff added this to the 5.2.0 milestone Jun 11, 2024
mikee47 added 2 commits June 11, 2024 15:28
There are plenty warnings; sort these later
@slaff slaff merged commit d4f490f into SmingHub:develop Jun 12, 2024
39 checks passed
@mikee47 mikee47 deleted the feature/clang-build branch June 12, 2024 11:01
slaff pushed a commit that referenced this pull request Jun 19, 2024
Compiler detection was changed in #2798 but did not take locale into account.

This PR fixes the problem using `LANG=C` as recommended in #2816.

Also if a failure occurs the command output accompanies the error message to make diagnosis a little easier next time.
@slaff slaff mentioned this pull request Jul 4, 2024
5 tasks
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

Successfully merging this pull request may close these issues.

2 participants