bug-libtool
[Top][All Lists]
Advanced

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

libtool cannot handle libraries with the same name


From: Alexander Bluhm
Subject: libtool cannot handle libraries with the same name
Date: Fri, 27 Jul 2001 14:18:07 +0200
User-agent: Mutt/1.3.16i

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




reply via email to

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