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

checking environment variable to find libclang #336

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

little-big-h
Copy link

No description provided.

@Sarcasm
Copy link
Owner

Sarcasm commented Sep 30, 2016

Where is the LLVM_ROOT environment variable used? I can't find a real reference to it in the LLVM source code.

@little-big-h
Copy link
Author

I don't know that it is used in LLVM but it seems a (loose) convention in cmake modules. Boost uses BOOST_ROOT, GTest uses GTEST_ROOT, dart uses DART_ROOT, ...

@Sarcasm
Copy link
Owner

Sarcasm commented Sep 30, 2016

For now I prefer to recommend using -DLIBCLANG_LIBRARY=<path> and -DLIBCLANG_INCLUDE_DIR=<path>.

Ideally at some point we would have one variable to locate the LLVM root in one place but this variable would be the llvm-config executable path.

@little-big-h
Copy link
Author

ideally, you would use the cmake files that come with llvm

@Sarcasm
Copy link
Owner

Sarcasm commented Sep 30, 2016

that's right ;)

@greyblue9
Copy link
Contributor

Oddly, even using

   -DCLANG_INSTALL_PREFIX=/usr/lib/llvm-3.8
   -DLibclang_LIBRARY=/usr/lib/llvm-3.8/lib/libclang-3.8.so.1
   -DLibclang_INCLUDE_DIR=/usr/lib/llvm-3.8/include

as mentioned above to force the use of LLVM/Clang 3.8, it still somehow ended up using LLVM 8 (with -I/usr/lib/llvm-8/include being the telltale sign) until I physically broke the LLVM8 install by renaming the directory with a trailing underscore, then it used my preferred version.

Trying the suggested patch now.

Any idea why this woulldn't work? I also had LLVM_ROOT set in my environment at the time (something I always do when configuring CMake projects).

@Sarcasm
Copy link
Owner

Sarcasm commented Mar 21, 2021

Why prefer LLVM 3.8 to LLVM 8?
LLVM 8 is more recent, more featureful.
If you set -DLibclang_INCLUDE_DIR=/usr/lib/llvm-3.8/include explicitly, it's weird though, it should be the one that get picked up, disabling auto-detection.

@greyblue9
Copy link
Contributor

greyblue9 commented Apr 12, 2021

Why prefer LLVM 3.8 to LLVM 8?

Only because I mistakenly thought that was the recommended version and didn't want two LLVM's taking up space. :)
It's working now though, thank you!

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

Successfully merging this pull request may close these issues.

3 participants