#5150 unix: tcl.h does not include sys/stat.h

obsolete: 8.5.13
open
5
2013-01-17
2012-12-24
rofl0r
No

tcl.h typedefs Tcl_StatBuf to struct stat/stat64 but does not include <sys/stat.h>

this leads to compilation error in tclCmdAH.c because the storage size of variables of type Tcl_StatBuf is unknown.

Discussion

1 2 3 .. 7 > >> (Page 1 of 7)
  • rofl0r
    rofl0r
    2012-12-24

    • assigned_to: nobody --> stwo
     
  • The unix-dependent includes come through tclUnixPort.h, included (through tclPort.h) by tclInt.h.
    So it is not as plain as a failure to include an obviously needed system header, but rather some ifdeffery that fails in this specific case (that I cannot reproduce). Any specific info re the OS and/or configure/-D flags ?

     
  • Please attach the Makefile generated by Tcl's configure in this environment.

     
  • rofl0r
    rofl0r
    2012-12-24

    tcl Makefile as generated on sabotage linux i386

     
    Attachments
  • rofl0r
    rofl0r
    2012-12-24

    here's the relevant header part in musl libc:
    http://git.musl-libc.org/cgit/musl/tree/include/sys/stat.h#n98

    i added -D_GNU_SOURCE to the CFLAGS when launching configure, so this part got visible.
    tcl.h takes the typedef struct stat64 Tcl_StatBuf route. however without seeing the macro in sys/stat.h this cannot succeed, because stat64 is only a macro.

     
  • So what ? Now your sys/stat.h is included, and stat64 gets mapped to stat, Tcl ends up needing a "struct stat" somewhere. I assume it is in <bits/stat.h> as in most unices, isn't it.

    To make this exchange more efficient, please provide the generated Makefile without any tweaks.
    Patching tcl.h or forcing CFLAGS sound brittle ; better fix the root problem in the configure logic.

     
  • Ok, just seen the attachment, sorry ;)

     
  • Still, there might be a side effect to -D_GNU_SOURCE. Please give the vanilla Makefile, the one lacking HAVE_SYS_STAT.

     
  • rofl0r
    rofl0r
    2012-12-24

    i never used any other Makefile
    adding -D_GNU_SOURCE to CFLAGS is something i automatically do always

    so it was not added specifically to circumvent some problems here.

    this is the exact Makefile that causes the build failure.

     
1 2 3 .. 7 > >> (Page 1 of 7)