bug-gzip
[Top][All Lists]
Advanced

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

gzip compilation failure on mingw


From: Bruno Haible
Subject: gzip compilation failure on mingw
Date: Mon, 11 Dec 2006 17:38:22 +0100
User-agent: KMail/1.9.1

Hi,

gzip-1.3.7, with the two Cygwin-cross patches of the previous mail applied,
still fails to compile on mingw:

$ ./configure --host=i386-pc-mingw32 --prefix=/cross/i386-pc-mingw 
CPPFLAGS=-Wall
$ make
...
i386-pc-mingw32-gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I./lib  -I./lib -Wall  -g 
-O2 -MT zip.o -MD -MP -MF .deps/zip.Tpo -c -o zip.o zip.c
In file included from zip.c:27:
tailor.h:126:1: warning: "STDC_HEADERS" redefined
In file included from zip.c:24:
./lib/config.h:360:1: warning: this is the location of the previous definition
zip.c: In function `zip':
zip.c:69: error: invalid use of undefined type `struct timespec'
zip.c:69: error: invalid use of undefined type `struct timespec'
zip.c:70: error: invalid use of undefined type `struct timespec'
make[1]: *** [zip.o] Fehler 1

This fixes it. (The patch to gzip.c is not strictly needed, since timespec.h
is included by stat-time.h, but since gzip.c uses timespec independently of
stat-time.h, it is more maintainable to explicitly include it.)

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

        * zip.c: Include timespec.h.
        * gzip.c: Likewise.

*** zip.c.bak   2006-11-20 09:40:34.000000000 +0100
--- zip.c       2006-12-11 01:03:35.000000000 +0100
***************
*** 27,32 ****
--- 27,33 ----
  #include "tailor.h"
  #include "gzip.h"
  #include "crypt.h"
+ #include "timespec.h"
  
  #ifdef HAVE_UNISTD_H
  #  include <unistd.h>
*** gzip.c.bak  2006-12-07 07:58:13.000000000 +0100
--- gzip.c      2006-12-11 01:03:25.000000000 +0100
***************
*** 72,77 ****
--- 72,78 ----
  #include "fcntl-safer.h"
  #include "getopt.h"
  #include "stat-time.h"
+ #include "timespec.h"
  
                /* configuration */
  


After this patch, the compilation still fails like this:

gzip.c: In function `copy_stat':
gzip.c:1656: warning: implicit declaration of function `chown'
...
i386-pc-mingw32-gcc -std=gnu99  -g -O2   -o gzip.exe 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 
gzip.o: In function `treat_file':
/dev/shm/gzip-1.3.7/gzip.c:1656: undefined reference to `chown'
make[1]: *** [gzip.exe] Fehler 1

This fixes it for me.


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

        * configure.ac: Add test for chown function.
        * gzip.c (treat_file): Test HAVE_CHOWN instead of NO_CHOWN.

*** gzip.c.bak  2006-12-11 01:03:25.000000000 +0100
--- gzip.c      2006-12-11 01:15:27.000000000 +0100
***************
*** 1649,1660 ****
        }
  #endif
  
! #ifndef NO_CHOWN
! # if HAVE_FCHOWN
      fchown (ofd, ifstat->st_uid, ifstat->st_gid);  /* Copy ownership */
! # else
      chown(ofname, ifstat->st_uid, ifstat->st_gid);  /* Copy ownership */
- # endif
  #endif
  
      /* Copy the protection modes */
--- 1649,1658 ----
        }
  #endif
  
! #if HAVE_FCHOWN
      fchown (ofd, ifstat->st_uid, ifstat->st_gid);  /* Copy ownership */
! #elif HAVE_CHOWN
      chown(ofname, ifstat->st_uid, ifstat->st_gid);  /* Copy ownership */
  #endif
  
      /* Copy the protection modes */
*** configure.ac.bak    2006-12-10 23:01:08.000000000 +0100
--- configure.ac        2006-12-11 01:09:42.000000000 +0100
***************
*** 83,89 ****
  AC_C_CONST
  AC_HEADER_STDC
  AC_CHECK_HEADERS_ONCE(fcntl.h limits.h memory.h time.h)
