[Top][All Lists]

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

Bug in libtoolize

From: Jeff Squyres
Subject: Bug in libtoolize
Date: Tue, 15 Feb 2005 19:13:50 -0500

I have found a bug in libtoolize which has bit me for a long, long time but I've never gotten around to checking it out (it was a minor annoyance). But today, it bit one of my other developers in a rather awkward moment. So I guess it's time to investigate and report this bug. :-)

The problem is with "libtoolize --copy --ltdl". libtoolize makes the subdirectory libltdl/ and copies all the relevant files over. However, the problem is that it simply globs the files from the source directory and then copies them over one-by-one. This can violate the strict ordering of files required by Automake and can cause needless re-building of files, even after a successful run of libltdl's "configure" script.

In my developer's case, the following happened:

libtoolize --copy --ltdl
cd libltdl
./configure .....
[configure runs successfully]
make -d

Here's the end of the output from "make -d":

     No need to remake target `'.
     Considering target file `aclocal.m4'.
       Pruning file `acinclude.m4'.
       Pruning file `'.
      Finished prerequisites of target file `aclocal.m4'.
      Prerequisite `acinclude.m4' is older than target `aclocal.m4'.
      Prerequisite `' is newer than target `aclocal.m4'.
     Must remake target `aclocal.m4'.
cd . && /bin/bash [/path/to]/libltdl/missing --run aclocal-1.8

Doh!  That shouldn't be!

Checking the fine-grained timestamps, we can see that yes, indeed, acinclude.m4 is older than aclocal.m4. So let's try a controlled experiment:

$ rm -rf libltdl
$ libtoolize --automake --copy --ltdl
$ cd libltdl/
$ /usr/local/gnu/bin/ls --full-time ac*
-rw-r--r-- 1 jsquyres lam 226073 2005-02-15 18:48:58.458929000 -0500 acinclude.m4 -rw-r--r-- 1 jsquyres lam 35379 2005-02-15 18:48:58.478986000 -0500 aclocal.m4


Looking in the code for libtoolize (v1.5.14), I see the following:

if test "x$ltdl" = xyes; then
  test -d libltdl || $mkdir libltdl
  ltdlfiles=`cd $pkgdatadir && ls libltdl/*`

for file in $ltdlfiles; do
  if test -f "$file" && test -z "$force"; then
test -z "$automake" && echo "$progname: \`$file' exists: use \`--force' to overwrite" 1>&2

  $rm $file
  if test -n "$ln_s" && $ln_s $pkgdatadir/$file $file; then :
  elif $cp $pkgdatadir/$file $file; then :
    echo "$progname: cannot copy \`$pkgdatadir/$file' to \`$file'" 1>&2

This quite definitely does not honor any ordering of the copy -- so the dependencies that Automake sets up in its Makefiles are potentially going to be violated (as it is in my case).

Some suggestions for a fix:

1. Do the copy as now, but then have a series of "touch" statements to modify the mtime/ctime all the relevant AM-specific files in the Right Order so that the timestamps will be proper.

2. Copy the files over in order in the first place (i.e., don't use a glob).

3. Tar up the source directory and untar it in the destination.

Each of the three has benefits and drawbacks -- I guess I'd lean towards #1. It's probably the least elegant, but it guarantees to get it Right with the least amount of work.


{+} Jeff Squyres
{+} address@hidden

reply via email to

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