Hi Carlo,

* Carlo Contavalli wrote on Wed, Jan 18, 2006 at 02:26:27PM CET:
> On Wed, Jan 18, 2006 at 09:26:26AM +0100, Ralf Wildenhues wrote:
> > Thanks for the concise bug report.  Two comments: your libtest.la
> > libraries are convenience archives, so this usage should probably
> > be accepted. 
> ok, we both agree on this :) I believe in this case it should be
> fixed. A simple hack that worked for me was to modify
>   func_extract_archives() in ltmain.sh (around line 330 on 1.5.22),
>   changing:
>         my_xdir="$my_gentop/$my_xlib"
>   to:
>         my_xdir="$my_gentop/$my_xlib.${RANDOM-0}"

Ouch.  This can get you in trouble, e.g. by a full disk after several
tests with RM=': '.  Or, worse, it won't work on systems where the
selected shell does not know $RANDOM.

> Assuming that $RANDOM comes from a prng with a long period, and that
> the clashing libraries will hardly exceed the number of 1-2 on
> most environments, it is reasonably safe to assume that no clashing will 
> ever take place. 

Try the patch at the end (not yet tested very much); it should not be
system-specific.

> The error seems to be reported only while working on .a files, no 
> warning/error while working on .so files.

It should happen for convenience archives only, I believe.

> > It should be a rather easy workaround to simply to rename one of the
> > libraries; is there a reason this is may be unduly difficult in your
> > situation?
> actually, my environment is much more complex than the example I provided. 
> litest.la are both supposed to be _modules_ (to be dlopened), not simple
> libraries. 

OK, I kind of guessed it would be complex.  ;-)

> The directory hierarchy is some kind of "namespace", handled
> directly by the application itself that takes care of handling path 
> problems with dlopen & family. 

Does it use libltdl for dlpreopening static components?

> The problem is that some of the modules, choosen at configure time,
> are to be compiled into the application itself, to allow the application
> to "bootstrap". Those modules are thus compiled twice, in two different
> build trees: once, as dynamic modules, and one more time as convenience 
> libraries. 

This may not be necessary, at least there are some situations in which
you may be able to get around double compilation.

> The binaries that need those modules to "bootstrap" are then linked against 
> them with simple libtool options. Renaming the module would both imply 
> a flat namespace, which is something I'd rather try to avoid, and a 
> complete rework of modules naming conventions (lot of changes in .m4
> macros for configure, and a lot of coding).

Sure.

> If there's something not allowed/portable/..., I'd expect something 
> like: "moron don't do that!" from libtool...

Yeah, we could do that, too, iff we decide it can't be fixed.

> If you need to, I can do some tests / checks or provide you with
> the full command lines used to compile the various components,
> or as much help as I can. I'm also open to suggestions...

Either post all `libtool --mode=link' lines including complete output
(also of the convenience libs!), or, even better..

> I know it's something you'd rather try to avoid, but the code I'm 
> working on is released under GPL. If you need to, you can test it 
> by yourself by checking it out from the public TLA archives or I 
> can send you a complete tarball with a brief description of the 
> installation process.

 ..show the source (in any one of the ways suggested).  I'm eager to
see complex real-world setups also to learn more about possible traps
to avoid in libtool.

Note to Debian libtool maintainer: do not apply the patch below (just
yet).  Not much tested yet, needs testsuite additions, etc.

Cheers,
Ralf

        * ltmain.in (extracted_archives, extracted_serial): New globals.
        (func_extract_archives): Use them to rename extraction archives
        for multiple convenience libraries with the same name.
        Reported by Carlo Contavalli <[EMAIL PROTECTED]>.

Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/Attic/ltmain.in,v
retrieving revision 1.334.2.116
diff -u -r1.334.2.116 ltmain.in
--- ltmain.in   11 Jan 2006 17:25:31 -0000      1.334.2.116
+++ ltmain.in   18 Jan 2006 14:51:40 -0000
@@ -136,6 +136,8 @@
 preserve_args=
 lo2o="s/\\.lo\$/.${objext}/"
 o2lo="s/\\.${objext}\$/.lo/"
+extracted_archives=
+extracted_serial=0
 
 #####################################
 # Shell function definitions:
@@ -327,7 +329,17 @@
        *) my_xabs=`pwd`"/$my_xlib" ;;
       esac
       my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
-      my_xdir="$my_gentop/$my_xlib"
+      my_xlib_u=$my_xlib
+      while :; do
+        case " $extracted_archives " in
+       *" $my_xlib_u "*)
+         extracted_serial=`expr $extracted_serial + 1`
+         my_xlib_u=$my_xlib-$extracted_serial ;;
+       *) break ;;
+       esac
+      done
+      extracted_archives="$extracted_archives $my_xlib_u"
+      my_xdir="$my_gentop/$my_xlib_u"
 
       $show "${rm}r $my_xdir"
       $run ${rm}r "$my_xdir"


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to