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

jobserver doesn't always work #177

Open
BusyJay opened this issue Feb 21, 2023 · 2 comments · May be fixed by #229
Open

jobserver doesn't always work #177

BusyJay opened this issue Feb 21, 2023 · 2 comments · May be fixed by #229

Comments

@BusyJay
Copy link
Contributor

BusyJay commented Feb 21, 2023

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 rust-lang/jobserver-rs#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
Copy link

I wonder if this is related to #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.

@kesyog
Copy link

kesyog commented Dec 27, 2024

I have a PR in #229 that fixes this issue on OSX, at least in the cases that I ran into, by disabling jobserver support on that platform. Based on my investigation, jobserver support is broken on OSX when using cmake --build to launch make, as make is blocked from inheriting the cargo jobserver's file descriptors.

rust-lang/jobserver-rs#47 does seem like a potential alternative long-term fix, but based on rust-lang/cargo#13483 (comment), I don't think it's possible anytime soon.

I've also created an issue in CMake's issue tracker: https://gitlab.kitware.com/cmake/cmake/-/issues/26560

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants