Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build with system clang #13

Open
riemass opened this issue Oct 29, 2019 · 0 comments
Open

Build with system clang #13

riemass opened this issue Oct 29, 2019 · 0 comments

Comments

@riemass
Copy link
Contributor

riemass commented Oct 29, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant