new file mode 100644
@@ -0,0 +1,70 @@
+From b85c7b406f017589eb959cd619ba442837ada470 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 4 Apr 2025 00:29:22 -0700
+Subject: [PATCH] Fix rustix 0.38.42 build on riscv32
+
+Upstream-Status: Submitted [https://github.com/bytecodealliance/rustix/pull/1435]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/fs/ioctl.rs | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+--- a/src/fs/ioctl.rs
++++ b/src/fs/ioctl.rs
+@@ -11,6 +11,14 @@ use {
+
+ use bitflags::bitflags;
+
++/// The datatype used for the ioctl number
++#[cfg(any(target_os = "android", target_env = "musl"))]
++#[doc(hidden)]
++pub type ioctl_num_type = c::c_int;
++#[cfg(not(any(target_os = "android", target_env = "musl")))]
++#[doc(hidden)]
++pub type ioctl_num_type = c::c_ulong;
++
+ #[cfg(all(linux_kernel, not(any(target_arch = "sparc", target_arch = "sparc64"))))]
+ use crate::fd::{AsRawFd, BorrowedFd};
+
+@@ -79,7 +87,8 @@ unsafe impl ioctl::Ioctl for Ficlone<'_>
+ type Output = ();
+
+ const IS_MUTATING: bool = false;
+- const OPCODE: ioctl::Opcode = ioctl::Opcode::old(c::FICLONE as ioctl::RawOpcode);
++ const OPCODE: ioctl::Opcode =
++ ioctl::Opcode::old(linux_raw_sys::ioctl::FICLONE as ioctl::RawOpcode);
+
+ fn as_ptr(&mut self) -> *mut c::c_void {
+ self.0.as_raw_fd() as *mut c::c_void
+@@ -138,7 +147,12 @@ bitflags! {
+ #[doc(alias = "FS_IOC_GETFLAGS")]
+ pub fn ioctl_getflags<Fd: AsFd>(fd: Fd) -> io::Result<IFlags> {
+ unsafe {
+- #[cfg(target_pointer_width = "32")]
++ #[cfg(target_arch = "riscv32")]
++ let ctl = ioctl::Getter::<
++ ioctl::BadOpcode<{ linux_raw_sys::ioctl::FS_IOC32_GETFLAGS as ioctl_num_type }>,
++ u32,
++ >::new();
++ #[cfg(all(target_pointer_width = "32", not(target_arch = "riscv32")))]
+ let ctl = ioctl::Getter::<ioctl::BadOpcode<{ c::FS_IOC32_GETFLAGS }>, u32>::new();
+ #[cfg(target_pointer_width = "64")]
+ let ctl = ioctl::Getter::<ioctl::BadOpcode<{ c::FS_IOC_GETFLAGS }>, u32>::new();
+@@ -154,8 +168,15 @@ pub fn ioctl_getflags<Fd: AsFd>(fd: Fd)
+ #[inline]
+ #[doc(alias = "FS_IOC_SETFLAGS")]
+ pub fn ioctl_setflags<Fd: AsFd>(fd: Fd, flags: IFlags) -> io::Result<()> {
++ use crate::ioctl::Ioctl;
++
+ unsafe {
+- #[cfg(target_pointer_width = "32")]
++ #[cfg(target_arch = "riscv32")]
++ let ctl = ioctl::Setter::<
++ ioctl::BadOpcode<{ linux_raw_sys::ioctl::FS_IOC32_SETFLAGS as ioctl_num_type }>,
++ u32,
++ >::new(flags.bits());
++ #[cfg(all(target_pointer_width = "32", not(target_arch = "riscv32")))]
+ let ctl =
+ ioctl::Setter::<ioctl::BadOpcode<{ c::FS_IOC32_SETFLAGS }>, u32>::new(flags.bits());
+
@@ -5,6 +5,7 @@ LICENSE = "MIT | Apache-2.0"
LIC_FILES_CHKSUM = "file://license-apache;md5=1836efb2eb779966696f473ee8540542 \
file://license-mit;md5=85fd3b67069cff784d98ebfc7d5c0797"
+SRC_URI += "file://0001-Fix-cargo-build-on-riscv32.patch;patchdir=${CARGO_VENDORING_DIRECTORY}/rustix-0.38.41"
SRC_URI[sha256sum] = "304762f86fd53a8031b1bf006d12572a2aa0a5235485031113195cc0152e1e12"
S = "${WORKDIR}/maturin-${PV}"
There is a single rustix patch which needs to apply to different versions of rustix Signed-off-by: Khem Raj <raj.khem@gmail.com> --- .../0001-Fix-cargo-build-on-riscv32.patch | 70 +++++++++++++++++++ .../python/python3-maturin_1.8.3.bb | 1 + 2 files changed, 71 insertions(+) create mode 100644 meta/recipes-devtools/python/python3-maturin/0001-Fix-cargo-build-on-riscv32.patch