rust-lang / rust-lang/cargo

Cargo should support explicitly specifying a host target for build scripts

Open
#3,915 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

A-build-scripts A-configuration C-feature-request Command-build S-triage
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

We ran into a situation in the Mozilla build system, when doing a Windows 32-bit build (using 32-bit MozillaBuild shell) on a 64-bit Windows machine. In this situation the MozillaBuild shell has invoked vcvars.bat to set up a 32-bit build environment, but cargo still tries to do a 64-bit build for build scripts. This results in failure.

More context in bug 1350001. I'm filing this bug as a result of comment 9 in that thread, by @alexcrichton. Specifically:

Cargo could support explicitly specifying a host target (or build target I guess is the autotools name) where it "cross compiles" build scripts.

Although we fixed bug 1350001 by running cargo build in a "clean" environment (with env vars stripped out) that is not ideal and caused other breakages (such as bug 1355464). Fixing this in cargo would be a better solution.

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

No Cargo files, tests, or entry points are named. Start by reading the issue and the linked Mozilla bugs, then trace how Cargo selects targets for build scripts. Done means Cargo can explicitly select a host target for build scripts and handles the Windows 32-bit-on-64-bit scenario without relying on a cleaned environment.

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
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.