cmake-rs icon indicating copy to clipboard operation
cmake-rs copied to clipboard

jobserver doesn't always work

Open BusyJay opened this issue 2 years ago • 1 comments

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).

BusyJay avatar Feb 21 '23 06:02 BusyJay

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.

Notgnoshi avatar Apr 21 '23 12:04 Notgnoshi