<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>14879</bug_id>
          
          <creation_ts>2022-08-09 19:21:25 +0000</creation_ts>
          <short_desc>&apos;Fix for target definitions returning &apos;NoneType&apos; for arm&apos; results in &apos;NoneType when arch_abi is arm-eabi</short_desc>
          <delta_ts>2026-04-30 15:00:19 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>devtools / tool chain</component>
          <version>4.0</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>OBSOLETE</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>4.0.35</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Orne Brocaar">info</reporter>
          <assigned_to name="Ross Burton">ross.burton</assigned_to>
          <cc>bdharma96</cc>
    
    <cc>mathieu.dubois-briand</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>steve</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>93741</commentid>
    <comment_count>0</comment_count>
    <who name="Orne Brocaar">info</who>
    <bug_when>2022-08-09 19:21:25 +0000</bug_when>
    <thetext>I&apos;m using Yocto to compile a Rust application for Raspberry Pi (using the meta-raspberrypi layer). This breaks when using the `raspberrypi0` target with the following error:

ERROR: rust-cross-arm1176jzfshf-vfp-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: &apos;exec_func_python() autogenerated&apos;, lineno: 2, function: &lt;module&gt;                                                                                                                                                                                       
    0001:                                                                                                                     
*** 0002:do_rust_gen_targets(d)                                                                                                                                                                                                                              
    0003:                                                                                                                                                                                                                                                    
File: &apos;/layers/openembedded/openembedded-core/meta/recipes-devtools/rust/rust-cross.inc&apos;, lineno: 19, function: do_rust_gen_targets                                                                                                     
    0015:            if arch == &quot;arm&quot; and target_is_armv7(d):                                                                 
    0016:                arch = &apos;armv7&apos;                                                                                                                                                                                                                      
    0017:            features = d.getVar(&apos;TARGET_LLVM_FEATURES&apos;) or &quot;&quot;                                                                                                                                                                                       
    0018:            cpu = d.getVar(&apos;TARGET_LLVM_CPU&apos;)                                                                                                                                                                                                       
*** 0019:        rust_gen_target(d, thing, wd, features, cpu, arch, abi)                                                      
    0020:}                                                                                                                    
    0021:                                                                                                                                                                                                                                                    
    0022:# Otherwise we&apos;ll depend on what we provide                                                                                                                                                                                                         
    0023:INHIBIT_DEFAULT_RUST_DEPS = &quot;1&quot;                                                                                                                                                                                                                     
File: &apos;/layers/openembedded/openembedded-core/meta/recipes-devtools/rust/rust-common.inc&apos;, lineno: 316, function: rust_gen_target                                                                                                       
    0312:    # build tspec                                                                                                                                                                                                                                   
    0313:    tspec = {}                                                                                                                                                                                                                                      
    0314:    tspec[&apos;llvm-target&apos;] = d.getVar(&apos;RUST_TARGET_SYS&apos;, arch_abi)                                                     
    0315:    tspec[&apos;data-layout&apos;] = d.getVarFlag(&apos;DATA_LAYOUT&apos;, arch_abi)                                                                                                                                                                                    
*** 0316:    tspec[&apos;max-atomic-width&apos;] = int(d.getVarFlag(&apos;MAX_ATOMIC_WIDTH&apos;, arch_abi))                                                                                                                                                                     
    0317:    tspec[&apos;target-pointer-width&apos;] = d.getVarFlag(&apos;TARGET_POINTER_WIDTH&apos;, arch_abi)                                                                                                                                                                  
    0318:    tspec[&apos;target-c-int-width&apos;] = d.getVarFlag(&apos;TARGET_C_INT_WIDTH&apos;, arch_abi)                                                                                                                                                                      
    0319:    tspec[&apos;target-endian&apos;] = d.getVarFlag(&apos;TARGET_ENDIAN&apos;, arch_abi)                                                                                                                                                                                
    0320:    tspec[&apos;arch&apos;] = arch_to_rust_target_arch(rust_arch)                                                                                                                                                                                             
Exception: TypeError: int() argument must be a string, a bytes-like object or a number, not &apos;NoneType&apos;


This is the exact same error as &apos;fixed&apos; by the following commit, but then the reverse:
http://git.openembedded.org/openembedded-core/commit/?h=kirkstone&amp;id=a4886f02dfb78e861fd7afe07b4a25c262bf0421


If using the `raspberrypi0` machine configuration provided by the meta-raspberrypi layer, then `arch_abi` holds the value `arm-eabi`, which was replaced by `arm` in the above commit. Could it be that both `arm` and `arm-eabi` keys must be set? I added a warning log to print the content of arch_abi, which prints:

WARNING: rust-native-1.59.0-r0 do_rust_gen_targets: x86_64                                                                                                                                                                                                   
WARNING: rust-cross-arm1176jzfshf-vfp-glibc-1.59.0-r0 do_rust_gen_targets: x86_64                                                                                                                                                                            
WARNING: rust-cross-arm1176jzfshf-vfp-glibc-1.59.0-r0 do_rust_gen_targets: x86_64                                                                                                                                                                            
WARNING: rust-cross-arm1176jzfshf-vfp-glibc-1.59.0-r0 do_rust_gen_targets: arm-eabi                                                                                                                                                                          


Build Configuration:                                                                                                                                                                                                                                         

BB_VERSION           = &quot;2.0.0&quot;                                                                                                                                                                                                                                
BUILD_SYS            = &quot;x86_64-linux&quot;                                                                                                                                                                                                                         
NATIVELSBSTRING      = &quot;debian-10&quot;                                                                                                                                                                                                                            
TARGET_SYS           = &quot;arm-oe-linux-gnueabi&quot;                                                                                                                                                                                                                 
MACHINE              = &quot;raspberrypi0&quot;                                                                                                                                                                                                                         
TUNE_FEATURES        = &quot;arm thumb vfp arm1176jzfs callconvention-hard&quot;                                                                                                                                                                                       
TARGET_FPU           = &quot;hard&quot;                                                                                                                                                                                                                                
meta                 = &quot;master:37d3b539d5875230deb1d3e8d78069d48e099351&quot;                                                                                                                                                                                     
meta-swupdate        = &quot;kirkstone:e6e2b70159dfd40067a65c07aca91ec31931629b&quot;                                                                                                                                                                                  
meta-clang           = &quot;kirkstone:d669d873edf68dc7440bb07096737203bb7ec505&quot;                                                                                                                                                                                   
meta-raspberrypi     = &quot;kirkstone:0135a02ea577bd39dd552236ead2c5894d89da1d&quot;                                                    
meta-networking                                                                                                                                                                                                                                               
meta-filesystems                                                                                                                                                                                                                                              
meta-python                                                                                                                                                                                                                                                   
meta-oe              = &quot;kirkstone:8f2dc1023482863e2630d1b94052c41ce748b38f&quot;                                                                                                                                                                                   
meta                 = &quot;kirkstone:3564ce3d9b2030dd420362c66147bd327090915c&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93772</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2022-08-11 14:46:59 +0000</bug_when>
    <thetext>One of the patches before the major recent work on master fixed this according to Richard. -- YP triage team</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93774</commentid>
    <comment_count>2</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2022-08-11 14:47:54 +0000</bug_when>
    <thetext>Perhaps this one: https://git.yoctoproject.org/poky/commit/?id=1900f5b6078c7ca25c208d1c8230e3074c28425d</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93775</commentid>
    <comment_count>3</comment_count>
    <who name="Steve Sakoman">steve</who>
    <bug_when>2022-08-11 14:50:07 +0000</bug_when>
    <thetext>Ome - could you try applying the patch referenced above to see if it resolves the issue?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93796</commentid>
    <comment_count>4</comment_count>
    <who name="Orne Brocaar">info</who>
    <bug_when>2022-08-16 10:30:00 +0000</bug_when>
    <thetext>I applied the changes to which you linked:

---

diff --git a/meta/recipes-devtools/rust/rust-common.inc b/meta/recipes-devtools/rust/rust-common.inc
index ef70c48d0f..fd3f9d2c6b 100644
--- a/meta/recipes-devtools/rust/rust-common.inc
+++ b/meta/recipes-devtools/rust/rust-common.inc
@@ -297,6 +297,11 @@ def rust_gen_target(d, thing, wd, features, cpu, arch, abi=&quot;&quot;):
     sys = sys_for(d, thing)
     prefix = prefix_for(d, thing)
 
+    if thing == &quot;TARGET&quot;:
+        abi = d.getVar(&apos;ABIEXTENSION&apos;)
+        if arch == &quot;arm&quot; and target_is_armv7(d):
+            arch = &apos;armv7&apos;
+
     rust_arch = oe.rust.arch_to_rust_arch(arch)
 
     if abi:
