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 querying emcc on windows #4248

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

guusw
Copy link

@guusw guusw commented Jan 23, 2025

Pretty minor change, just queries emcc.bat since emcc will not work on windows

For example this simple script will output this on windows

fn main() {
    let output = std::process::Command::new("emcc.bat").arg("-dumpversion").output().ok();
    println!("{:?}", output);
    let output1 = std::process::Command::new("emcc").arg("-dumpversion").output().ok();
    println!("{:?}", output1);
}
rustc test.rs && ./test.exe
Some(Output { status: ExitStatus(ExitStatus(0)), stdout: "3.1.74\r\n", stderr: "" })
None

@rustbot
Copy link
Collaborator

rustbot commented Jan 23, 2025

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @tgross35 (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

build.rs Outdated
Comment on lines 215 to 218
#[cfg(target_os = "windows")]
let output = Command::new("emcc.bat").arg("-dumpversion").output().ok()?;

#[cfg(not(target_os = "windows"))]
Copy link
Contributor

@tgross35 tgross35 Jan 27, 2025

Choose a reason for hiding this comment

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

Nit: could you use if cfg!(target_os = "windows") { ... } here instead? cfg!(...) is slightly preferred over #[cfg(...)] where possible since it allows the code to be checked on all OSs.

Otherwise lgtm, please squash with the change.

Fyi @hoodmane.

Copy link
Author

Choose a reason for hiding this comment

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

Applied this

@guusw
Copy link
Author

guusw commented Feb 11, 2025

Could this go on 0.2 as well once it's merged?

@hoodmane
Copy link
Contributor

Cc @messense maybe we want this change in maturin too?

@messense
Copy link
Contributor

Cc @messense maybe we want this change in maturin too?

Done in PyO3/maturin#2478

messense added a commit to PyO3/maturin that referenced this pull request Feb 11, 2025
@tgross35
Copy link
Contributor

Could this go on 0.2 as well once it's merged?

Fyi anyone can add the label, it's just

@rustbot label +stable-nominated

@rustbot rustbot added the stable-nominated This PR should be considered for cherry-pick to libc's stable release branch label Feb 14, 2025
@tgross35 tgross35 enabled auto-merge February 14, 2025 20:50
@tgross35
Copy link
Contributor

Looks like this needs a rebase, could you do that?

@tgross35
Copy link
Contributor

@rustbot author for the rebase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author stable-nominated This PR should be considered for cherry-pick to libc's stable release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants