Skip to contentSkip to conversation

Failure for rust-cross for arm(v5)

PATCH Superseded [email protected] 2 participants 4 messages Nov 30, 2023 – Dec 1, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Failure for rust-cross for arm(v5)

From: Jermain Horsman <[email protected]>

I ran into the following when trying to compile rust for arm (on kirkstone):

Exception: TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

After some investigation I notices some patches on master which were not available on kirkstone.
Using the patches included here I am able to compile successfully.

However, some additional patches are not on kirkstone,
I am unsure whether or not these should be backported too,
maybe someone, who has a better understanding of these, can comment on that.

It's about the following patches:
https://git.openembedded.org/openembedded-core/commit/?id=0f83d959465e0d99f98ade6803281585931d1b02
https://git.openembedded.org/openembedded-core/commit/?id=2d4b35a0db1220e7a7f1b6776223aa4d40a3f246

The following patch is also not on kirkstone,
based on the commit message I think it might be desired to have this one as well:
https://git.openembedded.org/openembedded-core/commit/?id=d554161a045d12411f288394e253c54aa4c1257c

Richard Purdie (2):
rust-cross/rust-common: Merge arm target handling code to fix
cross-canadian
rust-cross: Simplfy the rust_gen_target calls

 meta/recipes-devtools/rust/rust-common.inc | 18 ++++++++++++------
 meta/recipes-devtools/rust/rust-cross.inc  | 21 ++++-----------------
 2 files changed, 16 insertions(+), 23 deletions(-)
Signature · 1 line
2.42.0.windows.2
#1 lore raw

PATCH 1/2 rust-cross/rust-common: Merge arm target handling code to fix cross-canadian

From: Richard Purdie <[email protected]>

rust-cross had special handling for armv7 targets but we also need this for cross-canadian. Merge the code into the main function so everything is consistent.

Also then fix the arm definition to be arm-eabi since ABI is correctly being looked up.

(cherry picked from commit ff3c3dbbd2bf1bb7bb70b55cca203e9eedcf14a8)
---
 meta/recipes-devtools/rust/rust-common.inc | 6 ++++++
 meta/recipes-devtools/rust/rust-cross.inc  | 7 +------
 2 files changed, 7 insertions(+), 6 deletions(-)
meta/recipes-devtools/rust/rust-common.inc +6 -0
index db0bd8fc1b..3cf8a70470 100644
@@ -297,6 +297,12 @@ def rust_gen_target(d, thing, wd, features, cpu, arch, abi=""):
     sys = sys_for(d, thing)
     prefix = prefix_for(d, thing)
 
+    if thing == "TARGET":
+        abi = d.getVar('ABIEXTENSION')
+        # arm and armv7 have different targets in llvm
+        if arch == "arm" and target_is_armv7(d):
+            arch = 'armv7'
+
     rust_arch = oe.rust.arch_to_rust_arch(arch)
 
     if abi:
meta/recipes-devtools/rust/rust-cross.inc +1 -6
index f6babfeeda..4c026b1f38 100644
@@ -8,15 +8,10 @@ python do_rust_gen_targets () {
         features = ""
         cpu = "generic"
         arch = d.getVar('{}_ARCH'.format(thing))
-        abi = ""
         if thing is "TARGET":
-            abi = d.getVar('ABIEXTENSION')
-            # arm and armv7 have different targets in llvm
-            if arch == "arm" and target_is_armv7(d):
-                arch = 'armv7'
             features = d.getVar('TARGET_LLVM_FEATURES') or ""
             cpu = d.getVar('TARGET_LLVM_CPU')
-        rust_gen_target(d, thing, wd, features, cpu, arch, abi)
+        rust_gen_target(d, thing, wd, features, cpu, arch)
 }
 
 # Otherwise we'll depend on what we provide
Signature · 1 line
2.42.0.windows.2
#2 lore raw

PATCH 2/2 rust-cross: Simplfy the rust_gen_target calls

In reply to [email protected]

From: Richard Purdie <[email protected]>

Match the code in rust-cross-canadian so that further simplifications can be considered in future.

(cherry picked from commit 5cb62d0a33777cb9afb1eea5f736a2580ce50dc7)
---
 meta/recipes-devtools/rust/rust-common.inc | 12 ++++++------
 meta/recipes-devtools/rust/rust-cross.inc  | 16 ++++------------
 2 files changed, 10 insertions(+), 18 deletions(-)
