rust-lang / rust-lang/cargo

Provide a way to specify configuration for host compilation

Open
#5,754 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

A-configuration S-needs-design Z-target-applies-to-host
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

cargo currently supports specifying configuration per-target. Unfortunately, for non-cross-compiles this can lead to undesirable behavior. For example, we build Firefox in many variant configurations, several of which involve passing compiler and linker options that are useful for target binaries but cause problems when used for building things like build scripts. The simplest example here is address sanitizer--we want to compile and link with -fsanitize=address, but linking build scripts with that means they're now running with asan and that's not something we want to do. We have the same problem with our code coverage builds, which compile and link with --coverage.

It would be better if we had a way to explicitly configure host compilation. The simplest proposal I can think of would be to support [host.$triple] keys in config files and use those for host compilation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Cargo's configuration reference, especially the per-target configuration keys, and trace how those settings are applied during host compilation and to build scripts. Compare the proposed [host.$triple] keys with existing target handling; done means host compilation can use separate compiler and linker options without changing target-binary configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.