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.dynamic Library-Not copied into executable , but it will automatically load libraries at run time.
.a files are STATIC library that get linked to code at a compile 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)
How to Configure Shared Library permanently .
Add New Library Path into /etc/ld.so.conf (or) We have to add Any Library Path with library-path-file-name.conf extension
/etc/ld.so.conf.d/ like /etc/ld.so.conf.d/myapp.conf
Activates the Path
lddconfig - Configure Dynamic Link Library.
#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
$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.dynamic Library-Not copied into executable , but it will automatically load libraries at run time.
.a files are STATIC library that get linked to code at a compile 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)
How to Configure Shared Library permanently .
Add New Library Path into /etc/ld.so.conf (or) We have to add Any Library Path with library-path-file-name.conf extension
/etc/ld.so.conf.d/ like /etc/ld.so.conf.d/myapp.conf
Activates the Path
lddconfig - Configure Dynamic Link Library.
#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