Bug#994922: librsvg: FTBFS on x32
Laurent Bigonville
bigon at debian.org
Thu Sep 23 09:06:47 BST 2021
Source: librsvg
Version: 2.50.7+dfsg-2
Severity: important
Tags: patch ftbfs
Justification: fails to build from source (but built successfully in the past)
Hello,
librsvg is vendoring rust thin-slice and that part of the code FTBFS on
x32. Unfortunately upstream seems to be inactive.
On github[0] I found a MR that seems to address this issue.
I don't know anything about rust, so somebody should review this patch
1st I guess.
Kind regards,
Laurent Bigonville
[0] https://github.com/heycam/thin-slice/pull/1
-- System Information:
Debian Release: bookworm/sid
APT prefers unstable-debug
APT policy: (500, 'unstable-debug'), (500, 'unstable'), (1, 'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 5.10.0-8-amd64 (SMP w/4 CPU threads)
Kernel taint flags: TAINT_FIRMWARE_WORKAROUND
Locale: LANG=fr_BE.UTF-8, LC_CTYPE=fr_BE.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: SELinux: enabled - Mode: Permissive - Policy name: refpolicy
-------------- next part --------------
>From 5db6f6cc8322e7b0211c51d61ace9552d8d820ee Mon Sep 17 00:00:00 2001
From: Harald van Dijk <harald at gigawatt.nl>
Date: Sat, 7 Dec 2019 15:43:58 +0000
Subject: [PATCH] Add target_pointer_width = "64" checks.
target_arch = "x86_64" covers both x86_64-unknown-linux-gnu and
x86_64-unknown-linux-gnux32. The latter has 32-bit pointer types and
should just use Box<[T]>.
---
src/lib.rs | 54 +++++++++++++++++++++++++++---------------------------
1 file changed, 27 insertions(+), 27 deletions(-)
--- a/vendor/thin-slice/src/lib.rs
+++ b/vendor/thin-slice/src/lib.rs
@@ -29,14 +29,14 @@
use std::cmp::Ordering;
use std::fmt;
use std::hash::{Hash, Hasher};
-#[cfg(target_arch = "x86_64")]
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
use std::marker::PhantomData;
-#[cfg(target_arch = "x86_64")]
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
use std::mem;
use std::ops::{Deref, DerefMut};
-#[cfg(target_arch = "x86_64")]
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
use std::ptr::NonNull;
-#[cfg(target_arch = "x86_64")]
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
use std::slice;
/// An owned slice that tries to use only one word of storage.
@@ -56,38 +56,38 @@ pub struct ThinBoxedSlice<T> {
///
/// If len >= 0xffff, then the top 16 bits of data will be 0xffff, and
/// the lower 48 bits will be a pointer to a heap allocated `Box<[T]>`.
- #[cfg(target_arch = "x86_64")]
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
data: NonNull<()>,
- #[cfg(not(target_arch = "x86_64"))]
+ #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "64")))]
data: Box<[T]>,
- #[cfg(target_arch = "x86_64")]
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
_phantom: PhantomData<Box<[T]>>,
}
-#[cfg(target_arch = "x86_64")]
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
const TAG_MASK: usize = 0xffff000000000000;
-#[cfg(target_arch = "x86_64")]
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
const PTR_MASK: usize = 0x0000ffffffffffff;
-#[cfg(target_arch = "x86_64")]
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
const PTR_HIGH: usize = 0x0000800000000000;
-#[cfg(target_arch = "x86_64")]
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
const TAG_SHIFT: usize = 48;
-#[cfg(target_arch = "x86_64")]
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
const TAG_LIMIT: usize = TAG_MASK >> TAG_SHIFT;
-#[cfg(target_arch = "x86_64")]
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
enum Storage<T> {
Inline(*mut T, usize),
Spilled(*mut Box<[T]>),
}
-#[cfg(target_arch = "x86_64")]
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
impl<T> ThinBoxedSlice<T> {
/// Constructs a `ThinBoxedSlice` from a raw pointer.
///
@@ -203,7 +203,7 @@ impl<T> ThinBoxedSlice<T> {
}
}
-#[cfg(not(target_arch = "x86_64"))]
+#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "64")))]
impl<T> ThinBoxedSlice<T> {
/// Constructs a `ThinBoxedSlice` from a raw pointer.
///
@@ -284,7 +284,7 @@ impl<T> ThinBoxedSlice<T> {
}
}
-#[cfg(target_arch = "x86_64")]
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
impl<T> Storage<T> {
#[inline]
fn from_data(data: NonNull<()>) -> Storage<T> {
@@ -343,7 +343,7 @@ impl<T> Into<Box<[T]>> for ThinBoxedSlic
unsafe impl<T: Send> Send for ThinBoxedSlice<T> {}
unsafe impl<T: Sync> Sync for ThinBoxedSlice<T> {}
-#[cfg(target_arch = "x86_64")]
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
impl<T> Drop for ThinBoxedSlice<T> {
fn drop(&mut self) {
let _ = Into::<Box<[T]>>::into(
@@ -356,7 +356,7 @@ impl<T> Drop for ThinBoxedSlice<T> {
}
impl<T: Clone> Clone for ThinBoxedSlice<T> {
- #[cfg(target_arch = "x86_64")]
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
fn clone(&self) -> Self {
unsafe {
match self.storage() {
@@ -373,7 +373,7 @@ impl<T: Clone> Clone for ThinBoxedSlice<
}
}
- #[cfg(not(target_arch = "x86_64"))]
+ #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "64")))]
fn clone(&self) -> Self {
ThinBoxedSlice {
data: self.data.clone(),
@@ -396,7 +396,7 @@ impl<T> AsMut<[T]> for ThinBoxedSlice<T>
impl<T> Deref for ThinBoxedSlice<T> {
type Target = [T];
- #[cfg(target_arch = "x86_64")]
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
fn deref(&self) -> &[T] {
unsafe {
match self.storage() {
@@ -410,14 +410,14 @@ impl<T> Deref for ThinBoxedSlice<T> {
}
}
- #[cfg(not(target_arch = "x86_64"))]
+ #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "64")))]
fn deref(&self) -> &[T] {
&*self.data
}
}
impl<T> DerefMut for ThinBoxedSlice<T> {
- #[cfg(target_arch = "x86_64")]
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
fn deref_mut(&mut self) -> &mut [T] {
unsafe {
match self.storage() {
@@ -431,7 +431,7 @@ impl<T> DerefMut for ThinBoxedSlice<T> {
}
}
- #[cfg(not(target_arch = "x86_64"))]
+ #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "64")))]
fn deref_mut(&mut self) -> &mut [T] {
&mut *self.data
}
@@ -498,7 +498,7 @@ impl<T> fmt::Pointer for ThinBoxedSlice<
}
}
-#[cfg(target_arch = "x86_64")]
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[test]
fn test_spilled_storage() {
let x = ThinBoxedSlice::from(vec![0; TAG_LIMIT - 1].into_boxed_slice());
@@ -508,7 +508,7 @@ fn test_spilled_storage() {
assert!(x.spilled_storage().is_some());
}
-#[cfg(target_arch = "x86_64")]
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[test]
fn test_from_raw_large() {
let mut vec = vec![0; TAG_LIMIT];
@@ -519,7 +519,7 @@ fn test_from_raw_large() {
assert_eq!(x[123], 456);
}
-#[cfg(target_arch = "x86_64")]
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[test]
fn test_into_raw_large() {
let mut vec = vec![0; TAG_LIMIT];
@@ -531,7 +531,7 @@ fn test_into_raw_large() {
assert_eq!(y[123], 456);
}
-#[cfg(target_arch = "x86_64")]
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
#[test]
fn test_leak_large() {
let mut vec = vec![0; TAG_LIMIT];
--- a/vendor/thin-slice/.cargo-checksum.json
+++ b/vendor/thin-slice/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"Cargo.toml":"bc648e7794ea9bf0b7b520a0ba079ef65226158dc6ece1e617beadc52456e1b7","README.md":"4a83c0adbfdd3ae8047fe4fd26536d27b4e8db813f9926ee8ab09b784294e50f","src/lib.rs":"5b1f2bfc9edfc6036a8880cde88f862931eec5036e6cf63690f82921053b29fe"},"package":"8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c"}
\ No newline at end of file
+{"files":{"Cargo.toml":"bc648e7794ea9bf0b7b520a0ba079ef65226158dc6ece1e617beadc52456e1b7","README.md":"4a83c0adbfdd3ae8047fe4fd26536d27b4e8db813f9926ee8ab09b784294e50f","src/lib.rs":"68b5851ac14dbecdbc5b80a2108d29e84784870ac15018324419514875d57a98"},"package":"8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c"}
More information about the pkg-gnome-maintainers
mailing list