diff --git a/meta/recipes-devtools/rust/rust-cross.inc b/meta/recipes-devtools/rust/rust-cross.inc
index f6babfeeda..4c026b1f38 100644
--- a/meta/recipes-devtools/rust/rust-cross.inc
+++ b/meta/recipes-devtools/rust/rust-cross.inc
@@ -8,15 +8,10 @@ python do_rust_gen_targets () {
         features = &quot;&quot;
         cpu = &quot;generic&quot;
         arch = d.getVar(&apos;{}_ARCH&apos;.format(thing))
-        abi = &quot;&quot;
         if thing is &quot;TARGET&quot;:
-            abi = d.getVar(&apos;ABIEXTENSION&apos;)
-            # arm and armv7 have different targets in llvm
-            if arch == &quot;arm&quot; and target_is_armv7(d):
-                arch = &apos;armv7&apos;
             features = d.getVar(&apos;TARGET_LLVM_FEATURES&apos;) or &quot;&quot;
             cpu = d.getVar(&apos;TARGET_LLVM_CPU&apos;)
-        rust_gen_target(d, thing, wd, features, cpu, arch, abi)
+        rust_gen_target(d, thing, wd, features, cpu, arch)
 }
 
 # Otherwise we&apos;ll depend on what we provide

---

Build output:

---

Build Configuration:
BB_VERSION           = &quot;2.0.0&quot;
BUILD_SYS            = &quot;x86_64-linux&quot;
NATIVELSBSTRING      = &quot;debian-10&quot;
TARGET_SYS           = &quot;arm-oe-linux-gnueabi&quot;
MACHINE              = &quot;raspberrypi0-wifi&quot;
TUNE_FEATURES        = &quot;arm thumb vfp arm1176jzfs callconvention-hard&quot;
TARGET_FPU           = &quot;hard&quot;
meta                 = &quot;master:c99df158e0ebff5db2317beb6566046c09df42ce&quot;
meta-swupdate        = &quot;kirkstone:e6e2b70159dfd40067a65c07aca91ec31931629b&quot;
meta-clang           = &quot;kirkstone:d669d873edf68dc7440bb07096737203bb7ec505&quot;
meta-raspberrypi     = &quot;kirkstone:0135a02ea577bd39dd552236ead2c5894d89da1d&quot;
meta-networking      
meta-filesystems     
meta-python          
meta-oe              = &quot;kirkstone:8f2dc1023482863e2630d1b94052c41ce748b38f&quot;
meta                 = &quot;kirkstone:3564ce3d9b2030dd420362c66147bd327090915c&quot;

Initialising tasks: 100% |####################################################################################| Time: 0:00:05
Sstate summary: Wanted 574 Local 544 Mirrors 0 Missed 30 Current 947 (94% match, 98% complete)
Removing 2 stale sstate objects for arch x86_64: 100% |#######################################################| Time: 0:00:00
NOTE: Executing Tasks
ERROR: rust-cross-arm1176jzfshf-vfp-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: &apos;exec_func_python() autogenerated&apos;, lineno: 2, function: &lt;module&gt;
     0001:
 *** 0002:do_rust_gen_targets(d)
     0003:
File: &apos;/layers/openembedded/openembedded-core/meta/recipes-devtools/rust/rust-cross.inc&apos;, lineno: 14, function: do_rust_gen_targets
     0010:        arch = d.getVar(&apos;{}_ARCH&apos;.format(thing))
     0011:        if thing is &quot;TARGET&quot;:
     0012:            features = d.getVar(&apos;TARGET_LLVM_FEATURES&apos;) or &quot;&quot;
     0013:            cpu = d.getVar(&apos;TARGET_LLVM_CPU&apos;)
 *** 0014:        rust_gen_target(d, thing, wd, features, cpu, arch)
     0015:}
     0016:
     0017:# Otherwise we&apos;ll depend on what we provide
     0018:INHIBIT_DEFAULT_RUST_DEPS = &quot;1&quot;