meta/recipes-devtools/rust/rust-common.inc +6 -6
index 3cf8a70470..3efec3e72d 100644
@@ -119,12 +119,12 @@ def llvm_features(d):
 
 
 ## arm-unknown-linux-gnueabihf
-DATA_LAYOUT[arm] = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
-TARGET_ENDIAN[arm] = "little"
-TARGET_POINTER_WIDTH[arm] = "32"
-TARGET_C_INT_WIDTH[arm] = "32"
-MAX_ATOMIC_WIDTH[arm] = "64"
-FEATURES[arm] = "+v6,+vfp2"
+DATA_LAYOUT[arm-eabi] = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
+TARGET_ENDIAN[arm-eabi] = "little"
+TARGET_POINTER_WIDTH[arm-eabi] = "32"
+TARGET_C_INT_WIDTH[arm-eabi] = "32"
+MAX_ATOMIC_WIDTH[arm-eabi] = "64"
+FEATURES[arm-eabi] = "+v6,+vfp2"
 
 ## armv7-unknown-linux-gnueabihf
 DATA_LAYOUT[armv7-eabi] = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
meta/recipes-devtools/rust/rust-cross.inc +4 -12
index 4c026b1f38..2e47a3aa5f 100644
@@ -1,17 +1,9 @@
 python do_rust_gen_targets () {
     wd = d.getVar('WORKDIR') + '/targets/'
-    # It is important 'TARGET' is last here so that it overrides our less
-    # informed choices for BUILD & HOST if TARGET happens to be the same as
-    # either of them.
-    for thing in ['BUILD', 'HOST', 'TARGET']:
-        bb.debug(1, "rust_gen_target for " + thing)
-        features = ""
-        cpu = "generic"
-        arch = d.getVar('{}_ARCH'.format(thing))
-        if thing is "TARGET":
-            features = d.getVar('TARGET_LLVM_FEATURES') or ""
-            cpu = d.getVar('TARGET_LLVM_CPU')
-        rust_gen_target(d, thing, wd, features, cpu, arch)
+    # Order of BUILD, HOST, TARGET is important in case the files overwrite, most specific last
+    rust_gen_target(d, 'BUILD', wd, "", "generic", d.getVar('BUILD_ARCH'))
+    rust_gen_target(d, 'HOST', wd, "", "generic", d.getVar('HOST_ARCH'))
+    rust_gen_target(d, 'TARGET', wd, d.getVar('TARGET_LLVM_FEATURES') or "", d.getVar('TARGET_LLVM_CPU'), d.getVar('TARGET_ARCH'))
 }
 
 # Otherwise we'll depend on what we provide
Signature · 1 line
2.42.0.windows.2
#3 lore raw
In reply to [email protected]

Unfortunately this series breaks oe-selftest for all distros on the autobuilder.

Here is a sample failure log:

https://errors.yoctoproject.org/Errors/Details/745002/

Steve

Quoted 46 lines · Jermain Horsman

From: Jermain Horsman <[email protected]>

I ran into the following when trying to compile rust for arm (on kirkstone):

Exception: TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

After some investigation I notices some patches on master which were not available on kirkstone.
Using the patches included here I am able to compile successfully.

However, some additional patches are not on kirkstone,
I am unsure whether or not these should be backported too,
maybe someone, who has a better understanding of these, can comment on that.

It's about the following patches:
https://git.openembedded.org/openembedded-core/commit/?id=0f83d959465e0d99f98ade6803281585931d1b02
https://git.openembedded.org/openembedded-core/commit/?id=2d4b35a0db1220e7a7f1b6776223aa4d40a3f246

The following patch is also not on kirkstone,
based on the commit message I think it might be desired to have this one as well:
https://git.openembedded.org/openembedded-core/commit/?id=d554161a045d12411f288394e253c54aa4c1257c

Richard Purdie (2):
rust-cross/rust-common: Merge arm target handling code to fix
cross-canadian
rust-cross: Simplfy the rust_gen_target calls

 meta/recipes-devtools/rust/rust-common.inc | 18 ++++++++++++------
 meta/recipes-devtools/rust/rust-cross.inc  | 21 ++++-----------------
 2 files changed, 16 insertions(+), 23 deletions(-)

--
2.42.0.windows.2

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#191490): https://lists.openembedded.org/g/openembedded-core/message/191490
Mute This Topic: https://lists.openembedded.org/mt/102891103/3620601
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-