My Wiki!

Linux libraries

Add Your Path

Create a file called /etc/ld.so.conf.d/myapp.conf:

  # vi /etc/ld.so.conf.d/myapp.conf

Add the following path:

/usr/local/lib

Save and close the file.

Activate Your Library Path

You must run the following command to activate path:

   # ldconfig

Verify Your New Library Path

 # ldconfig -v | less

OR

   # ldconfig -v | grep /usr/local/lib

Sample outputs:

/usr/local/lib:
        libGeoIP.so.1 -> libGeoIP.so.1.4.6
        libGeoIPUpdate.so.0 -> libGeoIPUpdate.so.0.0.0
/usr/lib64/mysql:
        libmysqlclient_r.so.15 -> libmysqlclient_r.so.15.0.0
        libmysqlclient.so.15 -> libmysqlclient.so.15.0.0
/lib:
        libutil.so.1 -> libutil-2.5.so

How Do I Delete The Library Path?

Simply, delete the file:

  # rm /etc/ld.so.conf.d/myapp.conf
  # ldconfig

How Do I Edit The Library Path?

Simply edit the file and reload the changes:

  # vi /etc/ld.so.conf.d/myapp.conf
  # ldconfig

How Do I Compile Program With Shared Libs And GNU GCC?

You can use the following gcc

  $ gcc -Wl,-R/path/to/lib -I/path/to/include -L/path/to/lib -o myAppName mycode.c -llibapp2

Navigation