Error while running configure "Cannot locate libclang or headers"

Jorn Vernee jorn.vernee at oracle.com
Fri Nov 20 14:33:38 UTC 2020


Hi,

AFAIK if you're building from sources you need to use the cmake install 
target for it to produce a "package" that you can use I think some 
headers might otherwise be missing.

     cmake --build <build dir> --target install

That will install at whatever CMAKE_INSTALL_PREFIX is set to (recommend 
setting this explicitly, instead of using the default). You can point 
the jdk build at that afterwards package.

That said, using a binary distribution might be easier, since it should 
already have the right directory structure.

HTH,
Jorn

On 20/11/2020 12:52, Maurizio Cimadamore wrote:
>
> 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