bug-libtool
[Top][All Lists]
Advanced

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

Re: libtool cannot handle libraries with the same name


From: Robert Boehne
Subject: Re: libtool cannot handle libraries with the same name
Date: Fri, 27 Jul 2001 11:22:27 -0500

Alexander:

Hmmm... This doesn't seem like a bug to me.  If you do name
your libraries the same, you are asking for trouble.
How can you be sure you are getting the one you want
at runtime?  I don't think this is even possible with
shared libraries, it seems to contradict the idea that
you can swap out one library for another, and find
them in a list of directories specified by the link
or enviornment variables.  If you want to write a patch,
go ahead, but I'm sure it would be better for you to
not use the same names for libraries in different directories.

Cheers!

Robert


Alexander Bluhm wrote:
> 
> There is a bug in the libtool script.
> 
> operating system: SuSE Linux 7.2
> program: libtool
> version: 1.4
> 
> When trying to link several dynamic libraries which have the same name
> but lie in different directories into a module, it fails.
> I have written a small script to demonstrate the problem.
> 
> --------
> 
> #!/bin/sh
> # reproduce a bug in libtool. linking several static loadable libraries
> # with the same name but in different directories fails
> 
> LIBTOOL=libtool
> CC=gcc
> 
> set -eux
> 
> $LIBTOOL --version
> rm -rf a b c
> mkdir a b c
> touch a/a.c b/b.c c/c.c
> (cd a && $LIBTOOL --mode=compile $CC -c a.c -o a.lo)
> (cd b && $LIBTOOL --mode=compile $CC -c b.c -o b.lo)
> (cd c && $LIBTOOL --mode=compile $CC -c c.c -o c.lo)
> (cd a && $LIBTOOL --mode=link $CC a.lo -o lib.la)
> (cd b && $LIBTOOL --mode=link $CC b.lo -o lib.la)
> (cd c && $LIBTOOL --mode=link $CC c.lo ../a/lib.la ../b/lib.la -o c.la 
> -module)
> 
> --------
> 
> I have tried it with libtool 1.4 and the stable branch 1.4
> Here is my output from the script
> 
> --------
> 
> + libtool --version
> ltmain.sh (GNU libtool) 1.4.0a (1.922.2.22 2001/07/12 18:10:46)
> + rm -rf a b c
> + mkdir a b c
> + touch a/a.c b/b.c c/c.c
> + cd a
> + libtool --mode=compile gcc -c a.c -o a.lo
> mkdir .libs
> gcc -c a.c      -fPIC -DPIC -o .libs/a.lo
> gcc -c a.c -o a.o >/dev/null 2>&1
> mv -f .libs/a.lo a.lo
> + cd b
> + libtool --mode=compile gcc -c b.c -o b.lo
> mkdir .libs
> gcc -c b.c      -fPIC -DPIC -o .libs/b.lo
> gcc -c b.c -o b.o >/dev/null 2>&1
> mv -f .libs/b.lo b.lo
> + cd c
> + libtool --mode=compile gcc -c c.c -o c.lo
> mkdir .libs
> gcc -c c.c      -fPIC -DPIC -o .libs/c.lo
> gcc -c c.c -o c.o >/dev/null 2>&1
> mv -f .libs/c.lo c.lo
> + cd a
> + libtool --mode=link gcc a.lo -o lib.la
> rm -fr .libs/lib.la .libs/lib.* .libs/lib.*
> ar cru .libs/lib.al a.lo
> ranlib .libs/lib.al
> creating lib.la
> (cd .libs && rm -f lib.la && ln -s ../lib.la lib.la)
> + cd b
> + libtool --mode=link gcc b.lo -o lib.la
> rm -fr .libs/lib.la .libs/lib.* .libs/lib.*
> ar cru .libs/lib.al b.lo
> ranlib .libs/lib.al
> creating lib.la
> (cd .libs && rm -f lib.la && ln -s ../lib.la lib.la)
> + cd c
> + libtool --mode=link gcc c.lo ../a/lib.la ../b/lib.la -o c.la -module
> rm -fr .libs/c.la .libs/c.* .libs/c.*
> rm -fr .libs/c.lax
> mkdir .libs/c.lax
> rm -fr .libs/c.lax/lib.al
> mkdir .libs/c.lax/lib.al
> (cd .libs/c.lax/lib.al && ar x /home/alexb/prg/libtool/c/../a/.libs/lib.al)
> rm -fr .libs/c.lax/lib.al
> mkdir .libs/c.lax/lib.al
> (cd .libs/c.lax/lib.al && ar x /home/alexb/prg/libtool/c/../b/.libs/lib.al)
> (cd .libs/c.lax/lib.al && ln -s a.lo a.lo)
> ar cru .libs/c.al c.lo .libs/c.lax/lib.al/a.lo  .libs/c.lax/lib.al/b.lo
> ar: .libs/c.lax/lib.al/a.lo: Too many levels of symbolic links
> address@hidden:~/prg/libtool$ less l
> libbug*  libwork*
> address@hidden:~/prg/libtool$ less libbug
> address@hidden:~/prg/libtool$ ./libbug
> + libtool --version
> ltmain.sh (GNU libtool) 1.4.0a (1.922.2.22 2001/07/12 18:10:46)
> + rm -rf a b c
> + mkdir a b c
> + touch a/a.c b/b.c c/c.c
> + cd a
> + libtool --mode=compile gcc -c a.c -o a.lo
> mkdir .libs
> gcc -c a.c      -fPIC -DPIC -o .libs/a.lo
> gcc -c a.c -o a.o >/dev/null 2>&1
> mv -f .libs/a.lo a.lo
> + cd b
> + libtool --mode=compile gcc -c b.c -o b.lo
> mkdir .libs
> gcc -c b.c      -fPIC -DPIC -o .libs/b.lo
> gcc -c b.c -o b.o >/dev/null 2>&1
> mv -f .libs/b.lo b.lo
> + cd c
> + libtool --mode=compile gcc -c c.c -o c.lo
> mkdir .libs
> gcc -c c.c      -fPIC -DPIC -o .libs/c.lo
> gcc -c c.c -o c.o >/dev/null 2>&1
> mv -f .libs/c.lo c.lo
> + cd a
> + libtool --mode=link gcc a.lo -o lib.la
> rm -fr .libs/lib.la .libs/lib.* .libs/lib.*
> ar cru .libs/lib.al a.lo
> ranlib .libs/lib.al
> creating lib.la
> (cd .libs && rm -f lib.la && ln -s ../lib.la lib.la)
> + cd b
> + libtool --mode=link gcc b.lo -o lib.la
> rm -fr .libs/lib.la .libs/lib.* .libs/lib.*
> ar cru .libs/lib.al b.lo
> ranlib .libs/lib.al
> creating lib.la
> (cd .libs && rm -f lib.la && ln -s ../lib.la lib.la)
> + cd c
> + libtool --mode=link gcc c.lo ../a/lib.la ../b/lib.la -o c.la -module
> rm -fr .libs/c.la .libs/c.* .libs/c.*
> rm -fr .libs/c.lax
> mkdir .libs/c.lax
> rm -fr .libs/c.lax/lib.al
> mkdir .libs/c.lax/lib.al
> (cd .libs/c.lax/lib.al && ar x /home/alexb/prg/libtool/c/../a/.libs/lib.al)
> rm -fr .libs/c.lax/lib.al
> mkdir .libs/c.lax/lib.al
> (cd .libs/c.lax/lib.al && ar x /home/alexb/prg/libtool/c/../b/.libs/lib.al)
> (cd .libs/c.lax/lib.al && ln -s a.lo a.lo)
> ar cru .libs/c.al c.lo .libs/c.lax/lib.al/a.lo  .libs/c.lax/lib.al/b.lo
> ar: .libs/c.lax/lib.al/a.lo: Too many levels of symbolic links
> 
> --------
> 
> I think the problem is that libtool tries to extract the libraries in
> directories with the name of the library.
> But all libraries have the same name ...
> A solution would be to extract in directories which have names consisting
> of directory name and file name of the library. Then .libs/c.lax/a_lib.al
> and .libs/c.lax/b_lib.al would be used.
> 
> Alexander
> 
> _______________________________________________
> Bug-libtool mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-libtool

-- 
Robert Boehne             Software Engineer
Ricardo Software   Chicago Technical Center
TEL: (630)789-0003 x. 238
FAX: (630)789-0127
email:  address@hidden



reply via email to

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