Error while running configure "Cannot locate libclang or headers"
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Thu Nov 19 21:15:37 UTC 2020
On 19/11/2020 21:05, Vipin Sharma wrote:
> Hi,
>
> I am trying to set up https://github.com/openjdk/panama-foreign (default
> branch foreign-jextract) on my machine, os is Ubuntu 19.10.
>
> Getting below error while running configure:
>
> checking for clang-c/Index.h... yes
> configure: error: Cannot locate libclang or headers at the specified
> locations:
> /home/vipin/Softwares/llvm-project/build/lib
> /home/vipin/Softwares/llvm-project/build/include
> configure exiting with result code 1
>
> configure command is:
> bash configure --with-boot-jdk=/home/vipin/Downloads/jdk-15/
> --with-libclang=/home/vipin/Softwares/llvm-project/build
>
>
> configure and build both works after the below hack, here I have commented
> call to clang_getClangVersion.
Before we look at solutions, I think we need more info.
Are you cross compiling? Or is this just plain Ubuntu 19.10 install? I
regularly work with 20.04 - and I used to work with Ubuntu 18.04 with no
issues.
If it's a plain Ubuntu install, can you please list the contents of the
folder "/home/vipin/Softwares/llvm-project/build" ? More specifically:
* do you have a lib/libclang.so in there?
* do you have a lib/clang/<version>/include in there?
Note that the hack below completely disables the autoconf checks - which
might necessary when cross compiling, but should not be needed when the
library is currently installed and functioning on the system used to build.
Maurizio
>
> diff --git a/make/autoconf/lib-clang.m4 b/make/autoconf/lib-clang.m4
> index 40f86bf8c38..1a35fd5fdf2 100644
> --- a/make/autoconf/lib-clang.m4
> +++ b/make/autoconf/lib-clang.m4
> @@ -148,7 +148,8 @@ AC_DEFUN_ONCE([LIB_SETUP_LIBCLANG],
> # Just trust the lib is there
> LIBS=$LIBCLANG_LIBS
> else
> - AC_CHECK_LIB(clang, clang_getClangVersion, [],
> [ENABLE_LIBCLANG="false"])
> + # AC_CHECK_LIB(clang, clang_getClangVersion, [],
> [ENABLE_LIBCLANG="false"])
> + AC_MSG_NOTICE('Dummy message')
> fi
> fi
>
> Due to the below variables in lib-clang.m4 control goes to the else part
> where we call clang_getClangVersion.
> TOOLCHAIN_TYPE: gcc
> COMPILE_TYPE: native
>
> A similar error was reported at
> https://mail.openjdk.java.net/pipermail/panama-dev/2019-May/005638.html
> From this old discussion, it seems the fix was to add *or condition
> "x$COMPILE_TYPE" = "xcross"*
> Being new to this it is not clear to me why in the case of cross
> compilation we just want to trust clang library is there and no need to
> call clang_getClangVersion.
>
> To fix this problem, in this case, do we need to add one more or
> condition *"x$COMPILE_TYPE"
> = "xnative"?* or there is something else wrong in my setup.
>
> In case it needs to be fixed I can create a bug id against this.
>
> Thanks,
> Vipin
More information about the panama-dev
mailing list