[tlbuild] build failure: texk/web2c/configure.ac tests for stat64 function but not for "struct stat64"

Karl Berry karl at freefriends.org
Mon May 31 20:19:35 CEST 2010


    which results in "#define HAVE_STAT64 1" in Work/texk/web2c/c-auto.h
    but despite the presence of the stat64() function, neither it, nor the
    "struct stat64" is defined in the headers in the current build environment.
    (one would need to specially define some macros to enable this API. 

Yes, and that is true in general.

    since we're building 32-bit binaries, and there's no
    need for 64-bit I/O).

I agree.  And our sources are not prepared to deal with largefile
support.  Therefore I removed stat64 from the AC_CHECK_FUNCS in
web2c/configure.ac, so it will always be undefined.

The lua lfs.c was the only place in our source tree where stat64 was
used.  It still compiled fine for me without the test.

    it seems that for better portability, texk/web2c/configure.ac should
    also test whether the "struct stat64" is defined in <sys/stat.h>.

Rest is just for the archives ...

It seems that that is not so easy.  One has to define all the largefile
macros (I suppose), and I don't think we want to go that route, as
stated above.  At least, this autoconf test:

    AC_CHECK_TYPE(struct stat64,,
      [AC_DEFINE([HAVE_STRUCT_STAT64], 0,
                 [define if struct stat64 is usable])],
      [[#include <sys/stat.h>]])

failed on GNU/Linux (CentOS, tug.org) because struct stat64 was not
defined.  Specifically, the test amounts to this C code:

#include <sys/stat.h>
main()
{
  if (sizeof (struct stat64) > 0)
    puts ("yes");
  else
    puts ("no");
} /* well, configure works with exit value instead of puts, of course */

And it gets this error:
error: invalid application of 'sizeof' to incomplete type 'struct stat64'

Looking at the actual sys/stat.h file on GNU/Linux, it is far from
obvious how struct stat64 gets defined.  The only definition I could find
is in asm/stat.h, which I suppose gets included through a convoluted
sequence of other includes for different platforms, etc.  I gave it up
at that point, my curiousity wasn't that strong.

Thanks,
k


More information about the tlbuild mailing list