[foreign] RFR: Copy and create necessary symlink for libclang

henry.jen at oracle.com henry.jen at oracle.com
Thu Nov 8 06:47:27 UTC 2018


Hi,

Please review a follow up webrev[1] for JDK-8213155, with Erik’s help(changes outside the Lib-jdk.internal.clang.gmk), this patch tries to establish symlinks as it is on the build system, where one of the symbolic link should cover the soname of libclang. The patch ensure that,

1) Copy the regular file for libclang.so into module jdk.internal.clang
2) Make symlinks with pattern 'libclang.so*’ as in the lib folder to the regular file

After the patch, the build/<CONF>/support/module_libs/jdk.internal.clang will have something like this,

> $ ls -l build/linux-x86_64-server-release/support/modules_libs/jdk.internal.clang
> total 21892
> -rw-r--r-- 1 hjen hjen 22225640 Nov  7 18:22 libclang-3.9.so.1
> lrwxrwxrwx 1 hjen hjen       17 Nov  7 18:22 libclang.so -> libclang-3.9.so.1
> lrwxrwxrwx 1 hjen hjen       17 Nov  7 18:22 libclang.so.1 -> libclang-3.9.so.1
> -rwxr-xr-x 1 hjen hjen   136552 Nov  7 18:22 libjclang.debuginfo
> -rwxr-xr-x 1 hjen hjen    45960 Nov  7 18:22 libjclang.so
> 

while before it had something like this,

> $ ls -l build/linux-x86_64-server-release/support/modules_libs/jdk.internal.clang
> total 184
> lrwxrwxrwx 1 hjen hjen     33 Nov  7 21:53 libclang.so -> /usr/lib/llvm-3.9/lib/libclang.so
> lrwxrwxrwx 1 hjen hjen     35 Nov  7 21:53 libclang.so.1 -> /usr/lib/llvm-3.9/lib/libclang.so.1
> -rwxr-xr-x 1 hjen hjen 136552 Nov  7 21:54 libjclang.debuginfo
> -rwxr-xr-x 1 hjen hjen  45960 Nov  7 21:54 libjclang.so

However, as jmod doesn’t support link and will actually follow all links, the resulting jmod archive actually will have multiple copies of the library in different names, that basically make this patch useless.  But now that we make the link “self-contained", hope is that someday jmod can support such scenario.

Anyhow, the patch make sure we do get the correct filename, the following example is what ldd actually find on Debian system before the patch. You can see the soname actually has version in it. Without this patch, the test is working is simply because that library is on the building system, but when deploy the jdk image to a clean system, the bundled version won’t work without the patch.

> $ ldd build/linux-x86_64-server-release/support/modules_libs/jdk.internal.clang/libjclang.so
>         linux-vdso.so.1 =>  (0x00007ffd5c5f8000)
>         libclang-3.9.so.1 => /usr/lib/x86_64-linux-gnu/libclang-3.9.so.1 (0x00007f9d1f829000)
>         libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9d1f45f000)
>         libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f9d1f25b000)
>         libLLVM-3.9.so.1 => /usr/lib/x86_64-linux-gnu/libLLVM-3.9.so.1 (0x00007f9d1c6a8000)
>         libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f9d1c326000)

This patch work with standard LLVM distribution as the necessary file and symlinks will be setup correctly.

Cheers,
Henry

[1] https://cr.openjdk.java.net/~henryjen/panama/libclang-symlinks/webrev/



More information about the panama-dev mailing list