OSX in6_addr no longer generates compilable code after commit aa5f250
Alison Gravley
alison.m.gravley at gmail.com
Wed Jul 17 15:09:04 UTC 2024
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.
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.
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:
```
#include <signal.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/tcp.h>
#include <netinet/in.h>
#include <netdb.h>
```
Back in January, the generated in6_addr.java looked like this:
```
import java.lang.invoke.MethodHandle;
import java.lang.invoke.VarHandle;
import java.nio.ByteOrder;
import java.lang.foreign.*;
import static java.lang.foreign.ValueLayout.*;
/**
* {@snippet :
* struct in6_addr {
* union __u6_addr;
* };
* }
*/
public class in6_addr {
public static MemoryLayout $LAYOUT() {
return constants$41.const$0;
}
/**
* {@snippet :
* union {
* unsigned char __u6_addr8[16];
* unsigned short __u6_addr16[8];
* unsigned int __u6_addr32[4];
* };
* }
*/
public static final class __u6_addr {
// Suppresses default constructor, ensuring non-instantiability.
private __u6_addr() {}
public static MemoryLayout $LAYOUT() {
return constants$41.const$1;
}
public static MemorySegment __u6_addr8$slice(MemorySegment seg) {
return seg.asSlice(0, 16);
}
public static MemorySegment __u6_addr16$slice(MemorySegment seg) {
return seg.asSlice(0, 16);
}
public static MemorySegment __u6_addr32$slice(MemorySegment seg) {
return seg.asSlice(0, 16);
}
public static long sizeof() { return $LAYOUT().byteSize(); }
public static MemorySegment allocate(SegmentAllocator allocator) {
return allocator.allocate($LAYOUT()); }
public static MemorySegment allocateArray(long len,
SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(len,
$LAYOUT()));
}
public static MemorySegment ofAddress(MemorySegment addr, Arena
scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); }
}
public static MemorySegment __u6_addr$slice(MemorySegment seg) {
return seg.asSlice(0, 16);
}
public static long sizeof() { return $LAYOUT().byteSize(); }
public static MemorySegment allocate(SegmentAllocator allocator) {
return allocator.allocate($LAYOUT()); }
public static MemorySegment allocateArray(long len, SegmentAllocator
allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(len,
$LAYOUT()));
}
public static MemorySegment ofAddress(MemorySegment addr, Arena scope)
{ return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); }
}
```
Now I get lines like this in the generated java. I attached the full
version:
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
in6_addr.union (unnamed at /Library/Developer/CommandLineTools/SDKs/
MacOSX14.sdk/usr/include/netinet6/in6.h:153:2).layout()
.withName("__u6_addr")
).withName("in6_addr");
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/jextract-dev/attachments/20240717/1ecf3b21/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: in6_addr.java
Type: application/octet-stream
Size: 14452 bytes
Desc: not available
URL: <https://mail.openjdk.org/pipermail/jextract-dev/attachments/20240717/1ecf3b21/in6_addr-0001.java>
More information about the jextract-dev
mailing list