Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cross-compile same-triple problem using unstable flags even for stable channel #137

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions classes/cargo.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,31 @@ cargo_do_compile() {
export TARGET_CXX="${WRAPPER_DIR}/cxx-wrapper.sh"
export CC="${WRAPPER_DIR}/cc-native-wrapper.sh"
export CXX="${WRAPPER_DIR}/cxx-native-wrapper.sh"
export TARGET_LD="${WRAPPER_DIR}/ld-wrapper.sh"
export LD="${WRAPPER_DIR}/ld-native-wrapper.sh"
export TARGET_LD="${WRAPPER_DIR}/linker-wrapper.sh"
export LD="${WRAPPER_DIR}/linker-native-wrapper.sh"

# Protection against cross compile where host triple matches target triple but host tools do not match target tools
# enable nightly options
# CARGO_UNSTABLE_TARGET_APPLIES_TO_HOST enables CARGO_TARGET_APPLIES_TO_HOST in non-nightly builds
# CARGO_UNSTABLE_HOST_CONFIG="true" enables CARGO_HOST_LINKER="gcc" and other host tools configurations
export __CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS="nightly"
export CARGO_UNSTABLE_TARGET_APPLIES_TO_HOST="true"
export CARGO_TARGET_APPLIES_TO_HOST="false"
export CARGO_UNSTABLE_HOST_CONFIG="true"

export CARGO_TARGET_LINKER="$TARGET_LD"
export TARGET_LINKER="$TARGET_LD"
export CARGO_TARGET_CC="$TARGET_CC"
export CARGO_TARGET_CXX="$TARGET_CXX"

export CARGO_HOST_LINKER="$LD"
export HOST_LINKER="$LD"
export HOST_LD="$LD"
export CARGO_HOST_CC="$CC"
export HOST_CC="$CC"
export CARGO_HOST_CXX="$CXX"
export HOST_CXX="$CXX"

export PKG_CONFIG_ALLOW_CROSS="1"
export LDFLAGS=""
export RUSTFLAGS="${RUSTFLAGS}"
Expand Down