| Author |
Message |
Walter Roberson *nix forums Guru
Joined: 19 Feb 2005
Posts: 1300
|
Posted: Sat Jan 14, 2006 7:48 pm Post subject:
Re: $path and /etc/ld.so.conf
|
|
|
In article <1137266503.467049.326460@f14g2000cwb.googlegroups.com>,
<info@kerescontorni.com> wrote:
:In Linux system I found the /etc/ld.so.conf file where to put my
:personal path for libraries. In /etc/rofile file I found a $path
:declaration.
:In a Irix system I can't find in /etc/profile the $path declaration nor
:/etc/ld.so.conf for libraries.
:I have installed the gcc/freeware from freeware.sgi.com. I found the
:"gcc" in /usr/freeware/bin and I would add in my $path and library
:declaration...
You will need to use files that are specific to the shell you
are using. /etc/profile or /etc/cshrc are read by most shells.
Be aware that some rsh operations are not considered to be
"logging in" and so the shell might not run the initialization
sequence. Also be aware that anything started by inetd will
*at best* have environment variables as of the time inetd started,
and it is not at all uncomon for daemons to scrub their environment.
It is considered good securty practice for trusted programs not to
rely upon user environments.
For libraries, you should read the rld man page, especially
about the LD_LIBRARY*_PATH series of variables. Note too the
part about those variables being ignored for suid programs. |
|
| Back to top |
|
 |
Thomas Jahns *nix forums beginner
Joined: 20 Apr 2005
Posts: 44
|
Posted: Wed Jan 18, 2006 10:42 pm Post subject:
Re: $path and /etc/ld.so.conf
|
|
|
info@kerescontorni.com writes:
| Quote: | In Linux system I found the /etc/ld.so.conf file where to put my
personal path for libraries. In /etc/rofile file I found a $path
declaration.
In a Irix system I can't find in /etc/profile the $path declaration nor
/etc/ld.so.conf for libraries.
I have installed the gcc/freeware from freeware.sgi.com. I found the
"gcc" in /usr/freeware/bin and I would add in my $path and library
declaration...
Have you some suggestion for me?
|
The preferred way is to compile library paths into the binary. Reading
up on ld and the -rpath option should tell you everything so your
self-compiled programs will find their libraries without any extra
environment variables.
Thomas Jahns
--
"Computers are good at following instructions,
but not at reading your mind."
D. E. Knuth, The TeXbook, Addison-Wesley 1984, 1986, 1996, p. 9 |
|
| Back to top |
|
 |
Joseph Michaud *nix forums beginner
Joined: 09 Apr 2005
Posts: 5
|
Posted: Thu Jan 26, 2006 7:01 pm Post subject:
Re: $path and /etc/ld.so.conf
|
|
|
"Thomas Jahns" <Thomas.Jahns@epost.de> wrote in message
news:87psmpw428.fsf@tjahns.news.arcor.de...
| Quote: | info@kerescontorni.com writes:
In Linux system I found the /etc/ld.so.conf file where to put my
personal path for libraries. In /etc/rofile file I found a $path
declaration.
In a Irix system I can't find in /etc/profile the $path declaration nor
/etc/ld.so.conf for libraries.
I have installed the gcc/freeware from freeware.sgi.com. I found the
"gcc" in /usr/freeware/bin and I would add in my $path and library
declaration...
Have you some suggestion for me?
The preferred way is to compile library paths into the binary. Reading
up on ld and the -rpath option should tell you everything so your
self-compiled programs will find their libraries without any extra
environment variables.
|
Ick. Hardcoded rpaths permanently fix the location of the DSOs used by the
binary.
See rld(5), ld(1), and dso(5) man pages for information explaining
LD_LIBRARY_PATH,
LD_LIBRARYN32_PATH, and LD_LIBRARY64_PATH.
Joe |
|
| Back to top |
|
 |
Tony 'Nicoya' Mantler *nix forums Guru Wannabe
Joined: 02 Jul 2005
Posts: 139
|
Posted: Thu Jan 26, 2006 9:23 pm Post subject:
Re: $path and /etc/ld.so.conf
|
|
|
In article <drb6bf$dul$1@news01.intel.com>,
"Joseph Michaud" <joseph.michaud@intel.com> wrote:
: Ick. Hardcoded rpaths permanently fix the location of the DSOs used by the
: binary.
And why exactly would you want to move them?
Cheers - Tony 'Nicoya' Mantler :)
--
Tony 'Nicoya' Mantler -- Master of Code-fu -- nicoya@ubb.ca
-- http://nicoya.feline.pp.se/ -- http://www.ubb.ca/ -- |
|
| Back to top |
|
 |
Thomas Jahns *nix forums beginner
Joined: 20 Apr 2005
Posts: 44
|
Posted: Thu Jan 26, 2006 11:26 pm Post subject:
Re: $path and /etc/ld.so.conf
|
|
|
"Joseph Michaud" <joseph.michaud@intel.com> writes:
| Quote: | "Thomas Jahns" <Thomas.Jahns@epost.de> wrote in message
news:87psmpw428.fsf@tjahns.news.arcor.de...
info@kerescontorni.com writes:
In Linux system I found the /etc/ld.so.conf file where to put my
personal path for libraries. In /etc/rofile file I found a $path
declaration.
In a Irix system I can't find in /etc/profile the $path declaration nor
/etc/ld.so.conf for libraries.
I have installed the gcc/freeware from freeware.sgi.com. I found the
"gcc" in /usr/freeware/bin and I would add in my $path and library
declaration...
Have you some suggestion for me?
The preferred way is to compile library paths into the binary. Reading
up on ld and the -rpath option should tell you everything so your
self-compiled programs will find their libraries without any extra
environment variables.
Ick. Hardcoded rpaths permanently fix the location of the DSOs used by the
binary.
|
Which in my opinion would be a good thing for even remotely security
related software.
| Quote: | See rld(5), ld(1), and dso(5) man pages for information explaining
LD_LIBRARY_PATH,
LD_LIBRARYN32_PATH, and LD_LIBRARY64_PATH.
|
If you had really read that, you'd have also seen that -rpath only
extends the default value of the _search_ path, not individual paths to
individual libraries.
Thomas Jahns
--
"Computers are good at following instructions,
but not at reading your mind."
D. E. Knuth, The TeXbook, Addison-Wesley 1984, 1986, 1996, p. 9 |
|
| Back to top |
|
 |
Randolf Schultz *nix forums beginner
Joined: 23 Mar 2005
Posts: 4
|
Posted: Fri Jan 27, 2006 10:59 am Post subject:
Re: $path and /etc/ld.so.conf
|
|
|
Joseph Michaud <joseph.michaud@intel.com> wrote:
[...]
| Quote: | The preferred way is to compile library paths into the binary. Reading
up on ld and the -rpath option should tell you everything so your
self-compiled programs will find their libraries without any extra
environment variables.
Ick. Hardcoded rpaths permanently fix the location of the DSOs used by the
binary.
|
....and thus successfully prevent running executables on machines you
have no administration priviledges on? Got bitten once, env vars
did not help. Try to avoid -rpath since.
best regards,
Randolf,
--
http://www.ayam3d.org/ Reconstruct the World! |
|
| Back to top |
|
 |
Randolf Schultz *nix forums beginner
Joined: 23 Mar 2005
Posts: 4
|
Posted: Fri Jan 27, 2006 11:03 am Post subject:
Re: $path and /etc/ld.so.conf
|
|
|
Tony 'Nicoya' Mantler <nicoya@ubb.ca> wrote:
| Quote: | In article <drb6bf$dul$1@news01.intel.com>,
"Joseph Michaud" <joseph.michaud@intel.com> wrote:
: Ick. Hardcoded rpaths permanently fix the location of the DSOs used by the
: binary.
And why exactly would you want to move them?
|
Because you do not have the priviledge to copy the shared objects
to the place encoded in the executable?
best regards,
Randolf,
--
http://www.ayam3d.org/ Reconstruct the World! |
|
| Back to top |
|
 |
S.C.Sprong *nix forums beginner
Joined: 21 May 2005
Posts: 36
|
Posted: Fri Jan 27, 2006 3:00 pm Post subject:
Re: $path and /etc/ld.so.conf
|
|
|
Tony 'Nicoya' Mantler <nicoya@ubb.ca> wrote:
| Quote: | In article <drb6bf$dul$1@news01.intel.com>,
"Joseph Michaud" <joseph.michaud@intel.com> wrote:
: Hardcoded rpaths permanently fix the location of the DSOs used by the
: binary.
And why exactly would you want to move them?
|
Overriding the default libstdc++.so directly comes to mind. Oh, the joys of
the 'elegance' [1] of compiler (version) dependent name mangling.
scs
[1] ie not at all. |
|
| Back to top |
|
 |
UNIX admin *nix forums Guru
Joined: 06 Mar 2005
Posts: 308
|
Posted: Sat Jan 28, 2006 2:25 pm Post subject:
Re: $path and /etc/ld.so.conf
|
|
|
Joseph Michaud wrote:
| Quote: | Ick. Hardcoded rpaths permanently fix the location of the DSOs used by the
binary.
See rld(5), ld(1), and dso(5) man pages for information explaining
LD_LIBRARY_PATH,
LD_LIBRARYN32_PATH, and LD_LIBRARY64_PATH.
|
Actually, the proper way to solve this on IRIX 6.5 is to compile with
the -R<path-to-alt-lib-dir>, which doesn't hardcode the library PATH,
but it does add a search PATH into the binary.
If the library is found sooner in another path, everything proceeds as
it normally would. If not, the runtime linker will look in the alternate
PATHs provided with the -R flag. |
|
| Back to top |
|
 |
UNIX admin *nix forums Guru
Joined: 06 Mar 2005
Posts: 308
|
Posted: Sat Jan 28, 2006 2:27 pm Post subject:
Re: $path and /etc/ld.so.conf
|
|
|
Randolf Schultz wrote:
| Quote: | ...and thus successfully prevent running executables on machines you
have no administration priviledges on? Got bitten once, env vars
did not help. Try to avoid -rpath since.
|
Then my guess would be you're not really meant to do that on the system.
Do the system administrators know that you're compiling your own stuff?
Please remain seated. The police will be arriving shortly. |
|
| Back to top |
|
 |
Randolf Schultz *nix forums beginner
Joined: 23 Mar 2005
Posts: 4
|
Posted: Sun Jan 29, 2006 12:12 am Post subject:
Re: $path and /etc/ld.so.conf
|
|
|
UX-admin <tripivceta@hotmail.com> wrote:
[...]
| Quote: | Then my guess would be you're not really meant to do that on the system.
Do the system administrators know that you're compiling your own stuff?
|
No, I am indeed supposed to just log in and stare at the prompt.
| Quote: | Please remain seated. The police will be arriving shortly.
|
Your real name (congratulations to your parents for their foresight)
and your other response make me think, you did not get my point. Sorry
I was really not that explicit. Again:
1) There are machines, where you are not root, take e.g. the SourceForge
compile farm.
2) There is software distributed in binary form with hardcoded .so-path,
but without source code; you understand, that there is no PRMan3.8.src.tgz
or Maya-Complete-src.tgz available for download?
(Those are just examples, they probably are compiled differently.)
If those things come together, you are out of luck.
Ask the software vendor to recompile/redistribute gives you a "but if
you get root and follow the installation instructions/script (copy .so
to /usr...) it works, we just tested"
and asking remote system to give you root or install for you gives you
a laugh (if you get a response).
This would not have happened without -r...
best regards,
Randolf,
--
http://www.ayam3d.org/ Reconstruct the World! |
|
| Back to top |
|
 |
Tony 'Nicoya' Mantler *nix forums Guru Wannabe
Joined: 02 Jul 2005
Posts: 139
|
Posted: Sun Jan 29, 2006 12:41 am Post subject:
Re: $path and /etc/ld.so.conf
|
|
|
In article <43dc0877@news.uni-rostock.de>,
Randolf Schultz <rschultz@informatik.uni-rostock.de> wrote:
: This would not have happened without -r...
I think you are mistaken about the function of -rpath. -rpath merely adds a
directory to the list of directories in the executable that rld will search for
libraries at runtime.
What you ran into was more likely an executable that was improperly linked
(like, someone did -l/usr/lib32/libfoo.so) or linked with -no_library_replace.
The presence of entries in the rpath has no bearing on whether rld will search
the LD_LIBRARY*_PATH directories. The only thing that disables that is if the
executable is running setuid, or was compiled with -no_library_replace.
If the binary is attempting to load a library of which an inferior version is
found in the rpath (rare but possible), you can substitute it by either
twiddling with _RLD*_ROOT or _RLD*_LIST, whichever is more suitable for your
particular case.
So, I maintain that there is fundamentally no reason to not use -rpath whenever
possible. Insisting that end users twiddle their LD_LIBRARY*_PATH, unless
they're trying to do something unusual, is a terrible thing to do.
Cheers - Tony 'Nicoya' Mantler :)
--
Tony 'Nicoya' Mantler -- Master of Code-fu -- nicoya@ubb.ca
-- http://nicoya.feline.pp.se/ -- http://www.ubb.ca/ -- |
|
| Back to top |
|
 |
UNIX admin *nix forums Guru
Joined: 06 Mar 2005
Posts: 308
|
Posted: Sun Jan 29, 2006 10:11 am Post subject:
Re: $path and /etc/ld.so.conf
|
|
|
Randolf Schultz wrote:
| Quote: | This would not have happened without -r...
|
Are we even discussing the same options here?
-R (CAPITAL R) when used during a compile adds to the run-time library
search PATH. It does nothing else but tell the run time linker which
ADDITIONAL PATHs to look into if it can't find the needed *.so files in
the 'default' PATHs.
There is a nice README document on compiling with -R on freeware.sgi.com.
I recommend that you search for it, read it, understand it, and then
everything'll be hunky-dory and you won't have a problem. |
|
| Back to top |
|
 |
Tony 'Nicoya' Mantler *nix forums Guru Wannabe
Joined: 02 Jul 2005
Posts: 139
|
Posted: Mon Jan 30, 2006 6:08 am Post subject:
Re: $path and /etc/ld.so.conf
|
|
|
In article <43db7eb1$0$1152$5402220f@news.sunrise.ch>,
UX-admin <tripivceta@hotmail.com> wrote:
: Actually, the proper way to solve this on IRIX 6.5 is to compile with
: the -R<path-to-alt-lib-dir>, which doesn't hardcode the library PATH,
: but it does add a search PATH into the binary.
:
: If the library is found sooner in another path, everything proceeds as
: it normally would. If not, the runtime linker will look in the alternate
: PATHs provided with the -R flag.
Where are you finding this -R option? I think you mean "-rpath
/path/to/alt/lib/dir".
Also, the rpath entries are searched before LD_LIBRARY*_PATH and before the
standard directories, not after them. (as it should be)
Cheers - Tony 'Nicoya' Mantler :)
--
Tony 'Nicoya' Mantler -- Master of Code-fu -- nicoya@ubb.ca
-- http://nicoya.feline.pp.se/ -- http://www.ubb.ca/ -- |
|
| Back to top |
|
 |
UNIX admin *nix forums Guru
Joined: 06 Mar 2005
Posts: 308
|
Posted: Mon Jan 30, 2006 10:12 am Post subject:
Re: $path and /etc/ld.so.conf
|
|
|
Tony 'Nicoya' Mantler wrote:
| Quote: | Where are you finding this -R option? I think you mean "-rpath
/path/to/alt/lib/dir".
Also, the rpath entries are searched before LD_LIBRARY*_PATH and before the
standard directories, not after them. (as it should be)
|
cc -L/usr/freeware/lib -I/usr/freeware/include -R/usr/freeware/lib |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|