This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Should gcc add RPATH for libstdc++.so?


On Wed, Mar 21, 2001 at 12:11:40AM -0500, Craig Rodrigues wrote:
>                                For example, when I compile
> CodeSourcery snapshots of gcc from their source rpm,
> gcc fails to add /usr/local/lib to the RPATH of executables
> it creates, requiring me to set the LD_LIBRARY_PATH environment variable.

Perhaps you can use my script }:-).

I've installed g++-2.95.1, 2.95.2, 2.95.3, 2.96, 3.0 and 3.1 and
can use any of them whenever without problems.  For this to work,
all I did was installing them with a different --prefix and then
putting the following in my PATH:

COMPILER_VERSION=`echo $0 | sed -e 's%^.*-\(.*\)%\1%'`
COMPILER=`echo $0 | sed -e 's%^.*/\(...\)[^/]*%\1%'`
if [ $# = 1 -a $1 = '-v' ]; then
  /usr/local/gcc-$COMPILER_VERSION/bin/$COMPILER -v
  exit 0
fi
(
  (
    if /usr/local/gcc-$COMPILER_VERSION/bin/$COMPILER "-Wl,-rpath,/usr/local/gcc-$COMPILER_VERSION/lib:$LD_RUN_PATH" $*; then
      echo 'compilation successful' >&4
    fi 2>&1 1>&3 | grep -v ' linking not done' 1>&2
  ) 4>/dev/null 4>&1 | grep 'compilation successful' >/dev/null
) 3>/dev/null 3>&1


Just make a lot of hard links to this same script with names like:

gcc-2.95.1, g++-2.95.1, gcc-2.95.2, g++-2.95.2, ... gcc-3.1, g++-3.1
(obviously, I used /usr/local/gcc-<version> as prefix).

The script honours LD_RUN_PATH as well as other -rpath options that are used.
The fd and grep fiddling is necessary to get the correct exit code.

-- 
Carlo Wood <carlo@alinoe.com>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]