LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-24-2008, 10:20 PM   #1
Ashok_mittal
Member
 
Registered: Dec 2007
Posts: 73

Rep: Reputation: 15
Unhappy 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.
 
Old 01-25-2008, 11:25 AM   #2
alexander_bosakov
Member
 
Registered: Mar 2006
Location: Plovdiv, Bulgaria
Distribution: OpenSuse 11.3
Posts: 55

Rep: Reputation: 15
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.
 
Old 01-28-2008, 12:15 AM   #3
Ashok_mittal
Member
 
Registered: Dec 2007
Posts: 73

Original Poster
Rep: Reputation: 15
Smile

Quote:
Originally Posted by alexander_bosakov View Post
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.
 
Old 01-28-2008, 01:58 AM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
LD_LIBRARY_PATH is set for the programs that need the library
at runtime rather than the compiler.


Cheers,
Tink
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How does the default PATH get set on RHEL? bluethumb Linux - General 7 12-09-2009 09:07 AM
grub-set-default ... get-default? RaduH Linux - General 1 11-21-2007 01:05 PM
Default Path combilli Linux - Software 3 01-24-2007 11:15 AM
Set the path systemwide/Set the path for a user with Slackware jayhel Slackware 1 06-12-2005 12:24 AM
How to set PATH How do I set PATH environment variable? Tranquil Linux - Newbie 3 11-02-2003 02:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration