From 3d2200b18c62a3ecba9490bc40eb808e3db9b24c Mon Sep 17 00:00:00 2001 From: ghpzin Date: Sun, 21 Sep 2025 02:42:44 +0300 Subject: [PATCH] llvmPackages_18.lldb: fix build with gcc15 - add patch from upstream commit that was not backported to llvm_18: https://github.com/llvm/llvm-project/commit/bb59f04e7e75dcbe39f1bf952304a157f0035314 Fixes build failure with gcc15: ``` In file included from /build/lldb-src-18.1.8/lldb/source/Utility/AddressableBits.cpp:9: /build/lldb-src-18.1.8/lldb/include/lldb/Utility/AddressableBits.h:25:27: error: 'uint32_t' has not been declared 25 | void SetAddressableBits(uint32_t addressing_bits); | ^~~~~~~~ /build/lldb-src-18.1.8/lldb/include/lldb/Utility/AddressableBits.h:13:1: note: 'uint32_t' is defined in header ''; this is probably fixable by adding '#include ' 12 | #include "lldb/lldb-forward.h" +++ |+#include 13 | ``` Cannot use `fetchpatch` because patch does not apply on llvm_18 (no `#include "lldb/lldb-public.h"` line on llvm_18). --- .../compilers/llvm/common/lldb/default.nix | 9 ++++++++- .../common/lldb/lldb-add-include-cstdint.patch | 16 ++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/compilers/llvm/common/lldb/lldb-add-include-cstdint.patch diff --git a/pkgs/development/compilers/llvm/common/lldb/default.nix b/pkgs/development/compilers/llvm/common/lldb/default.nix index f67da5042667..ac4c4fbacd7f 100644 --- a/pkgs/development/compilers/llvm/common/lldb/default.nix +++ b/pkgs/development/compilers/llvm/common/lldb/default.nix @@ -70,7 +70,14 @@ stdenv.mkDerivation ( sourceRoot = "${finalAttrs.src.name}/lldb"; - patches = [ ./gnu-install-dirs.patch ]; + patches = [ + ./gnu-install-dirs.patch + ] + ++ lib.optional (lib.versions.major release_version == "18") [ + # Fix build with gcc15 + # https://github.com/llvm/llvm-project/commit/bb59f04e7e75dcbe39f1bf952304a157f0035314 + ./lldb-add-include-cstdint.patch + ]; nativeBuildInputs = [ cmake diff --git a/pkgs/development/compilers/llvm/common/lldb/lldb-add-include-cstdint.patch b/pkgs/development/compilers/llvm/common/lldb/lldb-add-include-cstdint.patch new file mode 100644 index 000000000000..2ca0b9a3eb38 --- /dev/null +++ b/pkgs/development/compilers/llvm/common/lldb/lldb-add-include-cstdint.patch @@ -0,0 +1,16 @@ +Rebase of upstream commit: +https://github.com/llvm/llvm-project/commit/bb59f04e7e75dcbe39f1bf952304a157f0035314 + +diff --git a/include/lldb/Utility/AddressableBits.h b/include/lldb/Utility/AddressableBits.h +index 0d27c3561ec27..8c7a1ec5f52c0 100644 +--- a/include/lldb/Utility/AddressableBits.h ++++ b/include/lldb/Utility/AddressableBits.h +@@ -12,6 +12,8 @@ + #include "lldb/lldb-forward.h" + ++#include ++ + namespace lldb_private { + + /// \class AddressableBits AddressableBits.h "lldb/Core/AddressableBits.h" +