@samitouri / QOSamiQemu / commits / 6257754bb9

rust: suggest passing --locked to "cargo install"

Without the option, cargo will try using the latest version of the dependencies of bindgen-cli. While it will obviously respect the constraints in Cargo.toml, old versions of Cargo do not have version-constrained resolution and will choke on dependencies that need Rust 2024. Cc: Daniel P. Berrangé <berrange@redhat.com> Cc: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Paolo Bonzini committed Mar 18, 2026 at 08:35 UTC 6257754bb9b00b52018951096a9fba28b98a5b0d
5 files changed +6 -6
docs/about/build-platforms.rst
+1 -1
@@ -114,7 +114,7 @@ Rust build dependencies
114 bindgen tool, which is too big to package and distribute. The minimum
115 supported version of bindgen is 0.60.x. For distributions that do not
116 include bindgen or have an older version, it is recommended to install
117 - a newer version using ``cargo install bindgen-cli``.
117 + a newer version using ``cargo install --locked bindgen-cli``.
118
119 QEMU requires Rust 1.83.0. This is available on all supported platforms
120 except for the ``mips64el`` architecture on Debian bookworm. For all other
meson.build
+1 -1
@@ -114,7 +114,7 @@ if have_rust
114 bindgen = find_program('bindgen', required: get_option('rust'))
115 if not bindgen.found() or bindgen.version().version_compare('<0.60.0')
116 if get_option('rust').enabled()
117 - error('bindgen version ' + bindgen.version() + ' is unsupported. You can install a new version with "cargo install bindgen-cli"')
117 + error('bindgen version ' + bindgen.version() + ' is unsupported. You can install a new version with "cargo install --locked bindgen-cli"')
118 else
119 if bindgen.found()
120 warning('bindgen version ' + bindgen.version() + ' is unsupported, disabling Rust compilation.')
tests/docker/dockerfiles/fedora-rust-nightly.docker
+1 -1
@@ -179,7 +179,7 @@ RUN set -eux && \
179 test "$RUSTDOC" = "$(/usr/local/cargo/bin/rustup +nightly which rustdoc)" && \
180 test "$RUSTC" = "$(/usr/local/cargo/bin/rustup +nightly which rustc)"
181 ENV PATH=$CARGO_HOME/bin:$PATH
182 -RUN /usr/local/cargo/bin/rustup run nightly cargo install bindgen-cli
182 +RUN /usr/local/cargo/bin/rustup run nightly cargo install --locked bindgen-cli
183 RUN $CARGO --list
184 # As a final step configure the user (if env is defined)
185 ARG USER
tests/docker/dockerfiles/ubuntu2204.docker
+1 -1
@@ -162,7 +162,7 @@ ENV CARGO_HOME=/usr/local/cargo
162 ENV PATH=$CARGO_HOME/bin:$PATH
163 RUN DEBIAN_FRONTEND=noninteractive eatmydata \
164 apt install -y --no-install-recommends cargo
165 -RUN cargo install bindgen-cli
165 +RUN cargo install --locked bindgen-cli
166 # As a final step configure the user (if env is defined)
167 ARG USER
168 ARG UID
tests/lcitool/refresh
+2 -2
@@ -147,7 +147,7 @@ fedora_rustup_nightly_extras = [
147 ' test "$RUSTDOC" = "$(/usr/local/cargo/bin/rustup +nightly which rustdoc)" && \\\n',
148 ' test "$RUSTC" = "$(/usr/local/cargo/bin/rustup +nightly which rustc)"\n',
149 'ENV PATH=$CARGO_HOME/bin:$PATH\n',
150 - 'RUN /usr/local/cargo/bin/rustup run nightly cargo install bindgen-cli\n',
150 + 'RUN /usr/local/cargo/bin/rustup run nightly cargo install --locked bindgen-cli\n',
151 'RUN $CARGO --list\n',
152 ]
153
@@ -158,7 +158,7 @@ ubuntu2204_rust_extras = [
158 'ENV PATH=$CARGO_HOME/bin:$PATH\n',
159 "RUN DEBIAN_FRONTEND=noninteractive eatmydata \\\n",
160 " apt install -y --no-install-recommends cargo\n",
161 - 'RUN cargo install bindgen-cli\n',
161 + 'RUN cargo install --locked bindgen-cli\n',
162 ]
163
164 debian_all_test_cross_compilers = [