Skip to content

Support cross-compile install #42320

Closed
Closed
@infinity0

Description

@infinity0

I can't get a cross-compiled install to work, it keeps installing the build (native) architecture's binaries and libraries instead of the host (foreign) architecture binaries and libraries. Even if I do ./x.py dist --install --host $HOST --target $TARGET these extra flags just get ignored.

As an example, cross-compiling from a build machine x86_64 to a foreign host aarch64:

$ file build/aarch64-unknown-linux-gnu/stage2/bin/rustc 
build/aarch64-unknown-linux-gnu/stage2/bin/rustc: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[sha1]=8d7ac7fba3b40cd623567a15f250a9c397d5a063, not stripped
[..]
$ DESTDIR=/build/rustc-mIBviY/rustc-1.17.0+dfsg2/debian/tmp ./x.py dist --config debian/config.toml -v --host aarch64-unknown-linux-gnu --target aarch64-unknown-linux-gnu --install
[..]
bootstrap top targets:
	Step { name: "install", stage: 2, host: "x86_64-unknown-linux-gnu", target: "x86_64-unknown-linux-gnu" }

It looks like this is hardcoded into step.rs:

            sbuild: Step {
                stage: build.flags.stage.unwrap_or(2),
                target: &build.config.build,
                host: &build.config.build,
                name: "",
            },

It would be good if a cross-compile install were possible. Otherwise I'd have to manually hack up some custom install scripts to install the files directly from build/aarch64-unknown-linux-gnu/stage2/.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions