Linux - Library Path (LD_LIBRARY_PATH, LIBPATH, SHLIB_PATH)

About

LD_LIBRARY_PATH is a environment variable that lists directory where executable can search for linux shared library. It's also called the shared library search path.

The value of the environment variable LD_LIBRARY_PATH is a colon-separated (:) set of directories where libraries are searched for first before the standard set of directories.

If you are running on a Solaris system, the LD_LIBRARY_PATH environment variable is used to define the native library path.

Why was it invented?

There were a couple good reasons why it was invented:

  • This is useful when debugging a new library or using a non-standard library for special purposes, but be sure you trust those who can control those directories.
  • To test out new library routines against an already compiled binary (for either backward compatibility or for new feature testing).
  • To have a short term way out in case you wanted to move a set of shared libraries to another location.

Environment Variable

Operating System Library Path Environment Variable
AIX LIBPATH
HP-UX SHLIB_PATH
Linux LD_LIBRARY_PATH
Solaris LD_LIBRARY_PATH

Search in it

Script search_library.sh where the first parameter is the library searched.

#!/bin/bash
IFS=:

for p in ${LD_LIBRARY_PATH}; do
    if [ -e ${p}/${1} ]; then
        echo ${p}
    fi
done

Example:

search_library.sh libodbc.so
/u01/app/oracle/product/fmw/Oracle_BI1/bifoundation/odbc/lib
/u01/app/oracle/product/TimesTen/tt1122/lib
/u01/app/oracle/product/fmw/Oracle_BI1/common/ODBC/Merant/7.1.5/lib
/u01/app/oracle/product/fmw/Oracle_BI1/bifoundation/odbc/lib
/u01/app/oracle/product/TimesTen/tt1122/lib
/u01/app/oracle/product/fmw/Oracle_BI1/common/ODBC/Merant/7.1.5/lib

Documentation / Reference





Discover More
Card Puncher Data Processing
Fusion Middelware - OPMN.xml configuration file

OPMN.xml is the main configuration file for OPMN that is used to launch each system component (such as Oracle Business Intelligence). It specifies environment variable (path, ...) PATH LD_LIBRARY_PATH...
Card Puncher Data Processing
How to upgrade SQLite to the latest shared library version

This howto shows you how to upgrade your shared SQLite library
Php Home Path System User
Installation of Apache on Windows 10 with Apache Lounge

This article shows you how easy it is to install apache on Windows 10
Linux - Shared Library (so, sl)

so means shared object file and are shared library in Linux There format is the Executable and Linkable Format. As Shared Library, so files are open file opened by a process. The shared library extension...
Card Puncher Data Processing
Oracle Database - ODBC Driver Insallation on Linux

where is the data manager home () and ~/.odbc.ini === Drivers === Example odbcinst.ini === DSN === odbc.ini Minimal parameters Complete: ==== Test it ==== with ===== Support...
Timesten Component
Timesten - (SQL Developer|ODBC Client) Configuration

How to configure SQL Developer to connect to a Timesten Database. Download and install the last version of SQL Developer downloadSQL Developer To access a TimesTen database from SQL Developer,...
Timesten Component
Timesten - How to set up the Timesten Cache ?

Steps to set up the Timesten Cache to cache data of an Oracle Database. Before you cache Oracle data in a TimesTen database, you must perform certain tasks: either outside SQL Developer using command-line...



Share this page:
Follow us:
Task Runner