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

Detect cross compilation and adjust Cargo output directory #2099

Closed
alerque opened this issue Aug 31, 2024 · 3 comments · Fixed by #2178
Closed

Detect cross compilation and adjust Cargo output directory #2099

alerque opened this issue Aug 31, 2024 · 3 comments · Fixed by #2178
Assignees
Labels
bug Software bug issue tooling Build tooling, release management, and packaging processes
Milestone

Comments

@alerque
Copy link
Member

alerque commented Aug 31, 2024

Cross compiling with Cargo adds a segment to the output directory with the host info. Currently we don't have a way to detect this and adjust, we just blindly assume the Cargo directory will be "target/release" instead of perhaps "target/x86_64-unknown-linux-gnu/release".

This is a problem for some distro packages, e.g. Void bumped into this.

Somehow we should detect whether cross compilation is being used and what the target triple is.

@alerque alerque added bug Software bug issue tooling Build tooling, release management, and packaging processes labels Aug 31, 2024
@alerque alerque added this to the v0.15.6 milestone Aug 31, 2024
@alerque alerque self-assigned this Aug 31, 2024
@alerque alerque modified the milestones: v0.15.6, v0.15.7 Nov 2, 2024
@alerque
Copy link
Member Author

alerque commented Nov 23, 2024

@Luciogi Any hints on how Void's build system is initializing cross compilation? Are you using the --host <target> configure option or env vars or what?

I think what I did in #2178 will address this by always building into a target directory with the target triple specified, hence not needing the patch you setup. But I'm not 100% sure this will cover all cases. I'd be happy to test some more if I know more about the scenarios where this is an issue.

@Luciogi
Copy link

Luciogi commented Nov 25, 2024

I am not completely familiar with xbps-src internal functions.
Following will be my guess.

sile - template uses

build-style=gnu-configure
build-helper=rust

as problem is with rust output binary location,
xbps-src loads this script before compiling
https://github.com/void-linux/void-packages/blob/master/common/build-helper/rust.sh
https://github.com/void-linux/void-packages/blob/master/common/build-style/gnu-configure.sh

@alerque
Copy link
Member Author

alerque commented Nov 25, 2024

Thanks for the extra information. Given what I see in those scripts I think the fix I added for this is going to work. You could cherry-pick it into the v0.15.6 sources and see if the build works after removing your work around, or just wait for v0.15.7 too see if the workaround can be removed. If not I'm happy to look into this farther.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Software bug issue tooling Build tooling, release management, and packaging processes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants