niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » *nix » SGI/IRIX » admin
and /etc/ld.so.conf
Post new topic   Reply to topic Page 1 of 2 [18 Posts] View previous topic :: View next topic
Goto page:  1, 2 Next
Author Message
Walter Roberson
*nix forums Guru


Joined: 19 Feb 2005
Posts: 1300

PostPosted: Sat Jan 14, 2006 7:48 pm    Post subject: Re: $path and /etc/ld.so.conf Reply with quote

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

PostPosted: Wed Jan 18, 2006 10:42 pm    Post subject: Re: $path and /etc/ld.so.conf Reply with quote

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

PostPosted: Thu Jan 26, 2006 7:01 pm    Post subject: Re: $path and /etc/ld.so.conf Reply with quote

"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

PostPosted: Thu Jan 26, 2006 9:23 pm    Post subject: Re: $path and /etc/ld.so.conf Reply with 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?


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

PostPosted: Thu Jan 26, 2006 11:26 pm    Post subject: Re: $path and /etc/ld.so.conf Reply with quote

"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

PostPosted: Fri Jan 27, 2006 10:59 am    Post subject: Re: $path and /etc/ld.so.conf Reply with quote

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

PostPosted: Fri Jan 27, 2006 11:03 am    Post subject: Re: $path and /etc/ld.so.conf Reply with quote

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

PostPosted: Fri Jan 27, 2006 3:00 pm    Post subject: Re: $path and /etc/ld.so.conf Reply with quote

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

PostPosted: Sat Jan 28, 2006 2:25 pm    Post subject: Re: $path and /etc/ld.so.conf Reply with quote

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

PostPosted: Sat Jan 28, 2006 2:27 pm    Post subject: Re: $path and /etc/ld.so.conf Reply with quote

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

PostPosted: Sun Jan 29, 2006 12:12 am    Post subject: Re: $path and /etc/ld.so.conf Reply with quote

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

PostPosted: Sun Jan 29, 2006 12:41 am    Post subject: Re: $path and /etc/ld.so.conf Reply with quote

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

PostPosted: Sun Jan 29, 2006 10:11 am    Post subject: Re: $path and /etc/ld.so.conf Reply with quote

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

PostPosted: Mon Jan 30, 2006 6:08 am    Post subject: Re: $path and /etc/ld.so.conf Reply with quote

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

PostPosted: Mon Jan 30, 2006 10:12 am    Post subject: Re: $path and /etc/ld.so.conf Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 2 [18 Posts] Goto page:  1, 2 Next
View previous topic :: View next topic
The time now is Sat Nov 22, 2008 11:19 am | All times are GMT
navigation Forum index » *nix » SGI/IRIX » admin
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts User Environment - export PATH variable paalepu AIX 0 Tue Sep 12, 2006 8:12 pm
No new posts How to set a session cookie with a path? John Drako PHP 1 Thu Jul 20, 2006 7:32 pm
No new posts long path names for ifstream in( Fred J. C++ 1 Thu Jul 20, 2006 2:06 am
No new posts how to use Env variables & its path in ksh shell script dalu.gelu@gmail.com shell 8 Tue Jul 18, 2006 1:12 pm
No new posts skip path prune weberw@adelphia.net Perl 1 Mon Jul 17, 2006 4:34 pm

Mobile Phone | Xbox Mod Chip | Mortgage Calculator | Remortgaging | McDonalds
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.2455s ][ Queries: 16 (0.1024s) ][ GZIP on - Debug on ]