Package: src:onnxruntime
Version: 1.23.2+dfsg-6.1

Hi!

While rebuilding the python related packages against the Python 3.15rc2
version we found that onnxruntime fails to build from source [1].

onnxruntime was affected by two rc bugs:
- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1148258
  FTBFS: CMake: target not found: Microsoft.GSL::GSL
  reported 2026-09-18
- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1133592
  ftbfs with GCC-16
  reported 2026-04-13

Given the time that passed since the issues were reported I prepared and
uploaded a non-maintainer upload to tackle these.

I'm attaching the format-patch of the changes so the git history
contains the fine granularity of the changes, but since the package
seems to be using git-buildpackage you can easily use gbp import-dsc to
import the nmu without the fine grain.

Happy hacking,

[1]: https://debusine.debian.net/debian/r-python-python3.15/artifact/4313290/

--
"Can you imagine what I would do if I could do all I can?" -- Sun Tzu
Saludos /\/\ /\ >< `/
From 782f6d4a041678443f27fd7c275715343a906c48 Mon Sep 17 00:00:00 2001
From: Maximiliano Curia <[email protected]>
Date: Mon, 21 Sep 2026 23:09:32 +0200
Subject: [PATCH 1/5] Add patch to fix compilation against gcc 16

Closes: #1133592
---
 debian/patches/fix-compilation-gcc-16.patch | 23 +++++++++++++++++++++
 debian/patches/series                       |  1 +
 2 files changed, 24 insertions(+)
 create mode 100644 debian/patches/fix-compilation-gcc-16.patch

diff --git a/debian/patches/fix-compilation-gcc-16.patch b/debian/patches/fix-compilation-gcc-16.patch
new file mode 100644
index 0000000000..3936db66ef
--- /dev/null
+++ b/debian/patches/fix-compilation-gcc-16.patch
@@ -0,0 +1,23 @@
+Description: Ignore -Wsfinae-incomplete warning on GCC 16
+Forwarded: no
+
+--- a/cmake/CMakeLists.txt
++++ b/cmake/CMakeLists.txt
+@@ -582,6 +582,7 @@ else()
+   check_cxx_compiler_flag(-Wnonnull-compare HAS_NONNULL_COMPARE)
+   check_cxx_compiler_flag(-Wparentheses HAS_PARENTHESES)
+   check_cxx_compiler_flag(-Wshorten-64-to-32 HAS_SHORTEN_64_TO_32)
++  check_cxx_compiler_flag(-Wsfinae-incomplete HAS_SFINAE_INCOMPLETE)
+   check_cxx_compiler_flag(-Wstrict-aliasing HAS_STRICT_ALIASING)
+   check_nvcc_compiler_flag(-Wstrict-aliasing NVCC_HAS_STRICT_ALIASING)
+   check_cxx_compiler_flag(-Wstringop-overflow HAS_STRINGOP_OVERFLOW)
+@@ -616,6 +617,9 @@ else()
+     #we may have extra null pointer checkings in debug build, it's not an issue
+     list(APPEND ORT_WARNING_FLAGS -Wno-nonnull-compare)
+   endif()
++  if (HAS_SFINAE_INCOMPLETE)
++    list(APPEND ORT_WARNING_FLAGS -Wno-sfinae-incomplete)
++  endif()
+ 
+   if (HAS_AMBIGUOUS_REVERSED_OPERATOR)
+     list(APPEND ORT_WARNING_FLAGS -Wno-ambiguous-reversed-operator)
diff --git a/debian/patches/series b/debian/patches/series
index 693f2f813c..b2ecc7c57b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -23,3 +23,4 @@ use-system-dlpack.patch
 set-noexecstack-linker-flag.patch
 fix-range-loop-construct.patch
 upstream/Fix-test-errors-during-onnxruntime-cann-build-and-compila.patch
+fix-compilation-gcc-16.patch
-- 
2.53.0

From 34aabc165dad49c3b51b5390f83c82901a8d0b49 Mon Sep 17 00:00:00 2001
From: Maximiliano Curia <[email protected]>
Date: Tue, 22 Sep 2026 09:32:47 +0200
Subject: [PATCH 2/5] Add patch to use any gsl version

Closes: #1148258
---
 debian/patches/series           |  1 +
 debian/patches/system-gsl.patch | 23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+)
 create mode 100644 debian/patches/system-gsl.patch

diff --git a/debian/patches/series b/debian/patches/series
index b2ecc7c57b..c2e7ae1908 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -24,3 +24,4 @@ set-noexecstack-linker-flag.patch
 fix-range-loop-construct.patch
 upstream/Fix-test-errors-during-onnxruntime-cann-build-and-compila.patch
 fix-compilation-gcc-16.patch
+system-gsl.patch
diff --git a/debian/patches/system-gsl.patch b/debian/patches/system-gsl.patch
new file mode 100644
index 0000000000..3adc488f68
--- /dev/null
+++ b/debian/patches/system-gsl.patch
@@ -0,0 +1,23 @@
+Description: Use system GSL lib (libmsgsl-dev)
+Forwarded: not-needed
+
+--- a/cmake/external/onnxruntime_external_deps.cmake
++++ b/cmake/external/onnxruntime_external_deps.cmake
+@@ -352,7 +352,7 @@ if(onnxruntime_USE_CUDA)
+     URL_HASH SHA1=${DEP_SHA1_microsoft_gsl}
+     PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/gsl/1064.patch
+     EXCLUDE_FROM_ALL
+-    FIND_PACKAGE_ARGS 4.0 NAMES Microsoft.GSL
++    FIND_PACKAGE_ARGS NAMES Microsoft.GSL
+   )
+ else()
+   onnxruntime_fetchcontent_declare(
+@@ -360,7 +360,7 @@ else()
+     URL ${DEP_URL_microsoft_gsl}
+     URL_HASH SHA1=${DEP_SHA1_microsoft_gsl}
+     EXCLUDE_FROM_ALL
+-    FIND_PACKAGE_ARGS 4.0 NAMES Microsoft.GSL
++    FIND_PACKAGE_ARGS NAMES Microsoft.GSL
+   )
+ endif()
+ set(GSL_TARGET "Microsoft.GSL::GSL")
-- 
2.53.0

From 8e04ed5608ec862c963219b7fe6a9ef50d25f56d Mon Sep 17 00:00:00 2001
From: Maximiliano Curia <[email protected]>
Date: Tue, 22 Sep 2026 09:33:40 +0200
Subject: [PATCH 3/5] Prepare changelog

---
 debian/changelog | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 090c939619..768759a6d2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+onnxruntime (1.23.2+dfsg-6.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload
+  * Add patch to fix compilation against gcc 16 (Closes: #1133592)
+  * Add patch to use any gsl version (Closes: #1148258)
+
+ -- Maximiliano Curia <[email protected]>  Tue, 22 Sep 2026 09:32:51 +0200
+
 onnxruntime (1.23.2+dfsg-6) unstable; urgency=medium
 
   * Pass -Wno-error=unused-variable to avoid FTBFS on the amd64v3
-- 
2.53.0

From 560f23ef4d9ee524c674f981767351279e0474b1 Mon Sep 17 00:00:00 2001
From: Maximiliano Curia <[email protected]>
Date: Tue, 22 Sep 2026 10:28:28 +0200
Subject: [PATCH 4/5] Append -Wno-error=unused-but-set-variable

---
 debian/rules | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/debian/rules b/debian/rules
index 37fbc9a0d9..342f0b5cff 100755
--- a/debian/rules
+++ b/debian/rules
@@ -14,8 +14,8 @@ ifeq ($(DEB_HOST_ARCH),i386)
 endif
 
 # https://github.com/microsoft/onnxruntime/issues/25681
-export DEB_CFLAGS_MAINT_APPEND   += -Wno-error=uninitialized -Wno-error=array-bounds -Wno-error=unused-variable
-export DEB_CXXFLAGS_MAINT_APPEND += -Wno-error=uninitialized -Wno-error=array-bounds -Wno-error=unused-variable
+export DEB_CFLAGS_MAINT_APPEND   += -Wno-error=uninitialized -Wno-error=array-bounds -Wno-error=unused-variable -Wno-error=unused-but-set-variable
+export DEB_CXXFLAGS_MAINT_APPEND += -Wno-error=uninitialized -Wno-error=array-bounds -Wno-error=unused-variable -Wno-error=unused-but-set-variable
 
 FULLVERSION=1.23.1
 SOVERSION=1.23
-- 
2.53.0

From 3a93fea0f8fa88ef9f02cfb9769586fdd0c2d1a0 Mon Sep 17 00:00:00 2001
From: Maximiliano Curia <[email protected]>
Date: Tue, 22 Sep 2026 11:46:26 +0200
Subject: [PATCH 5/5] Release to unstable

---
 debian/changelog | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 768759a6d2..3e877a28be 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,10 +1,11 @@
-onnxruntime (1.23.2+dfsg-6.1) UNRELEASED; urgency=medium
+onnxruntime (1.23.2+dfsg-6.1) unstable; urgency=medium
 
   * Non-maintainer upload
   * Add patch to fix compilation against gcc 16 (Closes: #1133592)
   * Add patch to use any gsl version (Closes: #1148258)
+  * Ignore warning unused-but-set-variable
 
- -- Maximiliano Curia <[email protected]>  Tue, 22 Sep 2026 09:32:51 +0200
+ -- Maximiliano Curia <[email protected]>  Tue, 22 Sep 2026 11:45:48 +0200
 
 onnxruntime (1.23.2+dfsg-6) unstable; urgency=medium
 
-- 
2.53.0

Reply via email to