2019.02.15 / 19:01 cannot open shared object file

추천 수 118

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

./hello: error while loading shared libraries: 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:


/usr/lib looks like this:

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

Output of ldd hello: => ../ocilib-3.9.3/src/.libs/ (0x0000002a95558000) => /lib64/tls/ (0x0000003811200000) => ../instantclient_11_2/ (0x0000002a956c4000)
/lib64/ (0x000000552aaaa000) => ../instantclient_11_2/ (0x0000002a97f56000) => /lib64/ (0x0000003811500000) => /lib64/tls/ (0x0000003811700000) => /lib64/tls/ (0x0000003811b00000) => /lib64/ (0x0000003819000000) => 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?

t 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 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.

Type the following:

sudo apt-get install libaio1 libaio-dev


sudo yum install libaio