Thursday, January 12, 2012

How Configure Shared Library Difference Between .a .so

Whenever we install the Open source Application or Software Read me file Instruct us to add directory of shared Library to $LD_LIBRARY_PATH Environment Variable to /etc/.bashrc file.
$LD_LIBRARY_PATH - Environment Variable for Shared Library Loader.

Difference Between Shared Library Files .a .so
Libraries are linked Either statically or Dynamically.
.so files are DYNAMIC library files.
which are loaded /unloaded and linked to an Executable at runtime.
.a files are STATIC library that get linked to code at acompile Time.
To check the Shared library Dependency we can use ldd command.
It is an ar archive

Shared Library Files Configure Important command.
ldd- List Dynamic Dependency.
# ldd /usr/bin/w – These are Dynamic Dependency files for w binary files.
libproc-3.2.3.so => /lib/libproc-3.2.3.so (0x00cb5000)
libc.so.6 => /lib/tls/libc.so.6 (0x00b8a000)
/lib/ld-linux.so.2 (0x00b6d000)

lddconfig - Configure Dynamic Link Library.
How to Configure Shared Library permanently .
Add New Library Path into /etc/ld.so.conf (or) We have to add Any Library Path could be place in any file,whose name end with *.conf file Inside /etc/ld.so.conf.d/ like /etc/ld.so.conf.d/myapp.conf
Activates the Path
#ldconfig
For confirmation (or) Verification
#ldconfig -v | grep "New Library Path"

ldconfig - configure dynamic linker run time bindings.
Common Library Path.
/usr/lib Standard System Libraries.
/usr/X11R6/lib/ X11 Libraries.
How to Compile the Program with Shared Library for X server Program
#gcc -Wall program.c -o output -L /usr/X11R6/lib -l X11
-L share Library Directory
-l Search
-Wall Warning Message
#ld - GNU Linker

0 comments:

Flag counter

free counters