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

Ensure cross-build compatibility of build.rs #49

Merged
merged 1 commit into from
Jul 5, 2023

Conversation

Guiguiprim
Copy link
Contributor

This changes make it possible to cross compile for MacOS.

@hoodie
Copy link
Collaborator

hoodie commented Jul 3, 2023

thanks. what exactly is the difference?

@Guiguiprim
Copy link
Contributor Author

When cross-compiling on platform A for platform B, the code itself is build for B but build.rs are build for A as they need to be executed during the compilation process. As a result inside build.rs, cfg!(target_os) will have a value related to A whereas std::env::var("CARGO_CFG_TARGET_OS") will have a value related to B.

In the build.rs we want to do stuff if we are building for macos not from macos, and the right way for testing it is through the adequate env and not cfg, this sadly is a error commonly done.

@hoodie hoodie merged commit abdc433 into h4llow3En:master Jul 5, 2023
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