diff mbox series

[meta-lts-mixins,scarthgap/rust,9/9] rust-target-config.bbclass: move target generation before do_configure

Message ID a0705b87e7c1a257dafb089063f3302ed49c87d3.1757443674.git.scott.murray@konsulko.com
State New
Headers show
Series Update to Rust 1.89.0 | expand

Commit Message

Scott Murray Sept. 9, 2025, 6:49 p.m. UTC
From: Gyorgy Sarvari <skandigraun@gmail.com>

The rust_get_targets task from the rust-target-config class generates some
Rust compiler configurations for different the target and host machine, which
is used by Rust during compiling a recipe. These configurations supposed to
be available by the time the Rust compiler is used for the first time.

By default, this task is executed "before do_compile" - it assumes that
this is the first task that would use this configuration.

However this is not always the case, especially with projects which are not
pure Cargo projects, rather Cargo/Rust is called by a different build system.
As an example librsvg uses meson, and during the do_configure step Meson probes
the Rust compiler, trying to gather some library info from Rust. In case the
rust_gen_targets task was executed before the do_configure task, then
everything works. However this is not always the case - sometimes the job is
executed between the configure and compile steps, in which case the configuration
fails.

To avoid such problems, generate these targets before the do_configure step.

Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(adapted from oe-core commit 1d3c02553122982daedfe32c6ce09fac9e091952)
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
---
 classes-recipe/rust-target-config.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/classes-recipe/rust-target-config.bbclass b/classes-recipe/rust-target-config.bbclass
index bbadd6c..c8acf81 100644
--- a/classes-recipe/rust-target-config.bbclass
+++ b/classes-recipe/rust-target-config.bbclass
@@ -426,7 +426,7 @@  python do_rust_gen_targets () {
     rust_gen_target(d, 'TARGET', wd, d.getVar('TARGET_ARCH'))
 }
 
-addtask rust_gen_targets after do_patch before do_compile
+addtask rust_gen_targets after do_patch before do_configure
 do_rust_gen_targets[dirs] += "${RUST_TARGETS_DIR}"
 
 # For building target C dependecies use only compiler parameters defined in OE