File: &apos;/layers/openembedded/openembedded-core/meta/recipes-devtools/rust/rust-common.inc&apos;, lineno: 319, function: rust_gen_target
     0315:    # build tspec
     0316:    tspec = {}
     0317:    tspec[&apos;llvm-target&apos;] = d.getVar(&apos;RUST_TARGET_SYS&apos;, arch_abi)
     0318:    tspec[&apos;data-layout&apos;] = d.getVarFlag(&apos;DATA_LAYOUT&apos;, arch_abi)
 *** 0319:    tspec[&apos;max-atomic-width&apos;] = int(d.getVarFlag(&apos;MAX_ATOMIC_WIDTH&apos;, arch_abi))
     0320:    tspec[&apos;target-pointer-width&apos;] = d.getVarFlag(&apos;TARGET_POINTER_WIDTH&apos;, arch_abi)
     0321:    tspec[&apos;target-c-int-width&apos;] = d.getVarFlag(&apos;TARGET_C_INT_WIDTH&apos;, arch_abi)
     0322:    tspec[&apos;target-endian&apos;] = d.getVarFlag(&apos;TARGET_ENDIAN&apos;, arch_abi)
     0323:    tspec[&apos;arch&apos;] = arch_to_rust_target_arch(rust_arch)
Exception: TypeError: int() argument must be a string, a bytes-like object or a number, not &apos;NoneType&apos;

ERROR: Logfile of failure stored in: /build/tmp/raspberrypi0-wifi-glibc/work/x86_64-linux/rust-cross-arm1176jzfshf-vfp-glibc/1.59.0-r0/temp/log.do_rust_gen_targets.426
ERROR: Task (/layers/openembedded/openembedded-core/meta/recipes-devtools/rust/rust-cross_1.59.0.bb:do_rust_gen_targets) failed with exit code &apos;1&apos;

---</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93799</commentid>
    <comment_count>5</comment_count>
    <who name="Steve Sakoman">steve</who>
    <bug_when>2022-08-16 14:56:04 +0000</bug_when>
    <thetext>Could you try to apply this patch in addition to the previous one?

https://git.openembedded.org/openembedded-core/commit/?id=1912c4e9e0ecf9655f3b3a41588b54d7956f5899

If this doesn&apos;t work could you give me details on how I might reproduce this on my end?  Extra credit points if we can reproduce with oe-core only :-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93819</commentid>
    <comment_count>6</comment_count>
    <who name="Orne Brocaar">info</who>
    <bug_when>2022-08-17 09:23:53 +0000</bug_when>
    <thetext>I have now the following applied, but am hitting still the same error:

---
diff --git a/meta/recipes-devtools/rust/rust-common.inc b/meta/recipes-devtools/rust/rust-common.inc
index ef70c48d0f..2809de7584 100644
--- a/meta/recipes-devtools/rust/rust-common.inc
+++ b/meta/recipes-devtools/rust/rust-common.inc
@@ -297,6 +297,12 @@ def rust_gen_target(d, thing, wd, features, cpu, arch, abi=&quot;&quot;):
     sys = sys_for(d, thing)
     prefix = prefix_for(d, thing)
 
+    if thing == &quot;TARGET&quot;:
+        abi = d.getVar(&apos;ABIEXTENSION&apos;)
+        # arm and armv7 have different targets in llvm
+        if arch == &quot;arm&quot; and target_is_armv7(d):
+            arch = &apos;armv7&apos;
+
     rust_arch = oe.rust.arch_to_rust_arch(arch)
 
     if abi:
diff --git a/meta/recipes-devtools/rust/rust-cross-canadian-common.inc b/meta/recipes-devtools/rust/rust-cross-canadian-common.inc
index 1f21c8af26..ad2aaed34e 100644
--- a/meta/recipes-devtools/rust/rust-cross-canadian-common.inc
+++ b/meta/recipes-devtools/rust/rust-cross-canadian-common.inc
@@ -27,9 +27,9 @@ DEBUG_PREFIX_MAP = &quot;-fdebug-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDP
 
 python do_rust_gen_targets () {
     wd = d.getVar(&apos;WORKDIR&apos;) + &apos;/targets/&apos;
-    rust_gen_target(d, &apos;TARGET&apos;, wd, d.getVar(&apos;TARGET_LLVM_FEATURES&apos;) or &quot;&quot;, d.getVar(&apos;TARGET_LLVM_CPU&apos;), d.getVar(&apos;TARGET_ARCH&apos;))
-    rust_gen_target(d, &apos;HOST&apos;, wd, &quot;&quot;, &quot;generic&quot;, d.getVar(&apos;HOST_ARCH&apos;))
     rust_gen_target(d, &apos;BUILD&apos;, wd, &quot;&quot;, &quot;generic&quot;, d.getVar(&apos;BUILD_ARCH&apos;))
+    rust_gen_target(d, &apos;HOST&apos;, wd, &quot;&quot;, &quot;generic&quot;, d.getVar(&apos;HOST_ARCH&apos;))
+    rust_gen_target(d, &apos;TARGET&apos;, wd, d.getVar(&apos;TARGET_LLVM_FEATURES&apos;) or &quot;&quot;, d.getVar(&apos;TARGET_LLVM_CPU&apos;), d.getVar(&apos;TARGET_ARCH&apos;))
 }
 
 INHIBIT_DEFAULT_RUST_DEPS = &quot;1&quot;
