Skip to contentSkip to conversation

python3-pyruvate: Fix build with mips

PATCH Superseded Khem Raj 1 participant 1 message Jan 26, 2022

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH v2 1/1 python3-pyruvate: Fix build with mips

mips/glibc systems have interesting problem where dev_t is not defined properly for O32 ABI [1], therefore address it for libsystemd crate, it works fine for musl

Fixes
error[E0308]: mismatched types
--> /usr/src/debug/python3-pyruvate/1.1.2-r0/cargo_home/bitbake/libsystemd-0.4.1/src/logging.rs:296:25

    |
296 |                 device: stat.st_dev,
    |                         ^^^^^^^^^^^ expected `u64`, found `u32`

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=17786

---
v2: Fix commit msg and apply the patch to musl too as it does not hurt

 ...-targets-for-stat.st_dev-definitions.patch | 32 +++++++++++++++++++
 .../python/python3-pyruvate_1.1.2.bb          |  2 ++
 2 files changed, 34 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-pyruvate/0001-check-for-mips-targets-for-stat.st_dev-definitions.patch
meta-python/recipes-devtools/python/python3-pyruvate/0001-check-for-mips-targets-for-stat.st_dev-definitions.patch new file +32 -0
new file mode 100644
index 0000000000..3bd80359f4
@@ -0,0 +1,32 @@
+From 24328cffebbc91bf15fbff51e9c50daf6eede4a7 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Tue, 25 Jan 2022 22:28:11 -0800
+Subject: [PATCH] check for mips targets for stat.st_dev definitions
+
+See
+https://sourceware.org/bugzilla/show_bug.cgi?id=17786
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/logging.rs | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/logging.rs b/src/logging.rs
+index ed12ce9..535a48f 100644
+--- a/src/logging.rs
++++ b/src/logging.rs
+@@ -293,7 +293,10 @@ impl JournalStream {
+     pub fn from_fd<F: AsRawFd>(fd: F) -> std::io::Result<Self> {
+         nix::sys::stat::fstat(fd.as_raw_fd())
+             .map(|stat| JournalStream {
++        #[cfg(all(not(target_arch = "mips")))]
+                 device: stat.st_dev,
++        #[cfg(all(target_arch = "mips"))]
++                device: stat.st_dev as u64,
+                 inode: stat.st_ino,
+             })
+             .map_err(std::io::Error::from)
+-- 
+2.35.0
+
meta-python/recipes-devtools/python/python3-pyruvate_1.1.2.bb +2 -0
index dad18b78c2..14142fdb67 100644
@@ -22,6 +22,8 @@ RUSTFLAGS:append:mipsel = " --cfg crossbeam_no_atomic_64"
 RUSTFLAGS:append:powerpc = " --cfg crossbeam_no_atomic_64"
 RUSTFLAGS:append:riscv32 = " --cfg crossbeam_no_atomic_64"
 
+SRC_URI:append:mips = " file://0001-check-for-mips-targets-for-stat.st_dev-definitions.patch;patchdir=../cargo_home/bitbake/libsystemd-0.4.1/"
+
 SRC_URI += " \
     crate://crates.io/aho-corasick/0.7.18 \
     crate://crates.io/atty/0.2.14 \
Signature · 1 line
2.35.0