Getting "UnsatisfiedLinkError" in io_uring for methods that were defined as "static inline" in the header

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Wed Sep 21 21:12:58 UTC 2022


Hi Gavin,
thanks for the question - actually this might trip up others as well, so 
it's always good to ask here.

I believe this has been fixed recently:

https://github.com/openjdk/jextract/pull/70

But the binary snapshots do not contain this fix.

In general inline functions (and function-like macros) are not true 
library symbols, so there's not much the Linker can do for them.

If you need to access these, you would need a native library wrapper 
which exposes them as regular symbols.

(we'd like, at some point, to automate the wrapper generation in jextract).

Maurizio

On 21/09/2022 20:35, Gavin Ray wrote:
> I'm not super familiar with how linking and symbols work
>
> The liburing header is weird, it contains a mix of definitions:
> https://github.com/axboe/liburing/blob/master/src/include/liburing.h
>
> Some of them are traditional header defs, like:
>
>     int io_uring_queue_init(unsigned entries, struct io_uring *ring,
>     unsigned flags);
>
> But there are a lot of them which are defined like this:
>
>
>     static inline int io_uring_wait_cqe(struct io_uring *ring, struct
>     io_uring_cqe **cqe_ptr)
>
> Using "objdump" on the ".so", I can see that none of these "static 
> inline" functions appear
>
> I have an almost-working test of using io_uring purely through Panama 
> here, but it fails due to the above:
> https://github.com/GavinRay97/panama-liburing/blob/82f83a247bb78c26d787992fca28ea1b951dfd3c/lib/src/test/java/panama/liburing/LibraryTest.java#L25-L59
>
> How are you meant to be able to use these from the Foreign Memory API?
> Do I need to write a second library and built it, that re-exports these?
>
> Thanks, and sorry for so many newbie questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20220921/651dbdd4/attachment.htm>


More information about the panama-dev mailing list