diff --git a/meta/recipes-devtools/rust/rust-cross.inc b/meta/recipes-devtools/rust/rust-cross.inc
index f6babfeeda..4c026b1f38 100644
--- a/meta/recipes-devtools/rust/rust-cross.inc
+++ b/meta/recipes-devtools/rust/rust-cross.inc
@@ -8,15 +8,10 @@ python do_rust_gen_targets () {
         features = &quot;&quot;
         cpu = &quot;generic&quot;
         arch = d.getVar(&apos;{}_ARCH&apos;.format(thing))
-        abi = &quot;&quot;
         if thing is &quot;TARGET&quot;:
-            abi = d.getVar(&apos;ABIEXTENSION&apos;)
-            # arm and armv7 have different targets in llvm
-            if arch == &quot;arm&quot; and target_is_armv7(d):
-                arch = &apos;armv7&apos;
             features = d.getVar(&apos;TARGET_LLVM_FEATURES&apos;) or &quot;&quot;
             cpu = d.getVar(&apos;TARGET_LLVM_CPU&apos;)
-        rust_gen_target(d, thing, wd, features, cpu, arch, abi)
+        rust_gen_target(d, thing, wd, features, cpu, arch)
 }
 
 # Otherwise we&apos;ll depend on what we provide
---

Steps to reproduce:

You will find the source repository of the project here, including the steps to setup the environment: https://github.com/chirpstack/chirpstack-gateway-os/tree/issue_14879.

Please note that you must use the issue_14879 branch, as the master branch contains a quickfix to work around this issue. I&apos;ve also set the default target to raspberrypi0-wifi so that you don&apos;t have to change this (https://github.com/chirpstack/chirpstack-gateway-os/commit/f2860c63867da720794c97d96e7933fe8faef8ee).

Then a &quot;bitbake chirpstack-gateway-os-full&quot; should result in the above error.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94463</commentid>
    <comment_count>7</comment_count>
    <who name="Dharma B">bdharma96</who>
    <bug_when>2022-11-30 04:37:24 +0000</bug_when>
    <thetext>Did this commit in the poky layer https://git.yoctoproject.org/poky/commit/?id=66ff1fb3a164fa794ee186960809e3fa9e938b48 fixes this issue?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94736</commentid>
    <comment_count>8</comment_count>
    <who name="Orne Brocaar">info</who>
    <bug_when>2023-01-17 09:52:21 +0000</bug_when>
    <thetext>I&apos;m sorry, at this moment I do not have the time to re-test this on a short notice. Please feel free to close this issue as it seems I can&apos;t change the status to closed.

For now, I&apos;m using the following workaround:

DATA_LAYOUT[arm-eabi] = &quot;e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64&quot;
LLVM_TARGET[arm-eabi] = &quot;${RUST_TARGET_SYS}&quot;
TARGET_ENDIAN[arm-eabi] = &quot;little&quot;
TARGET_POINTER_WIDTH[arm-eabi] = &quot;32&quot;
TARGET_C_INT_WIDTH[arm-eabi] = &quot;32&quot;
MAX_ATOMIC_WIDTH[arm-eabi] = &quot;64&quot;
FEATURES[arm-eabi] = &quot;+v6,+vfp2&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94767</commentid>
    <comment_count>9</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2023-01-19 15:56:56 +0000</bug_when>
    <thetext>Ross is going to find someone to take a look.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94768</commentid>
    <comment_count>10</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2023-01-19 15:58:09 +0000</bug_when>
    <thetext>related to https://bugzilla.yoctoproject.org/show_bug.cgi?id=14967</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105311</commentid>
    <comment_count>11</comment_count>
    <who name="Mathieu Dubois-Briand">mathieu.dubois-briand</who>
    <bug_when>2026-04-30 15:00:19 +0000</bug_when>
    <thetext>Obsolete</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>