69

I have a simple test program that when I run I get:

./hello: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory

I link it like this:

$(CC) $(CCFLAGS) -o hello hello.o -L../ocilib-3.9.3/src/.libs -L../instantclient_11_2 -locilib

My LD_LIBRARY_PATH contains this:

LD_LIBRARY_PATH=../ocilib-3.9.3/src/.libs:../instantclient_11_2:/usr/lib

/usr/lib looks like this:

Linux$ ls -l /usr/lib/libaio*
lrwxrwxrwx  1 root root   15 Nov  5  2008 /usr/lib/libaio.so.1 -> libaio.so.1.0.1
-rwxr-xr-x  1 root root 2632 Sep 16  2005 /usr/lib/libaio.so.1.0.0
-rwxr-xr-x  1 root root 2628 Sep 16  2005 /usr/lib/libaio.so.1.0.1

Output of ldd hello:

libocilib.so.3 => ../ocilib-3.9.3/src/.libs/libocilib.so.3 (0x0000002a95558000)
libc.so.6 => /lib64/tls/libc.so.6 (0x0000003811200000)
libclntsh.so.11.1 => ../instantclient_11_2/libclntsh.so.11.1 (0x0000002a956c4000)
/lib64/ld-linux-x86-64.so.2 (0x000000552aaaa000)
libnnz11.so => ../instantclient_11_2/libnnz11.so (0x0000002a97f56000)
libdl.so.2 => /lib64/libdl.so.2 (0x0000003811500000)
libm.so.6 => /lib64/tls/libm.so.6 (0x0000003811700000)
libpthread.so.0 => /lib64/tls/libpthread.so.0 (0x0000003811b00000)
libnsl.so.1 => /lib64/libnsl.so.1 (0x0000003819000000)
libaio.so.1 => not found

I'm hoping that I'm missing something simple here. The oracle instantclient package appears to require libaio, but that seems to be installed already so what's the problem?

2
  • 1
    Post the output of $ ldd hello. Commented May 16, 2012 at 13:17
  • It looks like you need a 64-bit version of the library which you do not have. Commented May 16, 2012 at 13:38

12 Answers 12

165

Install the packages:

sudo apt-get install libaio1 libaio-dev

or

sudo yum install libaio
Sign up to request clarification or add additional context in comments.

2 Comments

Can also do "sudo apt search libaio" to search for items <== Note "apt" not "apt-get"
This answer is worth a lot of money.
53

It looks like a 32/64 bit mismatch. The ldd output shows that mainly libraries from /lib64 are chosen. That would indicate that you have installed a 64 bit version of the Oracle client and have created a 64 bit executable. But libaio.so is probably a 32 bit library and cannot be used for your application.

So you either need a 64 bit version of libaio or you create a 32 bit version of your application.

3 Comments

On my 64 bit Ubuntu 12.04 system, I had the 32-bit version of this library installed. Probably I had it because it was a dependency of some other 32 bit software. Simply running "apt-get install libaio1" would pull in the 64 bit version as well.
@amarillion - I can confirm that "apt-get install libaio1" fixed the problem on 64-bit Ubuntu 12.04. Thanks.
I can confirm apt install libaio1 solves it on ubuntu 18.04.
12

The package and the library have been renamed in 24.04. The package name now is libaio1t64 and the library is available as libaio.so.1t64, see this answer on askUbuntu.

But other libraries, like oracleinstanceclient etc. are still expecting libaio.so.1. Creating the following symbolic link resolves the issue:

sudo ln -s /usr/lib/x86_64-linux-gnu/libaio.so.1t64 /usr/lib/x86_64-linux-gnu/libaio.so.1

Comments

10

In case one does not have sudo privilege, but still needs to install the library.

Download source for the software/library using:

apt-get source libaio

or

wget https://src.fedoraproject.org/lookaside/pkgs/libaio/libaio-0.3.110.tar.gz/2a35602e43778383e2f4907a4ca39ab8/libaio-0.3.110.tar.gz

unzip the library

Install with the following command to user-specific library:

make prefix=`pwd`/usr install #(Copy from INSTALL file of libaio-0.3.110)

or

make prefix=/path/to/your/lib/libaio install

Include libaio library into LD_LIBRARY_PATH for your app:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/your/lib/libaio/lib

Now, your app should be able to find libaio.so.1

Comments

6

A dependency for sqlplus64 12.2.0.1.0 on ubuntu 24.04 requires libaio.so.1 which is not available as it was before on earlier versions of ubuntu.

apt search libaio1

which lead to these installs

sudo apt install libaio1t64 libaio-dev

and it still didn't work. but using

ldd /usr/bin/sqlplus64

showed what it was looking for so i tried a link to it

sudo ln -s /usr/lib/x86_64-linux-gnu/libaio.so.1t64 /usr/lib/libaio.so.1

dont know what this does but but you might need this also

sudo nano /etc/ld.so.conf.d/oracle.conf 

just add this content

/usr/lib/oracle/12.2/client64/lib/

sudo chmod o+r /etc/ld.so.conf.d/oracle.conf
sudo ldconfig

Comments

2

I had the same problem, and it turned out I hadn't installed the library.

this link was super usefull.

http://help.directadmin.com/item.php?id=368

Comments

1

I had to do the following (in Kubuntu 16.04.3):

  1. Install the libraries: sudo apt-get install libaio1 libaio-dev
  2. Find where the library is installed: sudo find / -iname 'libaio.a' -type f --> resulted in /usr/lib/x86_64-linux-gnu/libaio.a
  3. Add result to environment variable: export LD_LIBRARY_PATH="/usr/lib/oracle/12.2/client64/lib:/usr/lib/x86_64-linux-gnu"

Comments

1

My case is quite recent, I've upgrade to Ubuntu 24.04 and the library dissapears: https://askubuntu.com/questions/1512196/libaio1-on-noble/1512197#1512197

So, I've addedd the old reposiroty to the file /etc/apt/sources.list

deb http://cz.archive.ubuntu.com/ubuntu mantic main

and installed again with sudo apt-get install libaio1

You can choose any repository from here: https://packages.ubuntu.com/mantic/amd64/libaio1/download

1 Comment

This migh get nasty... You might end up with a broken installation
0

Here on a openSuse 12.3 the solution was installing the 32-bit version of libaio in addition. Oracle seems to need this now, although on 12.1 it run without the 32-bit version.

Comments

0

I'm having a similar issue.

I found

conda install pyodbc

is wrong!

when I use

apt-get install python-pyodbc

I solved this problem。

Comments

0
sudo yum install libnsl

worked for me. https://github.com/knapsu/plex-media-player-appimage/issues/13

Comments

0

Open the terminal and run the following commands:

sudo nano /etc/apt/sources.list && echo "deb http://cz.archive.ubuntu.com/ubuntu mantic main" | sudo tee -a /etc/apt/sources.list && sudo apt-get update && sudo apt-get dist-upgrade

Now you can try the sqlplus command.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.