[Gllug] library includes and compiling

Vincent AE Scott gllug at codex.net
Sat Jan 12 21:07:07 UTC 2002


Nix(nix at esperi.demon.co.uk)@Sat, Jan 12, 2002 at 08:28:50PM +0000:
> On Thu, 10 Jan 2002, tet at accucard.com yowled:
> > 
> >>yuck. ITYM
> >>
> >>gcc -O2 -Wall -ansi -pedantic -o source source.c -L/usr/X11R6/lib -lGL
> > 
> > If you're doing that, you might as well go the whole hog and add:
> > 
> > 	-pedantic-errors -Wl,-rpath /usr/X11R6/lib
> 
> -rpath is a bad idea on systems running the GNU libc, because it bans
> you from moving those shared libraries around. If you leave out the
> -rpath, the ld.so.cache and ld.so.conf are consulted, so the libraries
> can move freely as long as the ld.so.conf is kept up to date; if you
> include -rpath, the program simply breaks if the X libraries ever move,
> and you must relink.

hmm, i've never moved my X libs arround, as they are part of the system
install, i see little or no reason to move them about.  for a start it'd
break my systems package database.


also, at least on solaris2, SUID binaries linked against non system
shared objects wouldnt IIRC run unless they were compiled with the run
time link path specified.  It was not possible to install the libs
anywhere else than where they were intended to be installed, as
corporate/IT policy of the company using the software denied this.


> 
> > The latter option is probably a good idea anyway. I just wish their was
> 
> It is a very bad idea.
> 
> > a way to get the linker to automatically add a directory to the run path
> > if it links a library from that directory. The Solaris linker does this
> > (or used to -- it's been many years since I've used it).
> 
> The Solaris linker does this because Solaris does not support
> /etc/ld.so.conf, so it has no dynamic site-wide shared library path
> scheme. The GNU linker doesn't do it, and shouldn't.
> 
> (You can *make* it do it with the specs-file hack, but, well, no. -rpath
> has no advantages and one compelling disadvantage on GNU libc systems.)
> 
> > Oh, and while I'm at it, -Wl? What muppet thought to use -W for that
> > where everywhere else in gcc, it's used to enable/disable warnings
> 
> That's not the worst of the inconsistent switches; -pthreads, or is it
> -threads, or is it -pthread (depending on target architecture!) is the
> worst.
> 
> *sick*


Thats why a decent build system is essential.


-- 

PGP key:  http://codex.net/pgp/pgp.asc

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list