Skip to content

Support non-host target for cargo install #3810

Closed
@raphaelcohn

Description

@raphaelcohn

On some systems cargo install needs to build and install binaries which are slightly different target to itself. For instance, on an Alpine Linux system, I might be using a rustup-installed x86_64-unknown-linux-gnu build of rust with LT_INTERP changed with patchelf, but I want to then build and install binaries as x86_64-unknown-linux-musl. It'd be nice to either have a default host, like rustup set default-host, or to take a switch --target like cargo build. cargo install seems to ignore environment variables like CARGO_BUILD_TARGET, too.

This need is also likely on some Windows systems (running i686 and x86_64), multilib Linux systems (eg imagine if a rust binary makes use of a proprietary i686 lib on a 64-bit system), and systems where the user space is usually 32-bit (Solaris IIRC, x64_32 linux).

This need would be mitigated substantially for me personally if rustup deployed a musl-statically-linked toolchain...

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cross-compilingArea: using --target flag for other platformsC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-install

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions