#1133592 onnxruntime: ftbfs with GCC-16

#1133592#5
Date:
2026-04-13 13:09:06 UTC
From:
To:
Hi,

onnxruntime fails to build in a test rebuild on at least amd64 and arm64 with
gcc-16/g++-16, but builds properly with gcc-15/g++-15. The severity of this
report will be raised before the forky release.

The full build log can be found at:
https://people.debian.org/~ema/gcc-16-rebuilds/output-1/onnxruntime_arm64.build.xz

The last lines of the build log are at the end of this report.

To build with GCC 16, either set CC=gcc-16 CXX=g++-16 explicitly,
or install the gcc, g++, gfortran, ... packages from experimental.

  apt-get -t=experimental install g++

Common build failures include unused (but set) variables, array subscripts
partly outside array bounds, and new/dropped symbols in Debian symbols files.
For other C/C++ related build failures see the porting guide at
http://gcc.gnu.org/gcc-16/porting_to.html

Please only close this issue after double-checking that the package can be
built correctly with GCC 16.

Please do not reassign this bug to another package. If a fix in another package
is required, then file a bug for the other package (or clone), and mark this
bug as blocked by the bug in the other package.

[...]


/usr/include/c++/16/bits/refwrap.h:227:12: note: here.  Use ‘-Wsfinae-incomplete=2’ for a diagnostic at that point
  227 |     struct _Reference_wrapper_base
      |            ^~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
[248/653] /usr/bin/c++ -DCPUINFO_SUPPORTED_PLATFORM=1 -DDISABLE_ABSEIL -DDNNL_OPENMP -DEIGEN_MPL2_ONLY -DEIGEN_USE_THREADS -DENABLE_DLPACK -DHAS_STRING_VIEW=1 -DONLY_C_LOCALE=1 -DONNX_ML=1 -DONNX_NAMESPACE=onnx -DORT_ENABLE_STREAM -DPLATFORM_POSIX -DUSE_DNNL=1 -DUSE_XNNPACK=1 -D_GNU_SOURCE -I/build/reproducible-path/onnxruntime-1.23.2+dfsg/include/onnxruntime -I/build/reproducible-path/onnxruntime-1.23.2+dfsg/include/onnxruntime/core/session -I/build/reproducible-path/onnxruntime-1.23.2+dfsg -I/build/reproducible-path/onnxruntime-1.23.2+dfsg/onnxruntime -I/usr/include/safeint -g -ffile-prefix-map=/build/reproducible-path/onnxruntime-1.23.2+dfsg=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -mbranch-protection=standard -O3 -Wno-error=uninitialized -Wno-error=array-bounds -Wno-error=unused-variable -Wdate-time -D_FORTIFY_SOURCE=2 -ffunction-sections -fdata-sections -DCPUINFO_SUPPORTED -O3 -DNDEBUG -std=gnu++17 -fPIC -Wall -Wextra -Wno-deprecated-copy -Wno-nonnull-compare -Wno-deprecated-literal-operator -Wno-interference-size -Wno-parentheses -Wno-deprecated-declarations -Werror -MD -MT CMakeFiles/onnxruntime_graph.dir/onnxruntime/core/graph/graph.cc.o -MF CMakeFiles/onnxruntime_graph.dir/onnxruntime/core/graph/graph.cc.o.d -o CMakeFiles/onnxruntime_graph.dir/onnxruntime/core/graph/graph.cc.o -c /build/reproducible-path/onnxruntime-1.23.2+dfsg/onnxruntime/core/graph/graph.cc
FAILED: [code=1] CMakeFiles/onnxruntime_graph.dir/onnxruntime/core/graph/graph.cc.o
/usr/bin/c++ -DCPUINFO_SUPPORTED_PLATFORM=1 -DDISABLE_ABSEIL -DDNNL_OPENMP -DEIGEN_MPL2_ONLY -DEIGEN_USE_THREADS -DENABLE_DLPACK -DHAS_STRING_VIEW=1 -DONLY_C_LOCALE=1 -DONNX_ML=1 -DONNX_NAMESPACE=onnx -DORT_ENABLE_STREAM -DPLATFORM_POSIX -DUSE_DNNL=1 -DUSE_XNNPACK=1 -D_GNU_SOURCE -I/build/reproducible-path/onnxruntime-1.23.2+dfsg/include/onnxruntime -I/build/reproducible-path/onnxruntime-1.23.2+dfsg/include/onnxruntime/core/session -I/build/reproducible-path/onnxruntime-1.23.2+dfsg -I/build/reproducible-path/onnxruntime-1.23.2+dfsg/onnxruntime -I/usr/include/safeint -g -ffile-prefix-map=/build/reproducible-path/onnxruntime-1.23.2+dfsg=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -mbranch-protection=standard -O3 -Wno-error=uninitialized -Wno-error=array-bounds -Wno-error=unused-variable -Wdate-time -D_FORTIFY_SOURCE=2 -ffunction-sections -fdata-sections -DCPUINFO_SUPPORTED -O3 -DNDEBUG -std=gnu++17 -fPIC -Wall -Wextra -Wno-deprecated-copy -Wno-nonnull-compare -Wno-deprecated-literal-operator -Wno-interference-size -Wno-parentheses -Wno-deprecated-declarations -Werror -MD -MT CMakeFiles/onnxruntime_graph.dir/onnxruntime/core/graph/graph.cc.o -MF CMakeFiles/onnxruntime_graph.dir/onnxruntime/core/graph/graph.cc.o.d -o CMakeFiles/onnxruntime_graph.dir/onnxruntime/core/graph/graph.cc.o -c /build/reproducible-path/onnxruntime-1.23.2+dfsg/onnxruntime/core/graph/graph.cc
In file included from /build/reproducible-path/onnxruntime-1.23.2+dfsg/include/onnxruntime/core/framework/op_kernel.h:24,
                 from /build/reproducible-path/onnxruntime-1.23.2+dfsg/onnxruntime/core/framework/session_state.h:33,
                 from /build/reproducible-path/onnxruntime-1.23.2+dfsg/onnxruntime/core/framework/utils.h:11,
                 from /build/reproducible-path/onnxruntime-1.23.2+dfsg/onnxruntime/core/graph/graph.cc:27:
