Subject: Re: bug#11306: Automake 1.11d on MacOS X

From: Bruno Haible <[email-masked]>
Date: Sun, 22 Apr 2012 20:10:21 +0200

Hi Stefano,

> > FAIL: t/lex-libobj
> > ==================
> 
> > + ./configure 'LEXLIB=-L /lib'
> > checking for a BSD-compatible install... /Users/bruno/data/local-macos/bin/install -c
> > ...
> > + make
> > cc -DPACKAGE_NAME=\"lex-libobj\" -DPACKAGE_TARNAME=\"lex-libobj\" ...
> > foo.c:1033: warning: 'yyunput' defined but not used
> > mv -f .deps/foo.Tpo .deps/foo.Po
> > cc -DPACKAGE_NAME=\"lex-libobj\" -DPACKAGE_TARNAME=\"lex-libobj\" ...
> > mv -f .deps/yywrap.Tpo .deps/yywrap.Po
> > cc  -g -O2   -o foo foo.o -L /lib yywrap.o 
> > ld: file not found: /lib
> > collect2: ld returned 1 exit status
> > make: *** [foo] Error 1
> > + exit_status=2
> > 
> > On this machine, /usr/bin/lex is a shell script that invokes /usr/bin/flex.
> > There is a /usr/lib/libfl.a.
> > Everything looks right up until the line
> >   ./configure 'LEXLIB=-L /lib'
> > I don't know how _adding_ a -L option to a compiler/linker command is meant
> > to hide a library that is installed in /usr/lib ??
> >
> Oh, it's not intended to work like that; simply, setting $LEXLIB to a non-empty
> value ensures that configure won't look for a "lex library", and simply rely on
> the $LEXLIB to provide it, if needed.  We could override $LEXLIB with any valid
> (list of) linker options.  Does the problem disappear if you use:
> 
>   ./configure LEXLIB='-L .'
> 
> instead?

Modifying a test apparently requires me to have the same exact Autoconf
version (2.68) as you did. What an annoyance! I have to proceed like this:

1. On a machine with autoconf 2.68:
   - Unpack a fresh automake-1.11d directory.
   $ ./configure; make                 # This is necessary to build 'automake'.
   - Then only! change t/lex-libobj.sh
   $ make                              # This uses the built 'automake'.
   $ make distclean
2. Copy this directory to the target machine (without autoconf 2.68).
3. $ ./configure; make
   $ make check TESTS=t/lex-libobj

Result: it still fails:

cc  -g -O2   -o foo foo.o -L . yywrap.o
ld: in ., can't map file, errno=22
collect2: ld returned 1 exit status
make: *** [foo] Error 1
+ exit_status=2
+ set +e
+ cd /Users/bruno/data/build/multibuild-2074/macosx/automake-1.11d
+ test no = yes
+ case $am_explicit_skips in
+ test 2 -eq 0
+ keep_testdirs=yes
+ am_keeping_testdirs
+ case $keep_testdirs in
+ return 0
+ set +x
lex-libobj: exit 2

But setting LEXLIB to just whitespace makes the test succeed:

diff -r -u automake-1.11d.orig/t/lex-libobj.sh automake-1.11d/t/lex-libobj.sh
--- automake-1.11d.orig/t/lex-libobj.sh	2012-04-13 17:44:41.000000000 +0200
+++ automake-1.11d/t/lex-libobj.sh	2012-04-22 20:01:27.000000000 +0200
@@ -68,7 +68,7 @@
 $MAKE distclean
 
 # Force "no system lex library".
-./configure LEXLIB='-L /lib'
+./configure LEXLIB=' '
 grep LIBOBJS Makefile # For debugging.
 grep '^LIBOBJS *=.*yywrap.*\.o' Makefile # Sanity check.
 $MAKE

> > Apparently, the "automake-1.11d ..." command [run with the AUTOMAKE_JOBS
> > environment variable set to a value > 1] got a bus error. It is a shell
> > script that runs perl (/usr/bin/perl, version 5.8.8).
> >
> I have tested automake with perl 5.8.8, 5.10.1, 5.12.4 and even perl 5.6.2,
> never seeing any error in these tests.  So it seems like an an issue with
> perl multithreading on your system.  Could you somehow verify whether this
> is truly the case?

How would I do this?

$ perl -V
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
    osname=darwin, osvers=9.0, archname=darwin-thread-multi-2level
    uname='darwin b04.apple.com 9.0 darwin kernel version 9.6.0: mon nov 24 17:37:00 pst 2008; root:xnu-1228.9.59~1release_i386 i386 '
    config_args='-ds -e -Dprefix=/usr -Dccflags=-g  -pipe  -Dldflags= -Dman3ext=3pm -Duseithreads -Duseshrplib'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=define use64bitall=define uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-arch ppc -arch i386 -g -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -Wdeclaration-after-statement -I/usr/local/include',
    optimize='-O3',
    cppflags='-no-cpp-precomp -arch ppc -g -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -Wdeclaration-after-statement -I/usr/local/include'
    ccversion='', gccversion='4.0.1 (Apple Inc. build 5465)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc -mmacosx-version-min=10.5.6', ldflags ='-arch ppc -arch i386 -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib
    libs=-ldbm -ldl -lm -lutil -lc
    perllibs=-ldl -lm -lutil -lc
    libc=/usr/lib/libc.dylib, so=dylib, useshrplib=true, libperl=libperl.dylib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-arch ppc -arch i386 -bundle -undefined dynamic_lookup -L/usr/local/lib'

Characteristics of this binary (from libperl): 
  Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT
                        PERL_MALLOC_WRAP USE_ITHREADS USE_LARGE_FILES
                        USE_PERLIO USE_REENTRANT_API
  Locally applied patches:
        fix for regcomp CVE-2007-5116 security vulnerability
        fix for double-free CVE-2008-1927 security vulnerability
        /Library/Perl/Updates/<version> comes before system perl directories
        installprivlib and installarchlib points to the Updates directory
  Built under darwin
  Compiled at Jan 27 2010 23:39:09
  %ENV:
    PERL5LIB="/sw/lib/perl5:/sw/lib/perl5/darwin"
  @INC:
    /sw/lib/perl5
    /sw/lib/perl5/darwin
    /Library/Perl/Updates/5.8.8
    /System/Library/Perl/5.8.8/darwin-thread-multi-2level
    /System/Library/Perl/5.8.8
    /Library/Perl/5.8.8/darwin-thread-multi-2level
    /Library/Perl/5.8.8
    /Library/Perl
    /Network/Library/Perl/5.8.8/darwin-thread-multi-2level
    /Network/Library/Perl/5.8.8
    /Network/Library/Perl
    /System/Library/Perl/Extras/5.8.8/darwin-thread-multi-2level
    /System/Library/Perl/Extras/5.8.8
    /Library/Perl/5.8.6
    /Library/Perl/5.8.1
    .

I don't know anything about Perl.

Bruno