LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to set Shared library's default path (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-set-shared-librarys-default-path-616165/)

Ashok_mittal 01-24-2008 10:20 PM

How to set Shared library's default path
 
I am making a shared library in my dir. by giving these commands :

gcc -fPIC -g -c -Wall a.c
gcc -shared -Wl,-soname,libmystuff.so.1 \
-o libmystuff.so.1.0.1 a.o -lc

Now my real name for the library as libmystuff.so.1.0.1 has been created
but where is the soname i am not able to find it.
Do i need to create this soname separately as a symbolic link to real name
but as i read the soname should be created automatically whereas the linker
name i need to create.

alexander_bosakov 01-25-2008 11:25 AM

If you want the library to be system-wide accessible, put it in some standart location, like /usr/lib, or /usr/local/lib and then run as root "ldconfig". It will create the necessary symlink and update the linker cache. See it's manpage for more details.

Ashok_mittal 01-28-2008 12:15 AM

Quote:

Originally Posted by alexander_bosakov (Post 3035149)
If you want the library to be system-wide accessible, put it in some standart location, like /usr/lib, or /usr/local/lib and then run as root "ldconfig". It will create the necessary symlink and update the linker cache. See it's manpage for more details.

Actually this is the standard way but if i don't have permission as a root then i can't edit this regular files like /usr/lib or /usr/local/lib or /lib/ then i need to locate my so file in a directory accessible to me.
Now i want to know that if i create this new so library in a local directory and then give the path name after 'ldconfig "PATH"' so what is the use of LD_LIBRARY_PATH. Is it to set the path for compiler to recognize the actual path and if once for a so library we set this will it be same for the other so Libraries made after setting this env variable.

Tinkster 01-28-2008 01:58 AM

LD_LIBRARY_PATH is set for the programs that need the library
at runtime rather than the compiler.


Cheers,
Tink


All times are GMT -5. The time now is 09:55 AM.