[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: shared libraries



Justin Pryzby wrote:

> How can I modify the path to the libraries?  During compilation, the
> build system has to see $buildpath/iraf/lib/libfoo.so.0, but once
> installed, the executables must see
> /usr/lib/iraf/iraf/lib/libfoo.so.0.  There are a bunch of executables,
> so I don't want to have to use a script to set LD_LIBRARY_PATH or
> such.

Maybe this isn't the best idea, but really you only need to write one
script in /usr/bin, plus make a bunch of symlinks in /usr/bin to the
script that have the same name as the real executables.  Assuming your
real executables go in /usr/lib/iraf/bin, the script would be

#!/bin/sh

PROGRAM=`basename $0`
BASE_PATH=/usr/lib/iraf/bin
export LD_LIBRARY_PATH=/usr/lib/iraf/iraf/lib
exec $BASE_PATH/$PROGRAM "$@"

# if we get here something went wrong
echo "Couldn't run $BASE_PATH/$PROGRAM!" > /dev/stderr
exit 1


I guess the script could even go in /usr/share/iraf/bin so as not to
clutter the /usr/bin namespace.  Probably this method is only good for a
last resort, as it's kind of hackish.

Alternative solutions would be to put the shared libs in /usr/lib, or
else to add the IRAF shared lib directory to /etc/ld.so.conf ...

By the way, congrats on getting IRAF to build shared libs -- I hope it
wasn't as much of a pain in the @$$ as I found it was for cernlib.

-- 
Kevin B. McCarty <kmccarty@princeton.edu>   Physics Department
WWW: http://www.princeton.edu/~kmccarty/    Princeton University
GPG public key ID: 4F83C751                 Princeton, NJ 08544



Reply to: