Unexpected exception org.openjdk.jextract.clang.TypeLayoutError: InvalidFieldName when running on combaseapi.h

Jorn Vernee jorn.vernee at oracle.com
Thu Mar 28 13:19:58 UTC 2024


Hey Michael,

It looks like you're building jextract yourself using a newer version of 
LLVM than 13. Newer versions change the way anonymous structs are named, 
which causes some issues for jextract. LLVM 13.0.0 is the version we use 
internally as well, so that version should work.

Alternatively, you could download jextract from 
https://jdk.java.net/jextract/ That version also supports Java 22.

Jorn

On 28/03/2024 02:13, Michael Ennen wrote:
> Hi,
>
> I am trying to run jextract thusly:
>
> $env:JAVA_HOME = "C:\Program Files\Java\jdk-17"
> $jdk = "C:\Program Files\Java\jdk-22"
> $libclang = "C:\Program Files\Microsoft Visual 
> Studio\2022\Community\VC\Tools\Llvm\x64"
> $I = "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0"
> $jextractDir = ".\target\jextract"
> if (-Not (Test-Path $jextractDir)) {
>     git clone https://github.com/openjdk/jextract $jextractDir
> }
> cd $jextractDir
> # $env:JAVA_HOME = $jdk
> ./gradlew.bat -Pjdk22_home="$jdk" -Pllvm_home="$libclang" verify
> cd ../..
> New-Alias -Name jextract -Value 
> "$jextractDir\build\jextract\bin\jextract.bat" -Force
> jextract --output target\classes --target-package com.brcolow.winapi 
> -D "WIN32_LEAN_AND_MEAN=1" -D "_AMD64_=1" --include-function 
> CLSIDFromString "$I\um\combaseapi.h"
>
> This is on Windows 11.
>
> I get the following error from jextract:
>
> FATAL: Unexpected exception 
> org.openjdk.jextract.clang.TypeLayoutError: InvalidFieldName. segment: 
> org.openjdk.jextract.clang.Type at e637624f, fieldName: struct (anonymous 
> at C:\Program Files (x86)\Windows 
> Kits\10\Include\10.0.22621.0\um\winnt.h:6563:21) occurred
>
> Any help would be greatly appreciated.
>
> Thank you.
>
> -- 
> Michael Ennen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/jextract-dev/attachments/20240328/41e38786/attachment.htm>


More information about the jextract-dev mailing list