Tcl Source Code

View Ticket
Login
Ticket UUID: b17928624849a2f3c93eb297c3a0f2884888e209
Title: tclZipfs.c Build Error on CentOS 6
Type: Bug Created on: 2020-06-18 21:26:47
Submitter: kjnash Assigned to: jan.nijtmans
Subsystem: 57. zlib Severity: Important
Priority: 5 Medium Last modified: 2020-06-21 17:13:41
Status: Closed Closed by: jan.nijtmans
Resolution: Fixed Closed on: 2020-06-21 17:13:41
Version: 8.7
Description:
Using CentOS 6 for a 64-bit build on x86_64.

When building 8.7a3 or more recent 8.7 versions, there is a bug when compiling generic/tclZipfs.c.  The following definition appears twice, in both generic/tclZipfs.c and compat/zlib/contrib/minizip/crypt.h -

    typedef unsigned long z_crc_t;

This definition was introduced in generic/tclZipfs.c in commit 3f67becca2 of 2018-11-15, and in compat/zlib/contrib/minizip/crypt.h in commit 25d73d803d of 2018-11-14.

A workaround on CentOS 6 is simply to comment out the second definition, but obviously this is not a general bugfix.

The compiler command and error message when building 8.7a3 are below.  I can provide the Makefile and config.status if this would help.

gcc -c -O2  -pipe  -Wall -Wwrite-strings -Wsign-compare -Wdeclaration-after-statement -Wpointer-arith -fPIC -DBUILD_tcl -I"." -I/local/transfers-no-bak/src/kerlin/.8.7/tcl8.7a3/unix -I/local/transfers-no-bak/src/kerlin/.8.7/tcl8.7a3/generic -I/local/transfers-no-bak/src/kerlin/.8.7/tcl8.7a3/libtommath -DPACKAGE_NAME=\"tcl\" -DPACKAGE_TARNAME=\"tcl\" -DPACKAGE_VERSION=\"8.7\" -DPACKAGE_STRING=\"tcl\ 8.7\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STDBOOL_H=1 -DHAVE_SYS_PARAM_H=1 -DTCL_CFGVAL_ENCODING=\"iso8859-1\" -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_PTHREAD_ATFORK=1 -DHAVE_DECL_PTHREAD_MUTEX_RECURSIVE=1 -DHAVE_ZLIB=1 -DMODULE_SCOPE=extern\ __attribute__\(\(__visibility__\(\"hidden\"\)\)\) -DHAVE_HIDDEN=1 -DHAVE_CAST_TO_UNION=1 -DTCL_SHLIB_EXT=\".so\" -DNDEBUG=1 -DTCL_CFG_OPTIMIZED=1 -DMP_PREC=4 -D_LARGEFILE64_SOURCE=1 -DMP_32BIT=1 -DTCL_WIDE_INT_IS_LONG=1 -DHAVE_GETCWD=1 -DHAVE_MKSTEMP=1 -DHAVE_OPENDIR=1 -DHAVE_STRTOL=1 -DHAVE_WAITPID=1 -DHAVE_GETNAMEINFO=1 -DHAVE_GETADDRINFO=1 -DHAVE_FREEADDRINFO=1 -DHAVE_GAI_STRERROR=1 -DHAVE_STRUCT_ADDRINFO=1 -DHAVE_STRUCT_IN6_ADDR=1 -DHAVE_STRUCT_SOCKADDR_IN6=1 -DHAVE_STRUCT_SOCKADDR_STORAGE=1 -DHAVE_GETPWUID_R_5=1 -DHAVE_GETPWUID_R=1 -DHAVE_GETPWNAM_R_5=1 -DHAVE_GETPWNAM_R=1 -DHAVE_GETGRGID_R_5=1 -DHAVE_GETGRGID_R=1 -DHAVE_GETGRNAM_R_5=1 -DHAVE_GETGRNAM_R=1 -DHAVE_DECL_GETHOSTBYNAME_R=1 -DHAVE_GETHOSTBYNAME_R_6=1 -DHAVE_GETHOSTBYNAME_R=1 -DHAVE_DECL_GETHOSTBYADDR_R=1 -DHAVE_GETHOSTBYADDR_R_8=1 -DHAVE_GETHOSTBYADDR_R=1 -DHAVE_TERMIOS_H=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_EPOLL_H=1 -DNOTIFIER_EPOLL=1 -DHAVE_SYS_EVENTFD_H=1 -DHAVE_EVENTFD=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_GMTIME_R=1 -DHAVE_LOCALTIME_R=1 -DHAVE_MKTIME=1 -DHAVE_TM_GMTOFF=1 -DHAVE_TIMEZONE_VAR=1 -DHAVE_STRUCT_STAT_ST_BLOCKS=1 -DHAVE_STRUCT_STAT_ST_BLKSIZE=1 -DHAVE_BLKCNT_T=1 -DHAVE_INTPTR_T=1 -DHAVE_UINTPTR_T=1 -DHAVE_SIGNED_CHAR=1 -DHAVE_LANGINFO=1 -DHAVE_CFMAKERAW=1 -DHAVE_MKSTEMPS=1 -DHAVE_SYS_IOCTL_H=1 -DTCL_UNLOAD_DLLS=1 -DZIPFS_BUILD=1 -DHAVE_CPUID=1      -DMP_FIXED_CUTOFFS -DMP_NO_STDINT -DMP_WUR= \
                -DCFG_RUNTIME_DLLFILE="\"libtcl8.7.so\"" \
                -DCFG_RUNTIME_ZIPFILE="\"libtcl_8_7_a3.zip\"" \
                -DCFG_RUNTIME_LIBDIR="\"/usr/local/tcl8.7a3/lib\"" \
                -DCFG_RUNTIME_SCRDIR="\"/usr/local/tcl8.7a3/lib/tcl8.7\"" \
                 -I/local/transfers-no-bak/src/kerlin/.8.7/tcl8.7a3/compat/zlib/contrib/minizip \
                /local/transfers-no-bak/src/kerlin/.8.7/tcl8.7a3/generic/tclZipfs.c
/local/transfers-no-bak/src/kerlin/.8.7/tcl8.7a3/generic/tclZipfs.c:298: error: redefinition of typedef ‘z_crc_t’
/local/transfers-no-bak/src/kerlin/.8.7/tcl8.7a3/compat/zlib/contrib/minizip/crypt.h:35: note: previous declaration of ‘z_crc_t’ was here
make: *** [tclZipfs.o] Error 1
User Comments:
jan.nijtmans added on 2020-06-19 09:53:12:

Suggested fix here: [0e3a851a751ecd32].

Thanks for the report. The z_crc_t typedef is supposed to happen in zconf.h. But because Tcl might be compiled with older zlib header, it might be that this older header doesn't know about z_crc_t. The only way out I see is use our own "zconf.h" here, then we can remove the duplicate typedefs in other places. Additional advantage: since crc32.h is now available for the build, there is no need any more to duplicate the crc32 table in tclZipfs.c

Thanks for the report!


kjnash (claiming to be [email protected]) added on 2020-06-19 18:08:54:
Hi Jan, Many thanks for the quick response.  The fixed version builds correctly on CentOS 6 and passes all the zipfs.test tests.

Thanks again,
Keith.

jan.nijtmans added on 2020-06-21 17:13:41:

Merge to 8.7 and trunk now.

Thanks for the report.