RFR: [panama foreign] Build tweak to enable build on Windows
Samuel Audet
samuel.audet at gmail.com
Sun Oct 28 01:48:29 UTC 2018
Building LLVM and Clang as DLLs on Windows is tricky as they are not
maintaining the build system for this use case. For reference, here's a
build script that works:
https://github.com/bytedeco/javacpp-presets/blob/master/llvm/cppbuild.sh
Samuel
On 10/28/2018 02:53 AM, Jorn Vernee wrote:
> Hi Henry,
>
> I'm testing out this patch and can confirm jextract.exe is being built,
> but I can't use it to extract a header file.
>
> I'm getting an UnsatisfiedLinkError when loading jclang.dll:
>
> ```
> PS J:\WS\JNI test\C> jextract Main.h
> Exception in thread "main" java.lang.UnsatisfiedLinkError:
> J:\cygwin64\home\Jorn\cygwin-projects\panama\build\windows-x8
> 6_64-server-release\images\jdk\bin\jclang.dll: %1 is not a valid Win32
> application
> at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native
> Method)
> at
> java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2462)
> at
> java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2534)
>
> at
> java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2744)
> at
> java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2690)
> at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:851)
> at java.base/java.lang.System.loadLibrary(System.java:1903)
> at
> jdk.internal.clang/jdk.internal.clang.LibClang.<clinit>(LibClang.java:35)
> at
> jdk.jextract/com.sun.tools.jextract.parser.Parser.parse(Parser.java:74)
> at
> jdk.jextract/com.sun.tools.jextract.Context.parse(Context.java:411)
> at
> jdk.jextract/com.sun.tools.jextract.Context.parse(Context.java:387)
> at jdk.jextract/com.sun.tools.jextract.Main.run(Main.java:251)
> at jdk.jextract/com.sun.tools.jextract.Main.main(Main.java:316)
> ```
>
> When inspecting jclang.dll with 'dependency walker' (a DLL inspection
> tool [1]) it's giving an error about libclang.dll (a dependency of
> jclang.dll), which tells me "No DOS or PE signature found. This file is
> not a valid 32-bit or 64-bit Windows module.". However, when I open the
> original libclang.dll file from my LLVM installation it _is_ being
> recognized as a valid DLL.
>
> I think something is going wrong when copying libclang.dll over? I have
> tried manually copying over the libclang.dll file to the jclang and
> jdk/bin folders, which allows me to extract a header file using that
> command line, but when re-running the build the DLL is being overwritten
> again with the corrupted/invalid version.
>
> Cheers,
> Jorn
>
> [1] : http://www.dependencywalker.com/
>
> Henry Jen schreef op 2018-10-26 06:44:
>> Hi,
>>
>> Please review a web rev[1] that address following,
>>
>> 1. Copy the essential share library as recorded by the linker
>> following the symbolic link of libclang.so for unix/mac. This leads to
>> only one copy of share library instead of a duplicate copy of
>> libclang.so. It would be nice to have create libclang as a symbolic
>> link, but it’s not needed now.
>>
>> This issue is what failed the build when using system provided
>> libclang on some systems such as Debian-based Linux distribution.
>> After this patch, Debian-based system can be build as described in
>> README.foreign.
>>
>> 2. Enable build on Windows. This patch allow build image to be
>> completed successfully and libclang.dll copied to bin as expected.
>>
>> However, this doesn’t mean binder is working on Windows, it’s simply
>> get the build going and jextract should be functional. Some test still
>> have compiling errors to be fixed, and we don’t have Windows ABI. It’s
>> the first step to allow build on Windows.
>>
>> I believe a lot of this had been addressed by Jorn, and he actually
>> have made more progress on Windows support. Hopefully this is just the
>> first step and get Windows going.
>>
>> Cheers,
>> Henry
>>
>> [1] http://cr.openjdk.java.net/~henryjen/panama/build-windows/webrev
More information about the panama-dev
mailing list