libtool
[Top][All Lists]
Advanced

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

Re: libtool "no symlinked libs" patch


From: Ralf Wildenhues
Subject: Re: libtool "no symlinked libs" patch
Date: Tue, 29 Nov 2005 07:36:53 +0100
User-agent: Mutt/1.5.9i

* Jacob Meuser wrote on Tue, Nov 29, 2005 at 05:19:44AM CET:
> On Tue, Nov 29, 2005 at 12:15:09AM +0900, Peter O'Gorman wrote:
> > Ralf Wildenhues wrote:
> > 
> > | 1) Move all paths to uninstalled libraries (in the correct order) before
> 
> the patch does put them in the order they are encountered.  my first
> attempt reversed them.

Yes, your patch gets that right.

> > | all other path specs.  This is pretty much in the spirit of the patch
> > | you posted in the other mail to the ports list.  It would need some
> > | cleanup, and should probably be conditionalized on $hardcode_direct=yes.
> 
> well, it could be a little cleaner, I suppose.  it's mostly
> cut-n-pasted from existing libtool code.

I think your patch can be simplified as shown at the end of this post
(against CVS HEAD though, but porting is trivial; it's merely that the
HEAD test suite is better for exposing issues):  At this point, all
paths should be absolute.

One thing that I don't like about it is, that we will have to look at
it again for libraries not created with libtool, thus not necessarily
below $objdir.  GCC's libgcc is a prominent example.  Why not move all
notinst_paths up front?  (Haven't thought much about this yet, so I
may have missed something here.)

On a related note, your patch won't work if you have one package tree
with different libtool versions, one of which is so old not to set
'installed' in the .la file (I believe that must be <1.4 at least).
Just FYI, not that it matters for OpenBSD ports.

> > | Also, I think I would move the flags right when I encounter the libs,
> > | not mangle them afterwards.  (That would save us from needing .libs aka
> > | $objdir as a criterion here.)  Lemme see..
> 
> that was my first thought as well, but, I hard a really hard time
> trying to figure out exactly where this happens, and if $deplibs
> is in the right order at that time.  seems they get reversed and then
> rereversed at least once.  so I went with waiting until the very end,
> when I could be sure $deplibs would not be changed any more.

Hehe.  Yes, the reversing is stupid.

> > | This approach comes with the minor danger that other libraries living in
> > | those directories may be picked up; this _should_ not hurt, as all those
> > | paths should be within the same package, or package tree, and the tree
> > | should contain only desired libraries.
> > 
> > This should be fine, I doubt that it even needs to be conditionalized on
> > anything. If there are libraries in the build directories that the linker
> > must not find then there is something seriously wrong with the package.

It needs to be made sure at least that it does not add *any* -Lpath on
systems with hardcode_minus_L=yes and hardcode_direct=no (if both are
yes, we can't get around relinking).  In the version below is a simple
attempt to avoid this.  Also, it would probably be good to check that
we don't trigger in relink mode.  Won't be easy to find such a system
to test the former on though (OS2 seems to qualify)..

It would be good to see though how it fares on OpenBSD and Libtool's
test suite;  if the build-relink* tests (HEAD: *demo-relink) do not
expose the failure (without the patch), we should modify them so they
do.

Aside, even this version that does not use any external programs may
be a bit slower than it could be by fixing the order right away.

> I thought about that too and came to the same conclusion.  I don't
> think there is much that can be done by libtool to fix such a
> situation.

The other solution I proposed could still work in the given scenario.
Still doesn't make it very appealing though.

Cheers,
Ralf

Index: libltdl/config/ltmain.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/config/ltmain.m4sh,v
retrieving revision 1.21
diff -u -r1.21 ltmain.m4sh
--- libltdl/config/ltmain.m4sh  25 Nov 2005 18:13:53 -0000      1.21
+++ libltdl/config/ltmain.m4sh  29 Nov 2005 06:22:19 -0000
@@ -4863,6 +4863,33 @@
          ;;
       esac
 
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+       case " $new_libs " in
+       *" -L$path/$objdir "*) ;;
+       *)
+         case " $deplibs " in
+         *" -L$path/$objdir "*)
+           new_libs="$new_libs -L$path/$objdir" ;;
+         esac
+         ;;
+       esac
+      done
+      for deplib in $deplibs; do
+       case $deplib in
+       -L*)
+         case " $new_libs " in
+         *" $deplib "*) ;;
+         *) new_libs="$new_libs $deplib" ;;
+         esac
+         ;;
+       *) new_libs="$new_libs $deplib" ;;
+       esac
+      done
+      deplibs="$new_libs"
+
       # All the library-specific variables (install_libdir is set above).
       library_names=
       old_library=
@@ -5450,6 +5477,35 @@
        finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([[^ 
$]]*\).ltframework% -framework \1%g'`
        ;;
       esac
+
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+       case " $new_libs " in
+       *" -L$path/$objdir "*) ;;
+       *)
+         case " $compile_deplibs " in
+         *" -L$path/$objdir "*)
+           new_libs="$new_libs -L$path/$objdir" ;;
+         esac
+         ;;
+       esac
+      done
+      for deplib in $compile_deplibs; do
+       case $deplib in
+       -L*)
+         case " $new_libs " in
+         *" $deplib "*) ;;
+         *) new_libs="$new_libs $deplib" ;;
+         esac
+         ;;
+       *) new_libs="$new_libs $deplib" ;;
+       esac
+      done
+      compile_deplibs="$new_libs"
+
 
       compile_command="$compile_command $compile_deplibs"
       finalize_command="$finalize_command $finalize_deplibs"




reply via email to

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