Rust-toolchain.toml target is ignored

I am developing Servo on Windows (don't ask why) and I need to run a debugger. First, I tried running rust-lldb and got:

error: the 'rust-lldb.exe' binary, normally provided by the 'rustc' component, is not applicable to the '1.89.0-x86_64-pc-windows-msvc' toolchain

To be clear, lldb (rather than rust-lldb) works, but I can't inspect frame variables, which I need to do. This answer advised to use the non-MSVC toolchain instead. So, I installed the x86_64-pc-windows-gnu toolchain. I then added this line to my rust-toolchain.toml:

targets = [ "x86_64-pc-windows-gnu" ]

But even after building the project, running rustup show gives me:

Default host: x86_64-pc-windows-msvc
rustup home:  C:\Users\me\.rustup

installed toolchains
--------------------
stable-x86_64-pc-windows-gnu
stable-x86_64-pc-windows-msvc (default)
nightly-x86_64-pc-windows-msvc
nightly-2021-11-02-x86_64-pc-windows-msvc
nightly-2024-12-15-x86_64-pc-windows-msvc
1.65.0-x86_64-pc-windows-msvc
1.85-x86_64-pc-windows-msvc
1.89.0-x86_64-pc-windows-gnu
1.89.0-x86_64-pc-windows-msvc (active)

active toolchain
----------------
name: 1.89.0-x86_64-pc-windows-msvc
active because: overridden by 'D:\path\to\servo\rust-toolchain.toml'
installed targets:
  x86_64-pc-windows-gnu
  x86_64-pc-windows-msvc

How do I get it to use the gnu toolchain?

rust-lldb is part of the rustc component which is always installed for the host triple. targets = ... only installs different versions of the rust-std component for cross-compilation. There is no way to set the host triple in rust-toolchain.toml. You can only configure that using a rustup command. Don't remember of the top of my head how exactly though.

1 Like

Here's the list of options for setting the host toolchain via rustup, though they do list rust-toolchain.toml in there too which isn't quite what you want here as mentioned by @bjorn3 :

You can also set it in cargo specific configuration with build.target:

1 Like

setting an override for individual directory:

$ rustup override set --path /directory/to/project stable-x86_64-pc-windows-gnu

setting the default host triple globally:

$ rustup set default-host x86_64-pc-windows-gnu
1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.