! AC_CHECK_FUNCS_ONCE([fchmod fchown fdopendir lstat siginterrupt])
  AC_HEADER_DIRENT
  AC_TYPE_SIGNAL
  AC_TYPE_SIZE_T
--- 83,89 ----
  AC_C_CONST
  AC_HEADER_STDC
  AC_CHECK_HEADERS_ONCE(fcntl.h limits.h memory.h time.h)
! AC_CHECK_FUNCS_ONCE([chown fchmod fchown fdopendir lstat siginterrupt])
  AC_HEADER_DIRENT
  AC_TYPE_SIGNAL
  AC_TYPE_SIZE_T
*** vms/Makefile.mms.bak        1993-06-22 17:45:25.000000000 +0200
--- vms/Makefile.mms    2006-12-11 01:13:56.000000000 +0100
***************
*** 52,58 ****
  # -DNO_SYMLINK          OS defines S_IFLNK but does not support symbolic links
  # -DNO_MULTIPLE_DOTS    System does not allow file names with multiple dots
  # -DNO_UTIME          System does not support setting file modification time
! # -DNO_CHOWN          System does not support setting file owner
  # -DNO_DIR            System does not support readdir()
  # -DPROTO             Force function prototypes even if __STDC__ not defined
  # -DASMV              Use asm version match.S
--- 52,58 ----
  # -DNO_SYMLINK          OS defines S_IFLNK but does not support symbolic links
  # -DNO_MULTIPLE_DOTS    System does not allow file names with multiple dots
  # -DNO_UTIME          System does not support setting file modification time
! # -DHAVE_CHOWN                System supports setting file owner
  # -DNO_DIR            System does not support readdir()
  # -DPROTO             Force function prototypes even if __STDC__ not defined
  # -DASMV              Use asm version match.S
*** vms/Makefile.vms.bak        1993-06-22 17:44:48.000000000 +0200
--- vms/Makefile.vms    2006-12-11 01:13:46.000000000 +0100
***************
*** 51,57 ****
  # -DNO_SYMLINK          OS defines S_IFLNK but does not support symbolic links
  # -DNO_MULTIPLE_DOTS    System does not allow file names with multiple dots
  # -DNO_UTIME          System does not support setting file modification time
! # -DNO_CHOWN          System does not support setting file owner
  # -DNO_DIR            System does not support readdir()
  # -DPROTO             Force function prototypes even if __STDC__ not defined
  # -DASMV              Use asm version match.S
--- 51,57 ----
  # -DNO_SYMLINK          OS defines S_IFLNK but does not support symbolic links
  # -DNO_MULTIPLE_DOTS    System does not allow file names with multiple dots
  # -DNO_UTIME          System does not support setting file modification time
! # -DHAVE_CHOWN                System supports setting file owner
  # -DNO_DIR            System does not support readdir()
  # -DPROTO             Force function prototypes even if __STDC__ not defined
  # -DASMV              Use asm version match.S
*** vms/Makefile.gcc.bak        1993-06-22 17:45:42.000000000 +0200
--- vms/Makefile.gcc    2006-12-11 01:13:30.000000000 +0100
***************
*** 51,57 ****
  # -DNO_SYMLINK          OS defines S_IFLNK but does not support symbolic links
  # -DNO_MULTIPLE_DOTS    System does not allow file names with multiple dots
  # -DNO_UTIME          System does not support setting file modification time
! # -DNO_CHOWN          System does not support setting file owner
  # -DNO_DIR            System does not support readdir()
  # -DPROTO             Force function prototypes even if __STDC__ not defined
  # -DASMV              Use asm version match.S
--- 51,57 ----
  # -DNO_SYMLINK          OS defines S_IFLNK but does not support symbolic links
  # -DNO_MULTIPLE_DOTS    System does not allow file names with multiple dots
  # -DNO_UTIME          System does not support setting file modification time
! # -DHAVE_CHOWN                System supports setting file owner
  # -DNO_DIR            System does not support readdir()
  # -DPROTO             Force function prototypes even if __STDC__ not defined
  # -DASMV              Use asm version match.S




reply via email to

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