/build/reproducible-path/onnxruntime-1.23.2+dfsg/include/onnxruntime/core/framework/sparse_tensor.h:55:7: error: defining ‘onnxruntime::SparseTensor’, which previously failed to be complete in a SFINAE context [-Werror=sfinae-incomplete=]
   55 | class SparseTensor final {
      |       ^~~~~~~~~~~~
In file included from /usr/include/c++/16/bits/shared_ptr_base.h:57,
                 from /usr/include/c++/16/bits/shared_ptr.h:53,
                 from /usr/include/c++/16/bits/fs_path.h:46,
                 from /usr/include/c++/16/filesystem:55,
                 from /build/reproducible-path/onnxruntime-1.23.2+dfsg/include/onnxruntime/core/graph/graph.h:6,
                 from /build/reproducible-path/onnxruntime-1.23.2+dfsg/onnxruntime/core/graph/graph.cc:4:
/usr/include/c++/16/bits/refwrap.h:227:12: note: here.  Use ‘-Wsfinae-incomplete=2’ for a diagnostic at that point
  227 |     struct _Reference_wrapper_base
      |            ^~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
[249/653] /usr/bin/c++ -DCPUINFO_SUPPORTED_PLATFORM=1 -DDISABLE_ABSEIL -DDNNL_OPENMP -DEIGEN_MPL2_ONLY -DEIGEN_USE_THREADS -DENABLE_DLPACK -DHAS_STRING_VIEW=1 -DONLY_C_LOCALE=1 -DONNX_ML=1 -DONNX_NAMESPACE=onnx -DORT_ENABLE_STREAM -DPLATFORM_POSIX -DUSE_DNNL=1 -DUSE_XNNPACK=1 -D_GNU_SOURCE -I/build/reproducible-path/onnxruntime-1.23.2+dfsg/include/onnxruntime -I/build/reproducible-path/onnxruntime-1.23.2+dfsg/include/onnxruntime/core/session -I/build/reproducible-path/onnxruntime-1.23.2+dfsg -I/build/reproducible-path/onnxruntime-1.23.2+dfsg/onnxruntime -I/usr/include/safeint -I/usr/include/eigen3 -g -ffile-prefix-map=/build/reproducible-path/onnxruntime-1.23.2+dfsg=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -mbranch-protection=standard -O3 -Wno-error=uninitialized -Wno-error=array-bounds -Wno-error=unused-variable -Wdate-time -D_FORTIFY_SOURCE=2 -ffunction-sections -fdata-sections -DCPUINFO_SUPPORTED -O3 -DNDEBUG -std=gnu++17 -fPIC -Wall -Wextra -Wno-deprecated-copy -Wno-nonnull-compare -Wno-deprecated-literal-operator -Wno-interference-size -Wno-error=comment -Werror -MD -MT CMakeFiles/onnxruntime_util.dir/onnxruntime/core/util/math_cpu.cc.o -MF CMakeFiles/onnxruntime_util.dir/onnxruntime/core/util/math_cpu.cc.o.d -o CMakeFiles/onnxruntime_util.dir/onnxruntime/core/util/math_cpu.cc.o -c /build/reproducible-path/onnxruntime-1.23.2+dfsg/onnxruntime/core/util/math_cpu.cc
[250/653] /usr/bin/c++ -DCPUINFO_SUPPORTED_PLATFORM=1 -DDISABLE_ABSEIL -DDNNL_OPENMP -DEIGEN_MPL2_ONLY -DEIGEN_USE_THREADS -DENABLE_DLPACK -DHAS_STRING_VIEW=1 -DONLY_C_LOCALE=1 -DONNX_ML=1 -DONNX_NAMESPACE=onnx -DORT_ENABLE_STREAM -DPLATFORM_POSIX -DUSE_DNNL=1 -DUSE_XNNPACK=1 -D_GNU_SOURCE -I/build/reproducible-path/onnxruntime-1.23.2+dfsg/include/onnxruntime -I/build/reproducible-path/onnxruntime-1.23.2+dfsg/include/onnxruntime/core/session -I/build/reproducible-path/onnxruntime-1.23.2+dfsg -I/build/reproducible-path/onnxruntime-1.23.2+dfsg/onnxruntime -I/usr/include/safeint -I/usr/include/eigen3 -g -ffile-prefix-map=/build/reproducible-path/onnxruntime-1.23.2+dfsg=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -mbranch-protection=standard -O3 -Wno-error=uninitialized -Wno-error=array-bounds -Wno-error=unused-variable -Wdate-time -D_FORTIFY_SOURCE=2 -ffunction-sections -fdata-sections -DCPUINFO_SUPPORTED -O3 -DNDEBUG -std=gnu++17 -fPIC -Wall -Wextra -Wno-deprecated-copy -Wno-nonnull-compare -Wno-deprecated-literal-operator -Wno-interference-size -Werror -MD -MT CMakeFiles/onnxruntime_providers.dir/onnxruntime/core/providers/cpu/math/element_wise_ops.cc.o -MF CMakeFiles/onnxruntime_providers.dir/onnxruntime/core/providers/cpu/math/element_wise_ops.cc.o.d -o CMakeFiles/onnxruntime_providers.dir/onnxruntime/core/providers/cpu/math/element_wise_ops.cc.o -c /build/reproducible-path/onnxruntime-1.23.2+dfsg/onnxruntime/core/providers/cpu/math/element_wise_ops.cc
FAILED: [code=1] CMakeFiles/onnxruntime_providers.dir/onnxruntime/core/providers/cpu/math/element_wise_ops.cc.o
/usr/bin/c++ -DCPUINFO_SUPPORTED_PLATFORM=1 -DDISABLE_ABSEIL -DDNNL_OPENMP -DEIGEN_MPL2_ONLY -DEIGEN_USE_THREADS -DENABLE_DLPACK -DHAS_STRING_VIEW=1 -DONLY_C_LOCALE=1 -DONNX_ML=1 -DONNX_NAMESPACE=onnx -DORT_ENABLE_STREAM -DPLATFORM_POSIX -DUSE_DNNL=1 -DUSE_XNNPACK=1 -D_GNU_SOURCE -I/build/reproducible-path/onnxruntime-1.23.2+dfsg/include/onnxruntime -I/build/reproducible-path/onnxruntime-1.23.2+dfsg/include/onnxruntime/core/session -I/build/reproducible-path/onnxruntime-1.23.2+dfsg -I/build/reproducible-path/onnxruntime-1.23.2+dfsg/onnxruntime -I/usr/include/safeint -I/usr/include/eigen3 -g -ffile-prefix-map=/build/reproducible-path/onnxruntime-1.23.2+dfsg=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -mbranch-protection=standard -O3 -Wno-error=uninitialized -Wno-error=array-bounds -Wno-error=unused-variable -Wdate-time -D_FORTIFY_SOURCE=2 -ffunction-sections -fdata-sections -DCPUINFO_SUPPORTED -O3 -DNDEBUG -std=gnu++17 -fPIC -Wall -Wextra -Wno-deprecated-copy -Wno-nonnull-compare -Wno-deprecated-literal-operator -Wno-interference-size -Werror -MD -MT CMakeFiles/onnxruntime_providers.dir/onnxruntime/core/providers/cpu/math/element_wise_ops.cc.o -MF CMakeFiles/onnxruntime_providers.dir/onnxruntime/core/providers/cpu/math/element_wise_ops.cc.o.d -o CMakeFiles/onnxruntime_providers.dir/onnxruntime/core/providers/cpu/math/element_wise_ops.cc.o -c /build/reproducible-path/onnxruntime-1.23.2+dfsg/onnxruntime/core/providers/cpu/math/element_wise_ops.cc
In file included from /build/reproducible-path/onnxruntime-1.23.2+dfsg/include/onnxruntime/core/framework/execution_provider.h:17,
                 from /build/reproducible-path/onnxruntime-1.23.2+dfsg/include/onnxruntime/core/framework/op_kernel.h:19,
                 from /build/reproducible-path/onnxruntime-1.23.2+dfsg/onnxruntime/core/providers/cpu/math/element_wise_ops.h:9,
                 from /build/reproducible-path/onnxruntime-1.23.2+dfsg/onnxruntime/core/providers/cpu/math/element_wise_ops.cc:4:
/build/reproducible-path/onnxruntime-1.23.2+dfsg/include/onnxruntime/core/framework/tensor.h:39:7: error: defining ‘onnxruntime::Tensor’, which previously failed to be complete in a SFINAE context [-Werror=sfinae-incomplete=]
   39 | class Tensor final {
      |       ^~~~~~
In file included from /usr/include/c++/16/functional:74,
                 from /build/reproducible-path/onnxruntime-1.23.2+dfsg/include/onnxruntime/core/common/common.h:24,
                 from /build/reproducible-path/onnxruntime-1.23.2+dfsg/onnxruntime/core/providers/cpu/math/element_wise_ops.h:6:
/usr/include/c++/16/bits/refwrap.h:227:12: note: here.  Use ‘-Wsfinae-incomplete=2’ for a diagnostic at that point
  227 |     struct _Reference_wrapper_base
      |            ^~~~~~~~~~~~~~~~~~~~~~~
In file included from /build/reproducible-path/onnxruntime-1.23.2+dfsg/include/onnxruntime/core/graph/graph_viewer.h:8,
                 from /build/reproducible-path/onnxruntime-1.23.2+dfsg/include/onnxruntime/core/framework/op_node_proto_helper.h:9,
                 from /build/reproducible-path/onnxruntime-1.23.2+dfsg/include/onnxruntime/core/framework/op_kernel_info.h:9,
                 from /build/reproducible-path/onnxruntime-1.23.2+dfsg/include/onnxruntime/core/framework/op_kernel.h:21:
/build/reproducible-path/onnxruntime-1.23.2+dfsg/include/onnxruntime/core/graph/graph.h:68:7: error: defining ‘onnxruntime::Node’, which previously failed to be complete in a SFINAE context [-Werror=sfinae-incomplete=]
   68 | class Node {
      |       ^~~~
/usr/include/c++/16/bits/refwrap.h:227:12: note: here.  Use ‘-Wsfinae-incomplete=2’ for a diagnostic at that point
  227 |     struct _Reference_wrapper_base
      |            ^~~~~~~~~~~~~~~~~~~~~~~
/build/reproducible-path/onnxruntime-1.23.2+dfsg/include/onnxruntime/core/graph/graph_viewer.h:28:7: error: defining ‘onnxruntime::GraphViewer’, which previously failed to be complete in a SFINAE context [-Werror=sfinae-incomplete=]
   28 | class GraphViewer {
      |       ^~~~~~~~~~~
/usr/include/c++/16/bits/refwrap.h:227:12: note: here.  Use ‘-Wsfinae-incomplete=2’ for a diagnostic at that point
  227 |     struct _Reference_wrapper_base
      |            ^~~~~~~~~~~~~~~~~~~~~~~
In file included from /build/reproducible-path/onnxruntime-1.23.2+dfsg/include/onnxruntime/core/framework/op_kernel.h:24:
/build/reproducible-path/onnxruntime-1.23.2+dfsg/include/onnxruntime/core/framework/sparse_tensor.h:55:7: error: defining ‘onnxruntime::SparseTensor’, which previously failed to be complete in a SFINAE context [-Werror=sfinae-incomplete=]
   55 | class SparseTensor final {
      |       ^~~~~~~~~~~~
/usr/include/c++/16/bits/refwrap.h:227:12: note: here.  Use ‘-Wsfinae-incomplete=2’ for a diagnostic at that point
  227 |     struct _Reference_wrapper_base
      |            ^~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
ninja: build stopped: subcommand failed.
dh_auto_build: error: LC_ALL=C.UTF-8 ninja -j128 -v returned exit code 1
make[1]: *** [debian/rules:70: override_dh_auto_build] Error 25
make[1]: Leaving directory '/build/reproducible-path/onnxruntime-1.23.2+dfsg'
make: *** [debian/rules:46: binary] Error 2
dpkg-buildpackage: error: debian/rules binary subprocess failed with exit status 2