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.
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 ?
this was experienced using musl libc 0.9.8 on i386
since musl always uses LARGEFILE64, it #defines stat64 stat
Please attach the Makefile generated by Tcl's configure in this environment.
tcl Makefile as generated on sabotage linux i386
here's the relevant header part in musl libc:
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.
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.