[llvm] [bazel] Add llvm_zlib to system include path (PR #121374)

Angus Lees via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 30 22:11:41 PST 2024


https://github.com/anguslees created https://github.com/llvm/llvm-project/pull/121374

LLVM codebase expects to find zlib using (angle brackets) `<zlib.h>`.
This means llvm_zlib needs to be exposed on the system include path
(`-isystem` not `-iquote`).  Tell bazel to do that.

>From 1d6712a7009f72792d9b1ffc421db06376e5ab70 Mon Sep 17 00:00:00 2001
From: Angus Lees <gus at inodes.org>
Date: Tue, 31 Dec 2024 17:10:26 +1100
Subject: [PATCH] [bazel] Add llvm_zlib to system include path

LLVM codebase expects to find zlib using (angle brackets) `<zlib.h>`.
This means llvm_zlib needs to be exposed on the system include path
(`-isystem` not `-iquote`).  Tell bazel to do that.
---
 utils/bazel/third_party_build/zlib-ng.BUILD | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/utils/bazel/third_party_build/zlib-ng.BUILD b/utils/bazel/third_party_build/zlib-ng.BUILD
index 055261acb0f693..3a24c8ea8a9cb3 100644
--- a/utils/bazel/third_party_build/zlib-ng.BUILD
+++ b/utils/bazel/third_party_build/zlib-ng.BUILD
@@ -101,6 +101,10 @@ cc_library(
         ],
         "//conditions:default": [],
     }),
+    includes = select({
+        ":llvm_zlib_enabled": ["."],
+        "//conditions:default": [],
+    }),
     # Clang includes zlib with angled instead of quoted includes, so we need
     # strip_include_prefix here.
     strip_include_prefix = ".",



More information about the llvm-commits mailing list