25

While doing a custom installation of Rust on Windows 10, I am asked "Default host triple?"

I have no clue what this is, and the Rustup repository page, which came up in a web search, does not really explain it.

kmdreko
  • 42,554
  • 6
  • 57
  • 106
Sabuncu
  • 5,095
  • 5
  • 55
  • 89
  • 1
    It's no longer a target "triple" but a quintic value. Check [target-lexicon](https://docs.rs/target-lexicon/latest/target_lexicon/struct.Triple.html)'s `struct Triple` for the fields and the definition: _Historically such things had three fields, though they’ve added additional fields over time._ – legends2k Aug 17 '23 at 08:27

1 Answers1

27

Host triples identify the architecture and OS of the system that will ultimately run your executable. Mine is x86_64-pc-linux-gnu for example. The general form is cpu-vendor-os. Windows might be something like x86_64-pc-windows-msvc. You can read more at these links:

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
Tavian Barnes
  • 12,477
  • 4
  • 45
  • 118
  • 1
    Not surprised that it has an Automake history. I have always hated Autotools. – Sabuncu Mar 19 '18 at 17:47
  • 2
    @Sabuncu: Actually, it has no automake history. This is a fundamental building block of compilers, and automake just had to deal with it. – Matthieu M. Mar 20 '18 at 09:46
  • @MatthieuM. Oh, OK then. Thanks for the clarification. – Sabuncu Mar 20 '18 at 09:53
  • 1
    @MatthieuM. Are you sure about that? I was under the impression that the specific cpu-vendor-os format was a GNU invention. – Tavian Barnes Mar 20 '18 at 14:41
  • @TavianBarnes: I am not sure how being a GNU invention would not make it a compiler specificity? Triplets appear out of the need of cross-compiling, I would expect, as a compiler which only ever generates code for the platform it runs on need not be aware of any target triplet. – Matthieu M. Mar 20 '18 at 14:47
  • @MatthieuM. I'm questioning whether they are a "fundamental building block of compilers" since compilers are much older than the GNU project. There are also other compilers (MSVC for example) that don't use that format. – Tavian Barnes Mar 20 '18 at 14:52
  • 2
    @TavianBarnes: Ah! You are trying to read way too much in my statement, I fear. (1) I was more talking about cross-compiling capabilities, and a way to indicate the target, than about platform triplets specifically to be honest. (2) Cross-compiling is only something native AOT compilers care about; JIT compilers don't care, compilers to IR don't care, ... So, yes, the sentence is not as precise as it could be; it's a careless comment, not a carefully thought-out answer. – Matthieu M. Mar 20 '18 at 15:02
  • 4
    For my `Ubuntu` it shows: `x86_64-unknown-linux-gnu`. Now [I understand](https://clang.llvm.org/docs/CrossCompilation.html#general-cross-compilation-options-in-clang) what is it! `arch = x86_64`, `vendor = unknown`, `sys = linux`, `abi = gnu` – Alexey Vol Mar 18 '19 at 19:38
  • intresting, but windows ist not a vendor :P – Sebi2020 Jul 17 '21 at 21:05
  • @Sebi2020 Right, "windows" is the OS. The vendor is "pc" or possibly "unknown" – Tavian Barnes Jul 17 '21 at 21:57
  • If I'm developing on windows but I'm ONLY targeting esp32 (esp32c3), do I still need the "linker and Windows API libraries" that rustup wants to see? What is the right default host triple? rustup doesn't ultimately like the target "riscv32im-unknown-none-elf" as a host-triple. – Jason Kleban Jul 28 '23 at 20:44