rust-lang / cmake-rs

Rust build dependency for running cmake
https://docs.rs/cmake
Apache License 2.0
301 stars 121 forks source link

jobserver doesn't always work #177

Open BusyJay opened 1 year ago

BusyJay commented 1 year ago

When using cmake-rs to build a native library, I can see some errors on some platform:

make[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.

The problem may be related to https://github.com/alexcrichton/jobserver-rs/issues/47.

This is not an issue with cmake-rs, but cmake-rs can let user to disable jobserver explicitly to get around the problem.

And tikv/grpc-rs# also provides a workaround by setting environment variable CMAKE_BUILD_PARALLEL_LEVEL. And using generator other than make can also get around the problem (setting environment variable MAKE_GENERATOR=Ninja for example).

Notgnoshi commented 1 year ago

I wonder if this is related to https://github.com/rust-lang/cmake-rs/issues/172?

I expect #172 is caused by the caveat mentioned in https://docs.rs/jobserver/latest/jobserver/struct.Client.html#method.from_env about from_env being unsafe to call twice in the same process if the first invocation returned Some.