-
Notifications
You must be signed in to change notification settings - Fork 7.4k
toolchains: combine host variants #90670
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
base: main
Are you sure you want to change the base?
Conversation
Combine toolchains provided by the host into one variant. This includes both gcc and llvm installationt typically coming from the distribution (on Linux). Both gcc and llvm are now part of the 'host' variant, the default is the gnu compiler, so setting ZEPHYR_TOOLCHAIN_VARIANT=host Will select the gnu compiler. To select llvm or any other compuler provided in this variant, use the follwoing format: ZEPHYR_TOOLCHAIN_VARIANT=<variant>/<compiler> The following will select llvm: ZEPHYR_TOOLCHAIN_VARIANT=host/llvm Although gnu is the default, it can also be selected using the above syntax: ZEPHYR_TOOLCHAIN_VARIANT=host/gcc This commit removes the llvm variant for now, it should be deperecated in another commit to follow. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
@@ -0,0 +1,9 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing SPDX/license header
# This file intentionally left blank. | ||
if(TOOLCHAIN_VARIANT_COMPILER STREQUAL "gnu" OR | ||
TOOLCHAIN_VARIANT_COMPILER STREQUAL "default") | ||
include(${ZEPHYR_BASE}/cmake/toolchain/host/gnu/target.cmake) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
include(${ZEPHYR_BASE}/cmake/toolchain/host/gnu/target.cmake) | |
include(${ZEPHYR_BASE}/cmake/toolchain/host/gnu/target.cmake) |
|
I'm very much in favor of cleaning up Zephyr's toolchain variants. However, I think removing llvm as it's own variant is a mistake.
It also supports cross-compilation, both using the LLVM provided with your favorite distribution (such as Ubuntu) or using a dedicated LLVM toolchain build, such as: Arm Toolchain for Embedded (ATfE), https://docs.zephyrproject.org/latest/develop/toolchains/arm_toolchain_for_embedded.html#arm-toolchain-for-embedded-atfe. For example, I can use LLVM from Ubuntu to build for an nRF52840dk, all I need is the correct compiler-rt for my target and using lld as linker. lld is provided as part of the llvm package. Using lld and compiler-rt on the other hand works like a charm:
Let's see what clang reports:
and let's build:
So a successful build using clang from host system (Ubuntu), of course with a corresponding bare-metal compiler-rt.
Instructions on how to cross-compile compiler-rt are described here: https://llvm.org/docs/HowToCrossCompileBuiltinsOnArm.html |
and of course, that exact same llvm toolchain also works when building for the host (
so one toolchain, |
you probably need to read this: #90239 (comment) |
Combine toolchains provided by the host into one variant. This includes
both gcc and llvm installationt typically coming from the distribution
(on Linux).
Both gcc and llvm are now part of the 'host' variant, the default is the
gnu compiler, so setting
Will select the gnu compiler. To select llvm or any other compuler
provided in this variant, use the follwoing format:
The following will select llvm:
Although gnu is the default, it can also be selected using the above
syntax:
This commit removes the llvm variant for now, it should be deperecated
in another commit to follow.
Resolves #90239
Signed-off-by: Anas Nashif anas.nashif@intel.com