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

Set ZIG_COMMAND env var for downstream #36

Closed
wants to merge 1 commit into from
Closed

Conversation

messense
Copy link
Member

No description provided.

@messense messense temporarily deployed to Docker Hub May 15, 2022 02:01 Inactive
@messense
Copy link
Member Author

@ravenexp

@@ -188,7 +188,10 @@ impl Zig {
}
}

let mut child = Self::command()?
let mut zig = Self::command()?;
env::set_var("ZIG_COMMAND", format!("{:?}", zig));
Copy link
Member Author

@messense messense May 15, 2022

Choose a reason for hiding this comment

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

It's "zig" or "python3" "-m" "ziglang". I think we should get rid of the double quotes if downstream want to reconstruct a command from it, or leave it as is if downstream just use it to detect whether it's using the pypi version or not.

@messense
Copy link
Member Author

On second thought I think doing this in maturin makes more sense since for Windows MSVC we need to use cargo-xwin to drive the build, but we can call Zig::find_zig to find zig and set env var for python3-dll-a along the way.

@messense messense closed this May 15, 2022
@messense messense deleted the zig-command-env branch May 15, 2022 02:15
@ravenexp
Copy link

I think it is useful to set ZIG_COMMAND regardless, because there is also the x86_64-pc-windows-gnu target which is also supported by zig cc.

If someone wants to compile an extension like:

maturin build --target x86_64-pc-windows-gnu --zig

The build may fail if MinGW binutils dlltool is used by python3-dll-a instead of llvm-dlltool that Zig uses.
It's better to always use zig dlltool when zig cc is used as the linker.

@messense
Copy link
Member Author

@ravenexp Moved the code to PyO3/maturin#919

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