unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#38276] Fix kernel-headers path in clang
@ 2019-11-19 16:19 Mathieu Othacehe
  2019-11-19 16:52 ` Carl Dong
  0 siblings, 1 reply; 4+ messages in thread
From: Mathieu Othacehe @ 2019-11-19 16:19 UTC (permalink / raw)
  To: 38276

[-- Attachment #1: Type: text/plain, Size: 406 bytes --]


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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-clang-from-llvm-Add-kernel-headers-to-default-in.patch --]
[-- Type: text/x-diff, Size: 1257 bytes --]

From 198e59f7645bffbc2ba1e68db2747b8c07997ad6 Mon Sep 17 00:00:00 2001
From: Mathieu Othacehe <m.othacehe@gmail.com>
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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-20 21:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-19 16:19 [bug#38276] Fix kernel-headers path in clang Mathieu Othacehe
2019-11-19 16:52 ` Carl Dong
2019-11-20 14:04   ` Mathieu Othacehe
2019-11-20 21:28     ` Carl Dong

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).