bug-gzip
[Top][All Lists]
Advanced

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

gzip-1.3.6 compilation failure on MacOS X


From: Bruno Haible
Subject: gzip-1.3.6 compilation failure on MacOS X
Date: Wed, 6 Dec 2006 19:02:42 +0100

Hi,

On MacOS X 10.3.9 (PowerPC), gzip-1.3.6 fails to build like this:
$ make
...
gcc -std=gnu99  -g -O2   -o gzip bits.o crypt.o deflate.o gzip.o inflate.o lzw.o trees.o unlzh.o unlzw.o unpack.o unzip.o util.o zip.o lib/libgzip.a
ld: Undefined symbols:
_longest_match
_match_init
make[1]: *** [gzip] Error 1
make: *** [all-recursive] Error 1

deflate.o requires longest_match and match_init, but they are not defined anywhere.
It does this because lib/config.h defines ASMV.

The problem occurred at configuration time:

checking for assembler... yes

Here's the code from configure.ac:

# Try to assemble match.S.
# "gcc -E match.s" ignores -E, so we must use match.S. 
AC_CACHE_CHECK([for assembler], [gzip_cv_assembler],
  [gzip_cv_assembler=no
   case " $DEFS " in
   *' NO_ASM '*) ;;
   *)
     if cp $srcdir/lib/match.c _match.S &&
        eval "$ASCPP _match.S > _match.s 2>/dev/null"; then
       if test ! -s _match.s || grep error < _match.s > /dev/null; then
         :
       elif eval "$CC -c _match.s >/dev/null 2>&1" &&
            test -f _match.$OBJEXT; then
         gzip_cv_assembler=yes
       fi
     fi
     rm -f _match.S _match.s _match.$OBJEXT;;
   esac])
if test $gzip_cv_assembler = yes; then
  AC_DEFINE(ASMV, ,
    [Define if an assembler version of longest_match is available.])

The generated _match.s looks like this:

# 1 "_match.S"
#pragma GCC set_debug_pwd "/Users/bruno/data/work/gzip-1.3.6"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "_match.S"

As you can see, it doesn't contain the keyword 'error'. The reason is that the MacOS X
file system is case insensitive, hence the command
   $ASCPP _match.S > _match.s
overwrote its own input file.

Here is a fix, using 'match.s' instead of '_match.s'.

2006-12-05  Bruno Haible  <address@hidden>

        Fix build failure on case-insensitive file systems.
        * configure.ac: Use match.s instead of _match.s.
        * Makefile.am (MOSTLYCLEANFILES): Remove match.s instead of _match.s.
        * lib/Makefile.am (match.$(OBJEXT)): Use match.s instead of _match.s.
        (MOSTLYCLEANFILES): Remove match.s instead of _match.s.

*** configure.ac.bak    Mon Nov 20 09:40:33 2006
--- configure.ac        Tue Dec  5 17:47:16 2006
***************
*** 59,73 ****
     *' NO_ASM '*) ;;
     *)
       if cp $srcdir/lib/match.c _match.S &&
!         eval "$ASCPP _match.S > _match.s 2>/dev/null"; then
!        if test ! -s _match.s || grep error < _match.s > /dev/null; then
         :
!        elif eval "$CC -c _match.s >/dev/null 2>&1" &&
!           test -f _match.$OBJEXT; then
         gzip_cv_assembler=yes
         fi
       fi
!      rm -f _match.S _match.s _match.$OBJEXT;;
     esac])
  if test $gzip_cv_assembler = yes; then
    AC_DEFINE(ASMV, ,
--- 59,73 ----
     *' NO_ASM '*) ;;
     *)
       if cp $srcdir/lib/match.c _match.S &&
!         eval "$ASCPP _match.S > match.s 2>/dev/null"; then
!        if test ! -s match.s || grep error < match.s > /dev/null; then
         :
!        elif eval "$CC -c match.s >/dev/null 2>&1" &&
!           test -f match.$OBJEXT; then
         gzip_cv_assembler=yes
         fi
       fi
!      rm -f _match.S match.s match.$OBJEXT;;
     esac])
  if test $gzip_cv_assembler = yes; then
    AC_DEFINE(ASMV, ,
*** Makefile.am.bak     Mon Nov 20 09:40:33 2006
--- Makefile.am Tue Dec  5 17:47:23 2006
***************
*** 98,101 ****
 
  MAINTAINERCLEANFILES = gzip.doc
 
! MOSTLYCLEANFILES = _match.s _match.S gzexe zdiff zforce zgrep zless zmore znew
--- 98,101 ----
 
  MAINTAINERCLEANFILES = gzip.doc
 
! MOSTLYCLEANFILES = match.s _match.S gzexe zdiff zforce zgrep zless zmore znew
*** lib/Makefile.am.bak Mon Nov 20 09:40:34 2006
--- lib/Makefile.am     Tue Dec  5 17:48:13 2006
***************
*** 27,35 ****
 
  match.$(OBJEXT): match.c
        cp $(srcdir)/match.c _match.S
!       $(ASCPP) _match.S >_match.s
!       $(CC) -c $(CFLAGS) _match.s
!       mv _match.$(OBJEXT) match.$(OBJEXT)
!       rm -f _match.S _match.s
 
! MOSTLYCLEANFILES += _match.S _match.s
--- 27,34 ----
 
  match.$(OBJEXT): match.c
        cp $(srcdir)/match.c _match.S
!       $(ASCPP) _match.S > match.s
!       $(CC) -c $(CFLAGS) match.s
!       rm -f _match.S match.s
 
! MOSTLYCLEANFILES += _match.S match.s

Attachment: gzip-fail.txt
Description: gzip-fail.txt


reply via email to

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