What is a "default host triple" in Rust?
Asked Answered
S

1

27

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.

Stocking answered 19/3, 2018 at 16:47 Comment(1)
It's no longer a target "triple" but a quintic value. Check target-lexicon's struct Triple for the fields and the definition: Historically such things had three fields, though they’ve added additional fields over time.Odilo
D
29

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:

Dropkick answered 19/3, 2018 at 16:54 Comment(11)
Not surprised that it has an Automake history. I have always hated Autotools.Stocking
@Sabuncu: Actually, it has no automake history. This is a fundamental building block of compilers, and automake just had to deal with it.Chateau
@MatthieuM. Oh, OK then. Thanks for the clarification.Stocking
@MatthieuM. Are you sure about that? I was under the impression that the specific cpu-vendor-os format was a GNU invention.Dropkick
@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.Chateau
@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.Dropkick
@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.Chateau
For my Ubuntu it shows: x86_64-unknown-linux-gnu. Now I understand what is it! arch = x86_64, vendor = unknown, sys = linux, abi = gnuFernandez
intresting, but windows ist not a vendor :PFavourite
@Favourite Right, "windows" is the OS. The vendor is "pc" or possibly "unknown"Dropkick
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.Hasseman

© 2022 - 2024 — McMap. All rights reserved.