I'm having trouble "installing" a shared library I download online. The library name is run time access (http://www.runtimeaccess.com/). In the quick start guide, they explain how to use the library using -L when compiling to define the library location and exporting the LD_LIBRARY_PATH env variable after adding the path of the library dir. First of all why do you need to define the lib location twice? using -L and LD_Library_PATH env variable?
Second part. I'm trying to avoid passing these arguments and also avoiding modification of the LD_LIBRARY_PATH env, so all I have to do is compile like so:
$ gcc myapp.c -lrtadb
so I would like to include the lib as part of the system lib. So I copied the whole rta-0.8.1
folder to /usr/local/lib/rta-0.8.1
and then add a /etc/ld.conf.d/rtadb.conf
file containing the path of the library directory /usr/local/lib/rta-0.8.1/src
in there.
$ cat /etc/ld.so.conf.d/rtadb.conf
#rta (run time access) lib
/usr/local/lib/rta-0.8.1/src
and then I ran sudo ldconfig
to update the shared library list - but no luck. When I try to compile my code, the library is not found:
$gcc myappdb.c -lrtadb
/usr/bin/ld: cannot find -lrtadb
collect2: ld returned 1 exit status
What am I doing wrong here?
here is the list of files in /usr/local/lib/rta-0.8.1/src
user@ubuntu:/usr/local/lib/rta-0.8.1/src$ ls -l
total 724
-rw-r--r-- 1 root root 24994 2012-11-14 10:49 api.c
-rw-r--r-- 1 root root 26132 2012-11-14 11:07 api.o
-rw-r--r-- 1 root root 62634 2012-11-14 10:49 do_sql.c
-rw-r--r-- 1 root root 5419 2012-11-14 10:49 do_sql.h
-rw-r--r-- 1 root root 41184 2012-11-14 11:07 do_sql.o
-rw-r--r-- 1 root root 149186 2012-11-14 11:07 librtadb.a
lrwxrwxrwx 1 root root 15 2012-11-14 11:07 librtadb.so -> librtadb.so.3.0
lrwxrwxrwx 1 root root 15 2012-11-14 11:07 librtadb.so.3 -> librtadb.so.3.0
-rwxr-xr-x 1 root root 117749 2012-11-14 11:07 librtadb.so.3.0
-rw-r--r-- 1 root root 2387 2012-11-14 10:49 Makefile
-rw-r--r-- 1 root root 10962 2012-11-14 11:07 parse.output
-rw-r--r-- 1 root root 21929 2012-11-14 11:07 parse.tab.c
-rw-r--r-- 1 root root 425 2012-11-14 11:07 parse.tab.h
-rw-r--r-- 1 root root 25064 2012-11-14 11:07 parse.tab.o
-rw-r--r-- 1 root root 6711 2012-11-14 10:49 parse.y
-rw-r--r-- 1 root root 46636 2012-11-14 10:49 rta.h
-rw-r--r-- 1 root root 31551 2012-11-14 10:49 rtatables.c
-rw-r--r-- 1 root root 17028 2012-11-14 11:07 rtatables.o
-rw-r--r-- 1 root root 58843 2012-11-14 11:07 token.c
-rw-r--r-- 1 root root 6291 2012-11-14 10:49 token.l
-rw-r--r-- 1 root root 37996 2012-11-14 11:07 token.o
btw, I'm running Ubuntu 10.04 LTS
thank you.
edit: if your new to this info read link below: http://www.tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html