Bug 14967

Summary: rust-cross broken for ARMv5
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Denys Dmytriyenko <denis>
Component: devtools / tool chainAssignee: Steve Sakoman <steve>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: Medium+ CC: cp0613, meta.mr.watcher, meta.watcher, randy.macleod, sundeep.kokkonda
Version: 4.0   
Target Milestone: 4.0.11   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description Denys Dmytriyenko 2022-11-11 01:12:55 UTC
rust-cross is broken for ARMv5 on Kirkstone. Seems to be fine on Langdale/master, but there were tons of rust-cross changes since Kirkstone

Logs:

$ bitbake librsvg
Loading cache: 100% |                                                                                                                                                                       | ETA:  --:--:--
Loaded 0 entries from dependency cache.
Parsing recipes: 100% |######################################################################################################################################################################| Time: 0:00:05
Parsing of 882 .bb files complete (0 cached, 882 parsed). 1641 targets, 61 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "2.0.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "ubuntu-20.04"
TARGET_SYS           = "arm-poky-linux-gnueabi"
MACHINE              = "qemuarmv5"
DISTRO               = "poky"
DISTRO_VERSION       = "4.0.5"
TUNE_FEATURES        = "arm armv5 thumb dsp"
TARGET_FPU           = "soft"
meta                 
meta-poky            
meta-yocto-bsp       = "kirkstone:1cb13d24b592986a44fd653e083b7711513fc916"

NOTE: Fetching uninative binary shim http://downloads.yoctoproject.org/releases/uninative/3.7/x86_64-nativesdk-libc-3.7.tar.xz;sha256sum=b110bf2e10fe420f5ca2f3ec55f048ee5f0a54c7e34856a3594e51eb2aea0570 (will check PREMIRRORS first)
Initialising tasks: 100% |###################################################################################################################################################################| Time: 0:00:01
Checking sstate mirror object availability: 100% |###########################################################################################################################################| Time: 0:00:03
Sstate summary: Wanted 496 Local 0 Mirrors 211 Missed 285 Current 0 (42% match, 0% complete)
NOTE: Executing Tasks
ERROR: rust-cross-armv5e-glibc-1.59.0-r0 do_rust_gen_targets: Error executing a python function in exec_func_python() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
     0001:
 *** 0002:do_rust_gen_targets(d)
     0003:
File: '/OE/poky-kirkstone/meta/recipes-devtools/rust/rust-cross.inc', lineno: 19, function: do_rust_gen_targets
     0015:            if arch == "arm" and target_is_armv7(d):
     0016:                arch = 'armv7'
     0017:            features = d.getVar('TARGET_LLVM_FEATURES') or ""
     0018:            cpu = d.getVar('TARGET_LLVM_CPU')
 *** 0019:        rust_gen_target(d, thing, wd, features, cpu, arch, abi)
     0020:}
     0021:
     0022:# Otherwise we'll depend on what we provide
     0023:INHIBIT_DEFAULT_RUST_DEPS = "1"
File: '/OE/poky-kirkstone/meta/recipes-devtools/rust/rust-common.inc', lineno: 314, function: rust_gen_target
     0310:    # build tspec
     0311:    tspec = {}
     0312:    tspec['llvm-target'] = d.getVar('RUST_TARGET_SYS', arch_abi)
     0313:    tspec['data-layout'] = d.getVarFlag('DATA_LAYOUT', arch_abi)
 *** 0314:    tspec['max-atomic-width'] = int(d.getVarFlag('MAX_ATOMIC_WIDTH', arch_abi))
     0315:    tspec['target-pointer-width'] = d.getVarFlag('TARGET_POINTER_WIDTH', arch_abi)
     0316:    tspec['target-c-int-width'] = d.getVarFlag('TARGET_C_INT_WIDTH', arch_abi)
     0317:    tspec['target-endian'] = d.getVarFlag('TARGET_ENDIAN', arch_abi)
     0318:    tspec['arch'] = arch_to_rust_target_arch(rust_arch)
Exception: TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

ERROR: Logfile of failure stored in: /OE/poky-kirkstone/build/tmp/work/x86_64-linux/rust-cross-armv5e-glibc/1.59.0-r0/temp/log.do_rust_gen_targets.30873
ERROR: Task (/OE/poky-kirkstone/meta/recipes-devtools/rust/rust-cross_1.59.0.bb:do_rust_gen_targets) failed with exit code '1'
NOTE: Tasks Summary: Attempted 1245 tasks of which 940 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
  /OE/poky-kirkstone/meta/recipes-devtools/rust/rust-cross_1.59.0.bb:do_rust_gen_targets
Summary: There was 1 ERROR message, returning a non-zero exit code.
Comment 1 Chen Pei 2022-11-16 01:45:03 UTC
You can add the '-eabi' for arm-unknown-linux-gnueabihf temporarily in rust-common.inc. I found from the git log that this has been repeatedly modified.
Comment 2 Denys Dmytriyenko 2022-11-17 00:56:46 UTC
For the reference.

This commit changed the target generation keyed of from just <arch> to <arch>-<abi>:

https://git.openembedded.org/openembedded-core/commit/?id=79bd6389585327820dfc1a1d29f60779ef08b2e0

These are the commits that changed the entry back and forth between "arm" and "arm-eabi":

https://git.openembedded.org/openembedded-core/commit/?id=ef49f89c89889466ee3696ab680f8e10c961a677
https://git.openembedded.org/openembedded-core/commit/?id=299f429a1ee387681ba70e33ca23f165e5837961
https://git.openembedded.org/openembedded-core/commit/?id=a4886f02dfb78e861fd7afe07b4a25c262bf0421

Since qemuarm = armv7, not sure why "arm" entry was modified, not "armv7". This does affect qemuarmv5 negatively though.
Comment 3 Randy MacLeod 2023-05-20 18:59:21 UTC
I think I heard Steve say that this likely won't get fixed on the 4.0.* branch.
Since we have The newer rust code and build rules in:
  https://git.yoctoproject.org/meta-lts-mixins/log/?h=kirkstone/rust-1.68

I'm going to close the defect as Won't Fix.
If that's a problem for you Denys, please re-open and explain why you can't use the mixin layer.