rust-lang / cc-rs

Rust library for build scripts to compile C/C++ code into a Rust library
https://docs.rs/cc
Apache License 2.0
1.76k stars 425 forks source link

Fix compilation for wasm: env WASI_SYSROOT should be optional #1114

Closed NobodyXu closed 1 week ago

NobodyXu commented 1 week ago

On ubuntu-latest github action runner, it used to work without the environment variable.

Fixed #1109 #1113

NobodyXu commented 1 week ago

cc @Niederb @Kuuuube Can you try this PR please?

cc @antaalt

Kuuuube commented 1 week ago

I'm still able to replicate the issue using this pr.

Kuuuube commented 1 week ago

Noticed that #1105 had this diff

-                } else if target == "wasm32-wasi"
-                    || target == "wasm32-unknown-wasi"
-                    || target == "wasm32-unknown-unknown"
-                {

The wasm32-unknown-wasi and wasm32-unknown-unknown targets were not added to the targets list. Adding them to the list along with your changes in this PR does fix the issue. (without your PR's changes it throws errors by adding those targets)

Threw in a PR targeting this PR's branch. #1115

If theres anything wrong with my changes in that PR feel free to close it or do whatever.