<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>Jextract binaries are published at [1]. Those target the Java 22
FFM API.</p>
<p>If you're on x64 mac, I believe the LLVM
'clang+llvm-13.0.1-x86_64-apple-darwin.tar.xz' package on the page
you linked to should work.<br>
<br>
> I still have to manually change the gradle version each time
due to Java 21, and then later Java 22.<br>
<br>
The current Gradle version should work if you run gradle with Java
17 on the PATH, and in JAVA_HOME. The JDK with which jextract is
built is picked up through the `jdk22_home` project property
instead.<br>
</p>
<p>Jorn</p>
<p>[1]: <a class="moz-txt-link-freetext" href="https://jdk.java.net/jextract/">https://jdk.java.net/jextract/</a></p>
<p></p>
<div class="moz-cite-prefix">On 17-7-2024 18:09, Alison Gravley
wrote:<br>
</div>
<blockquote type="cite" cite="mid:CADo9z7JmndGvSNCSP_ecy5hF4B=KdfRgcR-Aqe=mUhmEWzmmAw@mail.gmail.com">
<div dir="ltr">Yes, as I had no idea there were binaries anywhere.
At least not on github or for darwin. I have been using this
LLVM version from homebrew as everything had been "working" up
until the change in January. I vaguely remember having a really
hard time getting jextract to compile until I used the one from
homebrew, but that was way back in October. I still have to
manually change the gradle version each time due to Java 21, and
then later Java 22.<br>
<br>
I am pretty sure the version updated recently when I ran some
updates, but I was running some version of 17 originally.
<div><br>
Homebrew clang version 18.1.8<br>
Target: arm64-apple-darwin23.5.0<br>
Thread model: posix<br>
InstalledDir: /opt/homebrew/opt/llvm/bin<br>
<br>
I can try the binary from here and try to get jextract to
compile again, but this may take me some time if I run into
compiler issues.<br>
<a href="https://urldefense.com/v3/__https://github.com/llvm/llvm-project/releases/tag/llvmorg-13.0.1__;!!ACWV5N9M2RV99hQ!PdZ4MZW1ADX6bdrgUuuqhCitifDvKcOwwMF80rjeU8QELXpCh2Oyigjyoe1LXT84Ml1aPTGD-suJe1_a8jFW5q90Egr8$" moz-do-not-send="true">https://github.com/llvm/llvm-project/releases/tag/llvmorg-13.0.1</a></div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Wed, Jul 17, 2024 at
11:15 AM Jorn Vernee <<a href="mailto:jorn.vernee@oracle.com" moz-do-not-send="true" class="moz-txt-link-freetext">jorn.vernee@oracle.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<p>Hey,</p>
<p>Are you building jextract yourself? Note that only LLVM
version 13 works, as the naming of unnamed structs and
unions in later versions leads to these weird struct
names.</p>
<p>See also: <a href="https://bugs.openjdk.org/browse/CODETOOLS-7903480" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">https://bugs.openjdk.org/browse/CODETOOLS-7903480</a><br>
</p>
<p>Jorn<br>
</p>
<div>On 17-7-2024 17:09, Alison Gravley wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">I meant to send this months ago, but after
commit aa5f25003554dffa18289f1be535ea23f75c29c3, which
is from January 18, 2024, I can no longer use this tool
on OSX (Arm) as the generated wrapper for in6 is invalid
and cannot compile. I think the commit after this one is
where the "--source" flag was removed.
<div><br>
</div>
<div><font face="arial, sans-serif">Basically, there are
"unnamed at
/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/netinet6/in6.h:153:2"
within the generated java that does not allow it to
compile.<br>
</font>
<div><br>
</div>
<div>I am not able to share the 3rd party library that
I am using jextract on due to licensing, but in.h is
from the OS. I am assuming this is being generated
due to the library including these:</div>
<div><br>
</div>
<div>```</div>
<div><font face="monospace">#include <signal.h><br>
#include <sys/socket.h><br>
#include <arpa/inet.h><br>
#include <netinet/tcp.h><br>
#include <netinet/in.h><br>
#include <netdb.h></font><br>
</div>
<div>```</div>
<div><br>
</div>
<div>
<div>Back in January, the generated in6_addr.java
looked like this:</div>
<div><br>
<font face="monospace">```</font></div>
<div><font face="monospace">import
java.lang.invoke.MethodHandle;<br>
import java.lang.invoke.VarHandle;<br>
import java.nio.ByteOrder;<br>
import java.lang.foreign.*;<br>
import static java.lang.foreign.ValueLayout.*;<br>
/**<br>
* {@snippet :<br>
* struct in6_addr {<br>
* union __u6_addr;<br>
* };<br>
* }<br>
*/<br>
public class in6_addr {<br>
<br>
public static MemoryLayout $LAYOUT() {<br>
return constants$41.const$0;<br>
}<br>
/**<br>
* {@snippet :<br>
* union {<br>
* unsigned char __u6_addr8[16];<br>
* unsigned short __u6_addr16[8];<br>
* unsigned int __u6_addr32[4];<br>
* };<br>
* }<br>
*/<br>
public static final class __u6_addr {<br>
<br>
// Suppresses default constructor,
ensuring non-instantiability.<br>
private __u6_addr() {}<br>
public static MemoryLayout $LAYOUT() {<br>
return constants$41.const$1;<br>
}<br>
public static MemorySegment
__u6_addr8$slice(MemorySegment seg) {<br>
return seg.asSlice(0, 16);<br>
}<br>
public static MemorySegment
__u6_addr16$slice(MemorySegment seg) {<br>
return seg.asSlice(0, 16);<br>
}<br>
public static MemorySegment
__u6_addr32$slice(MemorySegment seg) {<br>
return seg.asSlice(0, 16);<br>
}<br>
public static long sizeof() { return
$LAYOUT().byteSize(); }<br>
public static MemorySegment
allocate(SegmentAllocator allocator) { return
allocator.allocate($LAYOUT()); }<br>
public static MemorySegment
allocateArray(long len, SegmentAllocator
allocator) {<br>
return
allocator.allocate(MemoryLayout.sequenceLayout(len,
$LAYOUT()));<br>
}<br>
public static MemorySegment
ofAddress(MemorySegment addr, Arena scope) {
return RuntimeHelper.asArray(addr, $LAYOUT(), 1,
scope); }<br>
}<br>
<br>
public static MemorySegment
__u6_addr$slice(MemorySegment seg) {<br>
return seg.asSlice(0, 16);<br>
}<br>
public static long sizeof() { return
$LAYOUT().byteSize(); }<br>
public static MemorySegment
allocate(SegmentAllocator allocator) { return
allocator.allocate($LAYOUT()); }<br>
public static MemorySegment
allocateArray(long len, SegmentAllocator
allocator) {<br>
return
allocator.allocate(MemoryLayout.sequenceLayout(len,
$LAYOUT()));<br>
}<br>
public static MemorySegment
ofAddress(MemorySegment addr, Arena scope) {
return RuntimeHelper.asArray(addr, $LAYOUT(), 1,
scope); }<br>
}</font><br>
</div>
<div>```</div>
</div>
<div><br>
</div>
<div>Now I get lines like this in the generated java.
I attached the full version:</div>
<div><span style="font-family:monospace">private
static final GroupLayout $LAYOUT =
MemoryLayout.structLayout(</span><br style="font-family:monospace">
<span style="font-family:monospace">
in6_addr.union (unnamed at /Library/Developer/</span><span style="font-family:monospace">CommandLineTools/SDKs/</span><span style="font-family:monospace">MacOSX14.sdk/usr/include/</span><span style="font-family:monospace">netinet6/in6.h:153:2).layout()</span><span style="font-family:monospace">.withName("__u6_addr")</span><br style="font-family:monospace">
<span style="font-family:monospace">
).withName("in6_addr");</span><br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
</div>
</blockquote>
</div>
</blockquote>
</div>
</blockquote>
</body>
</html>