Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#4177 AIX: compile error

obsolete: 8.5.5
closed-fixed
Jan Nijtmans
5
2012-02-16
2008-11-07
Christoph Bauer
No

The following compile error occurs on AIX for tcl-8.5.5:

...
checking for struct dirent64... no
checking for struct stat64... yes
checking for struct stat.st_blksize... yes
checking for fstatfs... yes
...

/usr/vac/bin/cc -c -O -O -D_LARGE_FILES -I/T/tcl_tk/8.5.5/binaries/ibmaix5/include -I"." -I/projekte/backup/tcl_tk/8.5.5/build/ibmaix5/tcl/tcl8.5.5/unix/../unix -I/projekte/backup/tcl_tk/8.5.5/build/ibmaix5/tcl/tcl8.5.5/unix/../generic -I/projekte/backup/tcl_tk/8.5.5/build/ibmaix5/tcl/tcl8.5.5/unix/../libtommath -DPACKAGE_NAME=\"tcl\" -DPACKAGE_TARNAME=\"tcl\" -DPACKAGE_VERSION=\"8.5\" -DPACKAGE_STRING=\"tcl\ 8.5\" -DPACKAGE_BUGREPORT=\"\" -Dinline=__inline__ -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_LIMITS_H=1 -DHAVE_SYS_PARAM_H=1 -DTCL_CFGVAL_ENCODING=\"iso8859-1\" -DUSE_DELTA_FOR_TZ=1 -DTCL_SHLIB_EXT=\".so\" -DTCL_CFG_OPTIMIZED=1 -DTCL_CFG_DEBUG=1 -DTCL_TOMMATH=1 -DMP_PREC=4 -DTCL_WIDE_INT_TYPE=__int64 -DHAVE_STRUCT_STAT64=1 -DHAVE_OPEN64=1 -DHAVE_LSEEK64=1 -DHAVE_TYPE_OFF64_T=1 -DWORDS_BIGENDIAN=1 -DHAVE_GETCWD=1 -DHAVE_OPENDIR=1 -DHAVE_STRTOL=1 -DHAVE_WAITPID=1 -DHAVE_GETADDRINFO=1 -DUSE_TERMIOS=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_TZNAME=1 -DHAVE_GMTIME_R=1 -DHAVE_LOCALTIME_R=1 -DHAVE_MKTIME=1 -DHAVE_TIMEZONE_VAR=1 -DHAVE_STRUCT_STAT_ST_BLKSIZE=1 -DHAVE_ST_BLKSIZE=1 -DHAVE_INTPTR_T=1 -DHAVE_UINTPTR_T=1 -DNO_UNION_WAIT=1 -D__CHAR_UNSIGNED__=1 -DHAVE_SIGNED_CHAR=1 -DHAVE_LANGINFO=1 -DNO_ISNAN=1 -DHAVE_SYS_IOCTL_H=1 -DTCL_UNLOAD_DLLS=1 /projekte/backup/tcl_tk/8.5.5/build/ibmaix5/tcl/tcl8.5.5/unix/../generic/tclIOUtil.c
"/projekte/backup/tcl_tk/8.5.5/build/ibmaix5/tcl/tcl8.5.5/unix/../generic/tclIOUtil.c", line 63.1: 1506-343 (S) Redeclaration of Tcl_Stat differs from previous declaration on line 2258 of "/projekte/backup/tcl_tk/8.5.5/build/ibmaix5/tcl/tcl8.5.5/unix/../generic/tclDecls.h".
"/projekte/backup/tcl_tk/8.5.5/build/ibmaix5/tcl/tcl8.5.5/unix/../generic/tclIOUtil.c", line 63.1: 1506-377 (I) The type "struct stat64*" of parameter 2 differs from the previous type "struct stat*".

Discussion

  • How is the definition of 'struct stat' differing between the two locations?! Or is it not defined at all in one of them??

     
  • The error is really strange. Previously I compiled Tcl 8.5.1 without this problem.

    The compiler is called with the define _LARGE_FILES and stat is in stat.h
    defined like this:

    #ifdef _LARGE_FILES
    #define stat stat64
    /* cutted */
    #endif /* _LARGE_FILES */

    So my first guess was, that somewhere stat is undefined (#undef stat), but grep doesn't reveal such a case.

     
  • The solution is: stat.h is included too late, i.e. after tclDecls.h.
    To prove my statement, I added

    #include <sys/stat.h>

    just before

    #include "tclInt.h"

    in tclIOUtil.c - and the file compiles.

     
  • Roy Keene
    Roy Keene
    2012-02-14

    I have confirmed that this issue (or a similar one) still exists on Fossil trunk tip. This is tickled when compiling for Android.

    The issue is that the autoconf test for "(struct stat64)" includes <sys/stat.h> but the usage (in generic/tcl.h) does not. This can be fixed easily by adding:

    # ifdef HAVE_SYS_STAT_H
    # include <sys/stat.h>
    # endif

    before

    typedef struct stat64 Tcl_StatBuf;

    Patch against current Fossil trunk tip available at: http://www.rkeene.org/tmp/Tcl_Source_Code-e7b4aca82756056a-bug2233954.diff

     
  • Jan Nijtmans
    Jan Nijtmans
    2012-02-16

    Cannot reproduce this, but I can imagine that on
    some platforms <sys/stat.h> might contain
    something like (depending on some compiler flags)
    #define stat stat64

    That will result in "struct stat" to mean something
    different before and after the #include <sys/stat.h>,
    which explains this problem. Since tclIOUtil has
    the Tcl_Stat() function implementation pairing
    with the declaration in tclDecls.h, this is the
    only file affected by this problem. The suggested
    solution is therefore harmless.

    Committed to core-8-5-branch and trunk

     
  • Jan Nijtmans
    Jan Nijtmans
    2012-02-16

    • assigned_to: stwo --> nijtmans
    • status: open --> closed-fixed