How to link aio.o into an application
How to link async -io capability into a C program - for the sake of doing
async file/device i/o in user mode. uname -r returns 4.11.3LnxKrnl (NO modifications to general at src-level - just adding two drivers) lsb_release -a returns Dist..ID: Ubuntu; Desc...: Ubuntu 16.04.2 LTS; Release: 16.04 I am working w/ Eclipse 3.8.1 The following code compiles: #include <aio.h> ::: rc = aio_write(&aio_cb); rc = aio_read(&aio_cb); rc = aio_error(&aio_cb); rc = aio_return(&aio_cb); I do not need event-posting or a completion routine. I can wait for the results. I am exercising a new driver. The linker fails to find the above entry points (undefined reference(s) to 'aio_xxx'). When i add -o aio.o these four entry points are found but there is over 100 newer link errors. Many seem to be kernel/synchronization related (mutex, spin_lock_save_irql, kmap etc.) It is preferable to link in libaio - i think. I have executed sudo apt-get install libaio-dev. Repeating i get libaio-dev is already ..... (0.3.110-2) libaio.a is found in /usr/lib/i386-linux-gnu/libaio.a In Eclipse i have Linker Flags: -l libaio.a ; Library search path /usr/lib/i386-linux-gnu The same four entry point errors in the link persist. What might i be missing? Thanks in advance |
Quote:
Putting "how to use aio library in Linux" into Google yields a good bit: http://man7.org/linux/man-pages/man7/aio.7.html https://www.ibm.com/developerworks/l...ync/index.html https://github.com/littledan/linux-aio |
Do not edit your posts; your first post was quoted in its entirety, in my reply (post #2). Doing such things makes it much harder for anyone to read/follow the thread.
Are you sure the aio.h file is in a path where your compiler can find it? Did you try to specify a path to the file? |
Quote:
|
How to link async -io capability into a C program
I have solved the problem.
First let me be clear that i was able to compile the source code above w/ aio_xyz functions. I was not able to link-edit. It turns out that Eclipse was not honoring my linker flag(s). It was necessary to run from the command line. It was also necessary to set -laio last on the command line for the cc... command, as was suggested by someone on Stackoverflow or somewhere similar. A friend is suggesting SlickEdit as an IDE instead of Eclipse. ($$$) I am relatively happy w/ Link+ for driver dev which runs on top of Eclipse. Thanks and onward ... |
All times are GMT -5. The time now is 06:40 PM. |