bug-libtool
[Top][All Lists]
Advanced

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

PATCH: Don't pass -R flags found in a .la's dependency_libs again


From: Martin MOKREJŠ
Subject: PATCH: Don't pass -R flags found in a .la's dependency_libs again
Date: Thu, 22 May 2003 04:53:28 +0200 (CEST)

Hi,
  I found that there's still present a bug thought to be fixed by

> > > 2003-01-03  Albert Chin  <address@hidden>
> > >
> > >         * ltmain.sh: Don't pass -R flags found in a .la's dependency_libs
> > >         variable directly down to the linker.
> > >         Reported by Tim Mooney <address@hidden>.
> > >
> > > *** libtool-1.4.3/ltmain.sh     2002-10-23 04:26:24.000000000 +0200
> > > --- ltmain.sh   2003-02-18 21:53:41.000000000 +0100
> > > ***************
> > > *** 2084,2089 ****
> > > --- 2092,2098 ----
> > >           for deplib in $tmp_libs; do
> > >             case $deplib in
> > >             -L*) new_libs="$deplib $new_libs" ;;
> > > +           -R*) ;;
> > >             *)
> > >               case " $specialdeplibs " in
> > >               *" $deplib "*) new_libs="$deplib $new_libs" ;;

  It seems it's not applied to libtool-1.5 tree or it was baked out somehow
or it's another place where it appears.

  I found the very first place where the -R/dir flag comes from at least in
some cases - from .la files generated by older/buggy libtool. The patch below
checks every of those flags and if any of them starts with "-R" another round
of checks starts. Namely, on Tru64Unix /usr/bin/ld does NOT accept -R/dir
option and exits. On Irix /usr/bin/ld issues warning that the option is not
recognized and will be ignored. I seem to remember HP UX has same problem.
Google search shows that this prpblem might be still on MacOS X too.
http://openpackages.org/pipermail/op-tech/2001-July/001181.html



diff -u -w -r1.335 ltmain.in
--- ltmain.in   9 Apr 2003 17:54:06 -0000       1.335
+++ ltmain.in   22 May 2003 02:29:42 -0000
@@ -2016,7 +2016,36 @@
            old_convenience="$old_convenience $ladir/$objdir/$old_library"
            tmp_libs=
            for deplib in $dependency_libs; do
+              # if we are on machine where $LD does not accept -R/dir,
+              #   then remove it from deplibs otherwise linking will fail.
+              #   That is necessary on OSF1/DigitalUnix/Tru64Unix and Irix.
+              rfl=`echo "$deplib" | grep "^-R"`
+              if test -z "$rfl"; then
              deplibs="$deplib $deplibs"
+              else
+                rfl=`echo "$host" | grep osf`
+                if test ! -z "$rfl"; then
+                  # echo "We are on OSF1"
+                  :
+                else
+                  rfl=`echo "$host" | grep irix`
+                  if test ! -z "$rfl"; then
+                    # echo "We are on Irix"
+                    :
+                  else
+                    # we are on system which should support -R/dir flag, so 
leave this in deplibs
+                    deplibs="$deplib $deplibs"
+                  fi
+                fi
+
+                # if we are on OSF1 or Irix, check if use vendor ld(1)
+                if ! -z "$rfl"; then
+                  testld=`$LD -R/anystring 2>&1 | grep "Unknown flag"`
+                  if test ! -z "$testld"; then
+                    echo "Info: removing \$deplib '$deplib' listed in file 
'$lib'"
+                  fi
+                fi
+              fi
               if test "X$duplicate_deps" = "Xyes" ; then
                case "$tmp_libs " in
                *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;



The above patch has been tested with current cvs checkout on Tru64Unix.

How to check? Take any project using libtool. Run "make", stop after a while 
processing,
edit any .la file so that there is for example:

dependency_libs='-R/xx -L/usr/local/lib ...' inside of that file.

Rerun make. You should get "Info:" message that -R/xx has been omitted.

-- 
Martin Mokrejs <address@hidden>, <address@hidden>
PGP5.0i key is at http://www.natur.cuni.cz/~mmokrejs
MIPS / Institute for Bioinformatics <http://mips.gsf.de>
GSF - National Research Center for Environment and Health
Ingolstaedter Landstrasse 1, D-85764 Neuherberg, Germany
tel.: +49-89-3187 3683 , fax: +49-89-3187 3585




reply via email to

[Prev in Thread] Current Thread [Next in Thread]