guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#38276] Fix kernel-headers path in clang


From: Mathieu Othacehe
Subject: [bug#38276] Fix kernel-headers path in clang
Date: Tue, 19 Nov 2019 17:19:01 +0100
User-agent: mu4e 1.2.0; emacs 26.3

Hello,

Indexing tools such as ccls use "clang" package (and more specifically
the libclang library it provides) to analyse code.

In that use case, clang cannot find kernel headers path. This is because
it is normally set as propagated inputs of gcc-toolchain and clang-toolchain, an
thus available via CPATH.

This patch proposes to hardcode kernel headers path into clang.

What do you think?

Mathieu
>From 198e59f7645bffbc2ba1e68db2747b8c07997ad6 Mon Sep 17 00:00:00 2001
From: Mathieu Othacehe <address@hidden>
Date: Tue, 19 Nov 2019 16:41:33 +0100
Subject: [PATCH] gnu: clang-from-llvm: Add kernel-headers to default include
 directories.

Stand-alone "clang" binary is not able to find kernel headers because they are
normally set as propagated inputs of gcc-toolchain and clang-toolchain, an
thus available via CPATH.

As some code indexers rely on libclang, kernel-headers include path needs to
be hard-coded.

* gnu/packages/llvm.scm (clang-from-llvm):
---
 gnu/packages/llvm.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 863d43d7d6..c5bc1e2c5c 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -195,6 +195,8 @@ compiler.  In LLVM this library is called \"compiler-rt\".")
              ;; Use a sane default include directory.
              (string-append "-DC_INCLUDE_DIRS="
                             (assoc-ref %build-inputs "libc")
+                            "/include:"
+                            (assoc-ref %build-inputs "kernel-headers")
                             "/include"))
 
        ;; Don't use '-g' during the build to save space.
-- 
2.24.0


reply via email to

[Prev in Thread] Current Thread [Next in Thread]