Compiling 1.79 version of cargo fails to build, also note that I am using meta-clang and TOOLCHAIN = "clang" is set in local.conf below is the error. error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> /usr/src/debug/cargo/1.79.0/rustc-1.79.0-src/vendor/dbus-0.9.7/src/ffidisp/connection.rs:298:50 | 298 | if r == -1 { Err(e) } else { Ok(unsafe { mem::transmute(r) }) } | ^^^^^^^^^^^^^^ | = note: source type: `i32` (32 bits) = note: target type: `DBusRequestNameReply` (64 bits) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> /usr/src/debug/cargo/1.79.0/rustc-1.79.0-src/vendor/dbus-0.9.7/src/ffidisp/connection.rs:306:50 | 306 | if r == -1 { Err(e) } else { Ok(unsafe { mem::transmute(r) }) } | ^^^^^^^^^^^^^^ | = note: source type: `i32` (32 bits) = note: target type: `DBusReleaseNameReply` (64 bits)
Sundeep, this is blocking Khem so can you take a look ASAP.
Sure, we will check and update here.
Referring to the discussion in this GitHub issue from bellow links , we have opted to use transmute_copy instead of transmute to resolve the issue. https://github.com/rust-lang/rust/issues/61956#issuecomment-506520426 https://github.com/rust-lang/rust/issues/61956#issuecomment-503626904 proposed fix: --- a/vendor/dbus-0.9.7/src/ffidisp/connection.rs +++ b/vendor/dbus-0.9.7/src/ffidisp/connection.rs @@ -295,7 +295,7 @@ let mut e = Error::empty(); let n = to_c_str(name); let r = unsafe { ffi::dbus_bus_request_name(self.conn(), n.as_ptr(), flags, e.get_mut()) }; - if r == -1 { Err(e) } else { Ok(unsafe { mem::transmute(r) }) } + if r == -1 { Err(e) } else { Ok(unsafe { mem::transmute_copy(&r) }) } } /// Release a name. @@ -303,7 +303,7 @@ let mut e = Error::empty(); let n = to_c_str(name); let r = unsafe { ffi::dbus_bus_release_name(self.conn(), n.as_ptr(), e.get_mut()) }; - if r == -1 { Err(e) } else { Ok(unsafe { mem::transmute(r) }) } + if r == -1 { Err(e) } else { Ok(unsafe { mem::transmute_copy(&r) }) } } /// Add a match rule to match messages on the message bus. However we are currently experiencing bellow failure when running "bitbake core-image-minimal" with toolchain as clang, regardless of the implementation of the above fix | Makefile:184: *** Your linker does not support creating PIEs, opensbi requires this.. Stop. | ERROR: oe_runmake failed
Please explain why switching from transmute() to transmute_copy() as a generic patch would be required to fix a build error that seems to *only* affect riscv64 when using clang. This seems like a bad idea or at least one that requires a clear explanation.
This issue is fixed with patch from following commit: https://git.openembedded.org/openembedded-core/commit/?id=b9df8cd8b29064d115dab3bfd1ea14f94a5c0238