Skip to content

cargo: fix package cross-compilation#6402

Merged
waruqi merged 5 commits intoxmake-io:devfrom
SirLynix:rust-cross
May 8, 2025
Merged

cargo: fix package cross-compilation#6402
waruqi merged 5 commits intoxmake-io:devfrom
SirLynix:rust-cross

Conversation

@SirLynix
Copy link
Member

@SirLynix SirLynix commented May 7, 2025

Fixes cross-compilation with Cargo by passing the proper triple automatically
Also, the /host folder has to be passed to rustc to find some library (tested with naga)

Fixes xmake-io/xmake-repo#7023

end


local target = import("private.tools.rust.target_triple")(toolchain:plat(), toolchain:arch(), opt)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move import to head


local target = target_triple(toolchain:plat(), toolchain:arch(), opt)
if target then
toolchain:add("rcflags", "--verbose")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why? if we want to get verbose info, we should use option.get("verbose") and option.get("diagnosis")

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a leftover, I'm removing it

@waruqi waruqi merged commit 0d2657c into xmake-io:dev May 8, 2025
22 checks passed
@waruqi waruqi added this to the v3.0.0 milestone May 8, 2025
@SirLynix SirLynix deleted the rust-cross branch May 8, 2025 22:55
@waruqi
Copy link
Member

waruqi commented Jun 29, 2025

It will generate incorrect arch. #6574

on macOS

xmake f -a aarch64-unknown-none
/usr/local/bin/rustc --target=aarch64-unknown-none-apple-darwin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants