Error while running configure "Cannot locate libclang or headers"
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Fri Nov 20 11:52:47 UTC 2020
On 19/11/2020 21:51, Vipin Sharma wrote:
> dir: /home/vipin/Downloads/clang+llvm-9.0.0-x86_64-pc-linux-gnu
> libexec
> include
> share
> lib
> bin
This looks totally ok.
Just one more test: can you run `clang` from there? Or do you get errors
pointing at missing dependencies?
This is really odd. I have basically the same setup (except for newer
Ubuntu), I have built clang sources from scratch, then pointed the JDK
build to the LLVM build folder and it all worked out.
If all else fail, it would be nice to try and do what autoconf is trying
to do, which is to compile a small program against libclang
include/library and see if that works correctly. Something like:
```
$ cat testClang.c
#include "clang-c/Index.h"
int main(void) {
clang_getClangVersion();
return 0;
}
```
Then try to compile it using gcc, and supply the "-I" (capital i) option
to point at the LLVM include folder, "-L" to point at LLVM lib folder,
and then "-l clang" (lower case "L") to set linker dependency on libclang.
E.g - in my system:
```
gcc -I/opt/clang/llvm-10/include -L/opt/clang/llvm-10/lib testClang.c
-lclang
```
If you get compilation errors, or linker errors, then there's something
up with the environment. AFAIK, autoconf does something like that to
"check that libclang is really there".
Maurizio
More information about the panama-dev
mailing list