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.82k stars 440 forks source link

Failing `wasip1` build after upgrade to cc-1.0.100 #1109

Closed Niederb closed 3 months ago

Niederb commented 3 months ago

I have a failing build for wasip1 after one of my transitive dependencies upgraded cc to v1.0.100

error occurred: Environment variable WASI_SYSROOT not defined. Download sysroot from github & setup environment variable WASI_SYSROOT targetting the folder.

(See https://github.com/scs/substrate-api-client/actions/runs/9671307108/job/26681692693 for the failing build) This seems to be caused by this commit: https://github.com/rust-lang/cc-rs/commit/6a6107a26f3290fed3487f436249f4f5c6d4993d

I'm not quite sure how to fix this. So far we relied on a standard Github runner for our builds and no additional setup for wasi was needed.

NobodyXu commented 3 months ago

cc @antaalt can you help me with this issue please?

antaalt commented 3 months ago

I am curious as to how you were building to WASI without a particular setup, for the fix of the build, you can download WASI sysroot from WASI SDK GitHub release pages and setup the WASI_SYSROOT targeting the folder. You will probably still get issues as there is also an issue that need to be fixed with targets

NobodyXu commented 3 months ago

Hello @Niederb can you try cc 1.0.102 to see if it fixed your issue?

NobodyXu commented 3 months ago

Ok I think we'd need to make the WASI_SYSROOT optional, since clang on Linux (or maybe just the Ubuntu-latest runner) seems to come with wasi libraries required.

Niederb commented 3 months ago

Just to confirm: cc 1.0.103 fixed the issue for me 👍