Skip to content

build: Don't run cargo for the library and rsvg-convert in parallel

Jürg Billeter requested to merge juergbi/librsvg:cargo-notparallel into main

Add an order-only prerequisite to ensure cargo build for librsvg_c_api.la does not run concurrently with cargo build for rsvg-convert.

Parallel runs of cargo may result in shared intermediaries (e.g. .rlib and .so files) to be generated and written twice. Besides unnecessary work, this can occasionally result in odd build failures due to race conditions as not all files are overwritten atomically.

Example of build failure:

error[E0786]: found invalid metadata files for crate `gdk_pixbuf`
 --> src/c_api/pixbuf_utils.rs:8:5
  |
8 | use gdk_pixbuf::{Colorspace, Pixbuf};
  |     ^^^^^^^^^^
  |
  = note: failed to mmap file 'librsvg/target/release/deps/libgdk_pixbuf-521bc62ca2cfd40c.rlib': memory map must have a non-zero length

Merge request reports