Fix building with -j1 flag
MODIFY
build.rs
build.rs
@@ -222,7 +222,24 @@ fn build_compiler(opencv: &Library) -> cc::Build {
}
fn build_job_server() -> Option<jobserver::Client> {
- unsafe { jobserver::Client::from_env() }.or_else(|| {
+ unsafe { jobserver::Client::from_env() }
+ .and_then(|c| {
+ let available_jobs = c.available().unwrap_or(0);
+ if available_jobs > 0 {
+ eprintln!(
+ "=== Using environment job server with the the amount of available jobs: {}",
+ available_jobs
+ );
+ Some(c)
+ } else {
+ eprintln!(
+ "=== Available jobs from the environment created jobserver is: {} or there is an error reading that value",
+ available_jobs
+ );
+ None
+ }
+ })
+ .or_else(|| {
let num_jobs = env::var("NUM_JOBS")
.ok()
.and_then(|jobs| jobs.parse().ok())

Fix building with -j1 flag