From 56dd94b14d4ee35a305b97c59028309562d9e326 Mon Sep 17 00:00:00 2001 From: whispers Date: Sat, 20 Dec 2025 12:02:58 -0500 Subject: [PATCH] intel-graphics-compiler: fix build with gcc 15 LLVM 16, which this release of IGC is based on, fails to build with GCC 15 due to a missing include of `` and an include of `` instead of ``. We patch LLVM directly in order to fix these build failures. Additionally, a warning under `-Wfree-nonheap-object` is emitted within LLVM, and causes compile failures due to `-Werror`. In accordance with IGC disabling warnings where they originate from within LLVM (see `IGC/common/LLVMWarningsPush.hpp`), we patch in an ignore for this warning. --- ...low-llvm-free-nonheap-object-warning.patch | 14 +++++++++++ .../gcc15-llvm-header-fixes.patch | 25 +++++++++++++++++++ .../in/intel-graphics-compiler/package.nix | 10 ++++++++ 3 files changed, 49 insertions(+) create mode 100644 pkgs/by-name/in/intel-graphics-compiler/gcc15-allow-llvm-free-nonheap-object-warning.patch create mode 100644 pkgs/by-name/in/intel-graphics-compiler/gcc15-llvm-header-fixes.patch diff --git a/pkgs/by-name/in/intel-graphics-compiler/gcc15-allow-llvm-free-nonheap-object-warning.patch b/pkgs/by-name/in/intel-graphics-compiler/gcc15-allow-llvm-free-nonheap-object-warning.patch new file mode 100644 index 000000000000..90cd81176d12 --- /dev/null +++ b/pkgs/by-name/in/intel-graphics-compiler/gcc15-allow-llvm-free-nonheap-object-warning.patch @@ -0,0 +1,14 @@ +diff --git a/igc/IGC/common/LLVMWarningsPush.hpp b/igc/IGC/common/LLVMWarningsPush.hpp +index 12874dfcc2..38acd80943 100644 +--- a/igc/IGC/common/LLVMWarningsPush.hpp ++++ b/igc/IGC/common/LLVMWarningsPush.hpp +@@ -43,6 +43,9 @@ + #if __GNUC__ > 8 + #pragma GCC diagnostic ignored "-Winit-list-lifetime" + #endif ++#if __GNUC__ > 14 ++#pragma GCC diagnostic ignored "-Wfree-nonheap-object" ++#endif + #endif + + #if defined(_WIN32) || defined(_WIN64) diff --git a/pkgs/by-name/in/intel-graphics-compiler/gcc15-llvm-header-fixes.patch b/pkgs/by-name/in/intel-graphics-compiler/gcc15-llvm-header-fixes.patch new file mode 100644 index 000000000000..b60b995a726c --- /dev/null +++ b/pkgs/by-name/in/intel-graphics-compiler/gcc15-llvm-header-fixes.patch @@ -0,0 +1,25 @@ +diff --git a/llvm-project/llvm/include/llvm/ADT/SmallVector.h b/llvm-project/llvm/include/llvm/ADT/SmallVector.h +index 98dce89168..a52947e16e 100644 +--- a/llvm-project/llvm/include/llvm/ADT/SmallVector.h ++++ b/llvm-project/llvm/include/llvm/ADT/SmallVector.h +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + #include + #include + #include +diff --git a/llvm-project/llvm/include/llvm/Support/Threading.h b/llvm-project/llvm/include/llvm/Support/Threading.h +index ba6c531ab4..78aa5e7be5 100644 +--- a/llvm-project/llvm/include/llvm/Support/Threading.h ++++ b/llvm-project/llvm/include/llvm/Support/Threading.h +@@ -18,7 +18,7 @@ + #include "llvm/ADT/StringRef.h" + #include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX + #include "llvm/Support/Compiler.h" +-#include // So we can check the C++ standard lib macros. ++#include // So we can check the C++ standard lib macros. + #include + + #if defined(_MSC_VER) diff --git a/pkgs/by-name/in/intel-graphics-compiler/package.nix b/pkgs/by-name/in/intel-graphics-compiler/package.nix index d3d217f9591d..2b70443cec1c 100644 --- a/pkgs/by-name/in/intel-graphics-compiler/package.nix +++ b/pkgs/by-name/in/intel-graphics-compiler/package.nix @@ -66,6 +66,16 @@ stdenv.mkDerivation rec { # https://github.com/intel/intel-graphics-compiler/commit/4f0123a7d67fb716b647f0ba5c1ab550abf2f97d # https://github.com/intel/intel-graphics-compiler/pull/364 ./bump-cmake.patch + + # Fix for GCC 15 by adding a previously-implicit `#include ` and + # replacing `` with `` in the the llvm directory. Based + # on https://github.com/intel/intel-graphics-compiler/pull/383. + ./gcc15-llvm-header-fixes.patch + + # Fix for GCC 15 by disabling `-Werror` for `-Wfree-nonheap-object` + # warnings within LLVM. This is in accordance with IGC disabling warnings + # that originate from within LLVM (see `IGC/common/LLVMWarningsPush.hpp`). + ./gcc15-allow-llvm-free-nonheap-object-warning.patch ]; sourceRoot = ".";