[PATCH] D142404: [docs] Prefer setting LLVM_HOST_TRIPLE instead of LLVM_DEFAULT_TARGET_TRIPLE and LLVM_TARGET_ARCH

Sergei Barannikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 24 01:51:13 PST 2023


barannikov88 added a comment.

I'm not very familiar with building runtimes, but in case it helps others:

In D142404#4075115 <https://reviews.llvm.org/D142404#4075115>, @phosek wrote:

> I think that name comes from autoconf <https://www.gnu.org/software/autoconf/manual/autoconf-2.68/html_node/Specifying-Target-Triplets.html> which uses //build// (machine where the software is being built), //host// (machine where the software is going to run) and //target// (machine we're going to generate code for).

There is further explanation here <https://gcc.gnu.org/onlinedocs/gccint/Configure-Terms.html>.

> In the case of target libraries, the machine you’re building for is the machine you specified with --target. So, build is the machine you’re building on (no change there), host is the machine you’re building for (the target libraries are built for the target, so host is the target you specified), and target doesn’t apply (because you’re not building a compiler, you’re building libraries). The configure/make process will adjust these variables as needed.

E.g. if you used `--build=A --host=B --target=C` (building cross compiler on machine `A` that will run on machine `B` and generate code for machine `C`) for building gcc, it will use `--build=A --host=C` when building libraries (`--target` is not applicable).

clang is multi-target and does thus not have `--target` equivalent (`LLVM_DEFAULT_TARGET_TRIPLE` is just the default target). So, when we build the compiler and the runtimes at the same time, we do need some kind of `LLVM_RUNTIME_TRIPLE`.
For example,
`-DLLVM_HOST_TRIPLE=A -DLLVM_DEFAULT_TARGET_TRIPLE=B -DLLVM_RUNTIME_TRIPLE=C`
would build [multi-target] clang that runs on machine `A`, will be used to build runtimes for machine `C`, but by default generate code for machine `B`.

When building runtime libraries only, `LLVM_DEFAULT_TARGET_TRIPLE` is not applicable.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142404/new/

https://reviews.llvm.org/D142404



More information about the llvm-commits mailing list