Error while running configure "Cannot locate libclang or headers"

Vipin Sharma vipinsharma85 at gmail.com
Thu Nov 19 21:05:46 UTC 2020


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.

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