summaryrefslogtreecommitdiffstats
path: root/meta/classes-recipe
diff options
context:
space:
mode:
authorOvidiu Panait <ovidiu.panait@windriver.com>2025-09-01 13:34:17 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-09-08 14:05:10 +0100
commit70e8497ce575e7350d85e4e7567a17acec84d8cf (patch)
treebb90c9ee6802448f7e9442da62bef2bffa4cf54e /meta/classes-recipe
parentf81b351440e77d153d8f57a9cfac103e169abcec (diff)
downloadpoky-70e8497ce575e7350d85e4e7567a17acec84d8cf.tar.gz
rust-target-config: fix nativesdk-libstd-rs build with baremetal
If TCLIBC='baremetal' is set in local.conf, nativesdk-libstd-rs build fails with: | error[E0412]: cannot find type `c_char` in the crate root | --> /usr/src/debug/libstd-rs/1.75.0/rustc-1.75.0-src/vendor/libc/src/unix/mod.rs:56:29 | | | 6 | pub type c_schar = i8; | | ---------------------- similarly named type alias `c_schar` defined here | ... | 56 | pub gr_name: *mut ::c_char, | | ^^^^^^ This happens because rust_gen_target() sets os="none" when TCLIBC is 'baremetal' - even for nativesdk targets. However, nativesdk packages are built against glibc, so the correct 'os' value should be "linux". Fix this by setting the os field based on {TARGET,HOST,BUILD}_OS variables, as it is already done in rust_base_triple(), instead of relying on TCLIBC. (From OE-Core rev: 3eaf2cd5647585a1e6df03fc20e2753da27bb692) Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe')
-rw-r--r--meta/classes-recipe/rust-target-config.bbclass3
1 files changed, 2 insertions, 1 deletions
diff --git a/meta/classes-recipe/rust-target-config.bbclass b/meta/classes-recipe/rust-target-config.bbclass
index 8ab5317c3f..2114c5850c 100644
--- a/meta/classes-recipe/rust-target-config.bbclass
+++ b/meta/classes-recipe/rust-target-config.bbclass
@@ -349,6 +349,7 @@ def rust_gen_target(d, thing, wd, arch):
349 sys = d.getVar('{}_SYS'.format(thing)) 349 sys = d.getVar('{}_SYS'.format(thing))
350 prefix = d.getVar('{}_PREFIX'.format(thing)) 350 prefix = d.getVar('{}_PREFIX'.format(thing))
351 rustsys = d.getVar('RUST_{}_SYS'.format(thing)) 351 rustsys = d.getVar('RUST_{}_SYS'.format(thing))
352 os = d.getVar('{}_OS'.format(thing))
352 353
353 abi = None 354 abi = None
354 cpu = "generic" 355 cpu = "generic"
@@ -388,7 +389,7 @@ def rust_gen_target(d, thing, wd, arch):
388 tspec['target-c-int-width'] = d.getVarFlag('TARGET_C_INT_WIDTH', arch_abi) 389 tspec['target-c-int-width'] = d.getVarFlag('TARGET_C_INT_WIDTH', arch_abi)
389 tspec['target-endian'] = d.getVarFlag('TARGET_ENDIAN', arch_abi) 390 tspec['target-endian'] = d.getVarFlag('TARGET_ENDIAN', arch_abi)
390 tspec['arch'] = arch_to_rust_target_arch(rust_arch) 391 tspec['arch'] = arch_to_rust_target_arch(rust_arch)
391 if "baremetal" in d.getVar('TCLIBC'): 392 if "elf" in os:
392 tspec['os'] = "none" 393 tspec['os'] = "none"
393 else: 394 else:
394 tspec['os'] = "linux" 395 tspec['os'] = "linux"