Skip to content

Ship clang's header files #678

@rolfbjarne

Description

@rolfbjarne

clang ships with its own set of headers, which are tied to the exact version of clang in question.

This set of headers is automatically included by clang, which can be seen by executing clang:

$ ~/Downloads/LLVM-21.1.8-macOS-ARM64/bin/clang -v ~/test/test.c -fsyntax-only
[...]
"/Users/rolf/Downloads/LLVM-21.1.8-macOS-ARM64/bin/clang-21" ... -resource-dir /Users/rolf/Downloads/LLVM-21.1.8-macOS-ARM64/lib/clang/21 ...
[...]
#include <...> search starts here:
 /Users/rolf/Downloads/LLVM-21.1.8-macOS-ARM64/lib/clang/21/include
[...]

in other words: the argument -resource-dir ... is passed to the internal clang, and this implicitly adds ".../include" to the list of include search directories.

Typically these headers aren't required, but when they are (which happens when parsing the system frameworks provided with Xcode), any consumers of ClangSharp will need these headers, and they have to match the version of clang being used: llvm/llvm-project#158312 (comment)

We're building a command-line tool based on ClangSharp, and this means we'll have to ship these header files, which is somewhat inconvenient, and I think it would make more sense to include them in the libclang NuGets, since they're so tied to the exact libclang version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions