Skip to content

--sysroot ignored by -vV #135165

Closed
Closed
@bjorn3

Description

@bjorn3

I tried this:

Put a custom codegen backend in a custom sysroot and call rustc -vV --sysroot /path/to/sysroot -Zcodegen-backend=my_backend.

I expected to see this happen: Among other things the version of the custom codegen backend is printed.

Instead, this happened: After rustc's own version, it prints error: unsupported builtin codegen backend `my_backend` and exits with an error code.

This is blocking me from putting a locally built cg_clif in a custom sysroot and then using profile.dev.codegen-backend = "cranelift" as opposed to using RUSTFLAGS="-Zcodegen-backend=/path/to/librustc_codegen_cranelift.so". Cargo only supports setting the codegen backend using profiles for codegen backends that are part of a sysroot, but configuring the codegen backend on a per-package basis requires using a cargo profile setting rather than RUSTFLAGS.

Meta

rustc --version --verbose:

rustc 1.86.0-nightly (b3b368a18 2025-01-05)
binary: rustc
commit-hash: b3b368a1833a26f5d48f51c45159f46e6cd01711
commit-date: 2025-01-05
host: x86_64-unknown-linux-gnu
release: 1.86.0-nightly
error: unsupported builtin codegen backend `my_backend`

let sysroot = filesearch::materialize_sysroot(opts.maybe_sysroot.clone());
needs to be changed to manually parse the --sysroot flag rather than taking opts.maybe_sysroot from Options::default().

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-CLIArea: Command-line interface (CLI) to the compilerA-craneliftThings relevant to the [future] cranelift backendC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions