Source: librsvg
Version: 2.63.3+dfsg-1
Tags: patch
User: [email protected]
Usertags: cross-satisfiability ftcbfs
Control: affects 1126007 + src:librsvg

librsvg fails to cross build from source for a fair number of reasons.

The first issue to run into is the locales dependency. The package is
Arch: all and not Multi-Arch: foreign. Rather than figuring out how to
make it work, I observe that it is only used inside dh_auto_test, so
annotating the dependency <!nocheck> is feasible. At that point, it
becomes irrelevant to cross building.

With that change in place, librsvg's dependencies become theoretically
satisfiable. Unfortunately, apt sees a difference to practice. The rustc
and cargo dependencies are interpreted has host architecture
dependencies, so they would get us tools that cannot be run. Since they
are multi-target tools, we need their native version. While the rustc
dependency normally includes libstd-rust-dev, it gets us the wrong
libstd-rust-dev once rustc is annotated :native, so libstd-rust-dev must
be added to Build-Depends explicitly.

At this point, Build-Depends can be installed. Unfortunately, meson
refuses to configure. It objects to enabling the introspection and vala
features as we cannot run host binaries. Indeed, there is no known way
to run the g-ir-scanner without actually running host binaries, but on
Debian the tool hides this fact and transparently uses qemu when needed,
so meson doesn't actually get to run host binaries. For vala, the story
is different. It actually doesn't require running host binaries. I'm not
sure whether removing the "meson.can_run_host_binaries()" calls is
acceptable upstream, but it certainly is not generally correct.

With that change, meson manages to configure librsvg. Unfortunately, it
does not pass a host triplet to cargo, so the Rust components are built
for the build architecture. librsvg's meson.build expect that you pass
the relevant triplet via -Dtriplet= and to be precise, a Rust triplet
rather than a GNU triplet is expected here.
/usr/share/rustc/architecture.mk can compute the relevant value.

Then, the build proceeds quite far until meson launches the wrong
vapigen. This is not a bug in librsvg but in meson itself and it is
reported as #1126007.

Please consider applying the attached patch.

Helmut
diff -Nru librsvg-2.63.3+dfsg/debian/changelog 
librsvg-2.63.3+dfsg/debian/changelog
--- librsvg-2.63.3+dfsg/debian/changelog        2026-10-19 17:37:26.000000000 
+0200
+++ librsvg-2.63.3+dfsg/debian/changelog        2026-11-01 13:35:36.000000000 
+0100
@@ -1,3 +1,14 @@
+librsvg (2.63.3+dfsg-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Improve cross building: (Closes: #-1)
+    + Turn locales dependency optional via <!nocheck>.
+    + Use a native Rust toolchain.
+    + Pass the triplet option to meson.
+    + cross.patch: Reduce introspection and vala requirements.
+
+ -- Helmut Grohne <[email protected]>  Sun, 01 Nov 2026 13:35:36 +0100
+
 librsvg (2.63.3+dfsg-1) unstable; urgency=medium
 
   * New upstream release
diff -Nru librsvg-2.63.3+dfsg/debian/control librsvg-2.63.3+dfsg/debian/control
--- librsvg-2.63.3+dfsg/debian/control  2026-10-19 17:37:26.000000000 +0200
+++ librsvg-2.63.3+dfsg/debian/control  2026-11-01 13:35:36.000000000 +0100
@@ -10,8 +10,8 @@
 Build-Depends:
  debhelper-compat (= 14),
  dh-sequence-gir,
- cargo,
- cargo-c (>= 0.10.10),
+ cargo:native,
+ cargo-c:native (>= 0.10.10),
  gir1.2-cairo-1.0-dev <!nogir>,
  gir1.2-gdkpixbuf-2.0-dev <!nogir>,
  gir1.2-gio-2.0-dev <!nogir>,
@@ -24,11 +24,12 @@
  libglib2.0-dev,
  libharfbuzz-dev,
  libpango1.0-dev (>= 1.58.2),
+ libstd-rust-dev,
  libxml2-dev,
- locales,
+ locales <!nocheck>,
  meson (>= 1.3.0),
  python3-docutils,
- rustc (>= 1.85.1),
+ rustc:native (>= 1.85.1),
  valac,
 Build-Depends-Indep:
  gi-docgen <!nodoc>,
diff -Nru librsvg-2.63.3+dfsg/debian/patches/cross.patch 
librsvg-2.63.3+dfsg/debian/patches/cross.patch
--- librsvg-2.63.3+dfsg/debian/patches/cross.patch      1970-01-01 
01:00:00.000000000 +0100
+++ librsvg-2.63.3+dfsg/debian/patches/cross.patch      2026-11-01 
13:35:36.000000000 +0100
@@ -0,0 +1,14 @@
+--- librsvg-2.63.3+dfsg.orig/meson.build
++++ librsvg-2.63.3+dfsg/meson.build
+@@ -158,9 +158,9 @@
+ if host_system == 'windows'
+   build_gir = 
get_option('introspection').require(get_option('default_library') != 'static' 
and meson.can_run_host_binaries() and gi_dep.found())
+ else
+-  build_gir = 
get_option('introspection').require(meson.can_run_host_binaries() and 
gi_dep.found())
++  build_gir = get_option('introspection').require(gi_dep.found())
+ endif
+-build_vala = get_option('vala').require(meson.can_run_host_binaries() and 
vapigen_dep.found())
++build_vala = get_option('vala').require(vapigen_dep.found())
+ 
+ build_rsvg_convert = get_option('rsvg-convert')
+ 
diff -Nru librsvg-2.63.3+dfsg/debian/patches/series 
librsvg-2.63.3+dfsg/debian/patches/series
--- librsvg-2.63.3+dfsg/debian/patches/series   2026-10-19 17:37:26.000000000 
+0200
+++ librsvg-2.63.3+dfsg/debian/patches/series   2026-11-01 13:35:36.000000000 
+0100
@@ -4,3 +4,4 @@
 workarounds/skip-broken-reftests.diff
 workarounds/Skip-invalid_viewbox-test-on-32-bit-x86.patch
 workarounds/tests-Skip-known-failing-tests-on-i386.patch
+cross.patch
diff -Nru librsvg-2.63.3+dfsg/debian/rules librsvg-2.63.3+dfsg/debian/rules
--- librsvg-2.63.3+dfsg/debian/rules    2026-10-19 17:37:26.000000000 +0200
+++ librsvg-2.63.3+dfsg/debian/rules    2026-11-01 13:35:36.000000000 +0100
@@ -7,6 +7,8 @@
 export CARGO_VENDOR_DIR = $(CURDIR)/debian/missing-sources
 NULL =
 
+include /usr/share/rustc/architecture.mk
+
 # Increase reftest tolerance a bit to account for different harfbuzz,
 # pango, etc.
 export RSVG_TEST_TOLERANCE=20
@@ -27,6 +29,7 @@
        dh_auto_configure -- \
                -Davif=$(if $(shell dpkg-vendor --derives-from Ubuntu && echo 
y),disabled,enabled) \
                -Dpixbuf-loader=enabled \
+               -Dtriplet=$(DEB_HOST_RUST_TYPE) \
                $(NULL)
 
 execute_after_dh_auto_build:

Reply via email to