Skip to content

Build with system clang #13

Open
Open
@riemass

Description

@riemass

Currently only building within the LLVM project setup is possible. This is a tiresome process as LLVM builds for about 4 hours straight. I was able to build the tool using the system install of llvm/clang using the following compile flags:

clang++ reflect.cpp reflectedclass.cpp utils.cpp -I/usr/include/clang/Tooling/ -L/usr/lib/clang/9.0.0/lib/linux -lpthread -lclang -lclangAST -lclangASTMatchers -lclangTooling -lclangBasic -lclangFrontend -lclangSerialization -I/usr/include -std=c++11   -fno-exceptions -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -L/usr/lib -lLLVM-9

The llvm part of the output has been generated with the following command:

llvm-config --cxxflags --ldflags --ldflags 

This seems to be llvm's replacement for pkg-config.

However, the tool could not find any of the system headers. This is the output of a test run on a dummy file:

/usr/include/string.h:33:10: fatal error: 'stddef.h' file not found
#include <stddef.h>
a.out: ./classfinder.hpp:49: virtual void ClassFinder::onEndOfTranslationUnit(): Assertion `!ec && "error opening file"' failed.

I've tried using a compile_commands.json, and setting the paths manually using the --extra-arg switch, and both failed.
For this purpose, I should look into how other llvm/clang based tools, like ccls for example, have configured their CMakeLists.txt, as it can work with both, system library or the prepackaged release version of the library.

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