# Module cargo_test_support::cross_compile

source ·
Expand description

Support for cross-compile tests with the `--target` flag.

Note that cross-testing is very limited. You need to install the “alternate” target to the host (32-bit for 64-bit hosts or vice-versa).

Set CFG_DISABLE_CROSS_TESTS=1 environment variable to disable these tests if you are unable to use the alternate target. Unfortunately 32-bit support on macOS is going away, so macOS users are out of luck.

These tests are all disabled on rust-lang/rust’s CI, but run in Cargo’s CI.

## Statics

- CAN_RUN_ON_HOST 🔒
  Whether or not the resulting cross binaries can run on the host.

## Functions

- alternate
  The alternate target-triple to build with.
- alternate_arch
- can_run_on_host
  Whether or not the host can run cross-compiled executables.
- disabled
- native
  The arch triple of the test-running host.
- native_arch
- unused
  A target-triple that is neither the host nor the target.