LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-03-2017, 04:59 PM   #1
htfones
LQ Newbie
 
Registered: Oct 2017
Distribution: ubuntu
Posts: 9

Rep: Reputation: Disabled
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

Last edited by htfones; 10-04-2017 at 12:38 PM. Reason: improvement to original Q.
 
Old 10-04-2017, 06:26 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,112

Rep: Reputation: 7837Reputation: 7837Reputation: 7837Reputation: 7837Reputation: 7837Reputation: 7837Reputation: 7837Reputation: 7837Reputation: 7837Reputation: 7837Reputation: 7837
Quote:
Originally Posted by htfones View Post
How to link aio.o into an application - for the sake of doing async file/device i/o in user mode
You're missing a LOT of details that would let us even guess an answer to your question. Version/distro of Linux? What code you have now? What got you to asking about aio in the first place, etc. Read the "Question Guidelines" link in my posting signature.

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
 
1 members found this post helpful.
Old 10-06-2017, 07:48 AM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,112

Rep: Reputation: 7837Reputation: 7837Reputation: 7837Reputation: 7837Reputation: 7837Reputation: 7837Reputation: 7837Reputation: 7837Reputation: 7837Reputation: 7837Reputation: 7837
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?
 
Old 10-07-2017, 06:30 AM   #4
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan with some Tiny Core, Fatdog, Haiku, & BSD thrown in.
Posts: 5,155

Rep: Reputation: Disabled
Quote:
The linker fails to find the above entry points (undefined reference(s) to 'aio_xxx').
Looks like you need to check out your source code.
 
Old 10-07-2017, 09:52 AM   #5
htfones
LQ Newbie
 
Registered: Oct 2017
Distribution: ubuntu
Posts: 9

Original Poster
Rep: Reputation: Disabled
Smile 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 ...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i link link a c application using glib 2.0 amolgupta Programming 5 03-29-2009 09:27 PM
LXer: Boost Application Performance Using AIO LXer Syndicated Linux News 0 08-31-2006 06:03 PM
'link to application' bombs beauty34 Linux - Newbie 2 01-08-2006 12:12 PM
how to link helpblocks application to gtk application m.harshavardhan Linux - Software 0 08-16-2005 08:39 AM
Link to application breany Linux - Software 6 08-21-2002 09:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration