From c529f16459b0f725dc15d2d33bc0e012551bc1be Mon Sep 17 00:00:00 2001 From: ghpzin Date: Tue, 16 Sep 2025 15:25:37 +0300 Subject: [PATCH] assimp: fix build with gcc15 - add patch from merged upstream PR: https://www.github.com/assimp/assimp/pull/6283 Fixes build failure with gcc15: ``` /build/source/code/AssetLib/X3D/X3DGeoHelper.cpp: In static member function 'static void Assimp::X3DGeoHelper::coordIdx_str2lines_arr(const std::vector&, std::vector&)': /build/source/code/AssetLib/X3D/X3DGeoHelper.cpp:194:20: error: array subscript -1 is outside array bounds of 'int [2305843009213693951]' [-Werror=array-bounds=] 194 | if (f_data.back() != (-1)) { | ~~~~~~~~~~~^~ In file included from /nix/store/9jzssiinw6a2dib6k3hzd48j6ywck4iw-gcc-15.2.0/include/c++/15.2.0/x86_64-unknown-linux-gnu/bits/c++allocator.h:33, from /nix/store/9jzssiinw6a2dib6k3hzd48j6ywck4iw-gcc-15.2.0/include/c++/15.2.0/bits/allocator.h:46, from /nix/store/9jzssiinw6a2dib6k3hzd48j6ywck4iw-gcc-15.2.0/include/c++/15.2.0/string:45, from /build/source/include/assimp/types.h:78, from /build/source/code/AssetLib/X3D/X3DGeoHelper.h:6, from /build/source/code/AssetLib/X3D/X3DGeoHelper.cpp:1: ``` --- pkgs/by-name/as/assimp/package.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/by-name/as/assimp/package.nix b/pkgs/by-name/as/assimp/package.nix index 183254f19388..98efe5c597ea 100644 --- a/pkgs/by-name/as/assimp/package.nix +++ b/pkgs/by-name/as/assimp/package.nix @@ -2,6 +2,7 @@ lib, stdenv, fetchFromGitHub, + fetchpatch, cmake, zlib, nix-update-script, @@ -23,6 +24,16 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-ixtqK+3iiL17GEbEVHz5S6+gJDDQP7bVuSfRMJMGEOY="; }; + patches = [ + # Fix build with gcc15 + # https://github.com/assimp/assimp/pull/6283 + (fetchpatch { + name = "assimp-fix-invalid-vector-gcc15.patch"; + url = "https://github.com/assimp/assimp/commit/59bc03d931270b6354690512d0c881eec8b97678.patch"; + hash = "sha256-O+JPwcOdyFtmFE7eZojHo1DUavF5EhLYlUyxtYo/KF4="; + }) + ]; + nativeBuildInputs = [ cmake ]; buildInputs = [