-
Notifications
You must be signed in to change notification settings - Fork 22
Detect location of libclang library and headers and set include-dirs etc. #8
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
Conversation
|
|
||
| getRecursiveContents :: FilePath -> IO [FilePath] | ||
| getRecursiveContents dir = do | ||
| allNames <- getDirectoryContents dir `catch` (\e -> if isPermissionError e then return [] else throw e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getDirectoryContents also contains . and .., so this recurses forever. Also, this seems like a very expensive way to find libclang... I think it would be better to check the usual suspect locations (/usr/(local/)?lib/llvm-\d+(.\d+)*) and for other cases let the user set the environment variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code at line 60 filters out . and ... It's probably not the most efficient way to locate the libraries but it seems to work pretty well on the different Linux distros I tested against (Centos and Ubuntu) as well as on Windows and OS X without any special cases required. It also only impacts the initial configure step and, so, the overhead doesn't impact every invocation of stack build. It also has the advantage that I've already thoroughly tested it on two Linuxes, Windows and OS X!
…and extra-lib-dirs Also updates README with setup and build instructions for Linux, OS X and Windows platforms.
|
Hi Richard, For me it uses up all my memory and freezes my computer (see attached htop). :( I'm not very comfortable with enumerating every file in I'm glad to hear that you tested it widely, but could you tell me where |
|
Ah, I have a solution! The Here's how they do it with CMake: https://github.com/Andersbakken/rtags/blob/master/cmake/FindLibClang.cmake |
|
This works for me: 17b05bf What do you think? Does it work on Windows? |
|
Ouch! Sorry about freezing your computer! Here is a summary of the install locations for the libclang library and primary header Centos 7 (
Ubuntu 14.04 (
Windows (LLVM 3.8.1 installed using LLVM .exe installer)
Mac OS X (
I'll test your suggested fix and get back to you with more updates. I like the llvm-config approach with environment variable overrides. |
|
Hi Richard, I've merged the Thanks for your help! |

This adds setup-time auto-detection of libclang headers and libraries on Linux, Mac OS X and Windows. It also adds a new "development guide" with setup and build instructions.