axboe / liburing

Library providing helpers for the Linux kernel io_uring support
MIT License
2.83k stars 402 forks source link

undefined references in static library #1079

Closed 0ptyx closed 7 months ago

0ptyx commented 7 months ago

trying to use the static library v2.5 but i keep getting undefined references

example test.c

#include <liburing.h>
struct io_uring ring = {};
int main()
{
    io_uring_submit(&ring);
}

run gcc -l:liburing.a test.c

result

/usr/bin/ld: /tmp/ccClSH4v.o: in function `main':
test.c:(.text+0xf): undefined reference to `io_uring_submit'
collect2: error: ld returned 1 exit status
ammarfaizi2 commented 7 months ago

Your argument ordering is wrong, -l:liburing.a should be placed after test.c

Do this instead:

gcc test.c -l:liburing.a
0ptyx commented 7 months ago

wow. how did i miss that? thanks for taking the time to answer my silly issue.