padsp.c: does not build with _TIME_BITS=64 (and thus pulseaudio is not Y2038 compatible)
When '-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64' are added to build flags, per glibc recommendation for using 64 bit time on 32 bit systems[1], the following happens:
| In file included from /srv/storage/alex/yocto/build-32-y2038/tmp/work/core2-32-poky-linux/pulseaudio/16.1-r0/recipe-sysroot/usr/include/features.h:393,
| from /srv/storage/alex/yocto/build-32-y2038/tmp/work/core2-32-poky-linux/pulseaudio/16.1-r0/recipe-sysroot/usr/include/endian.h:21,
| from /srv/storage/alex/yocto/build-32-y2038/tmp/work/core2-32-poky-linux/pulseaudio/16.1-r0/recipe-sysroot/usr/include/linux/soundcard.h:43,
| from /srv/storage/alex/yocto/build-32-y2038/tmp/work/core2-32-poky-linux/pulseaudio/16.1-r0/recipe-sysroot/usr/include/sys/soundcard.h:1,
| from ../pulseaudio-16.1/src/utils/padsp.c:33:
| /srv/storage/alex/yocto/build-32-y2038/tmp/work/core2-32-poky-linux/pulseaudio/16.1-r0/recipe-sysroot/usr/include/features-time64.h:26:5: error: #error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
| 26 | # error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
| | ^~~~~
Looking at the source file, there is:
#ifdef _FILE_OFFSET_BITS
#undef _FILE_OFFSET_BITS
#endif
#ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE64_SOURCE 1
#endif
which has been there from the start (2006 I think), but isn't anymore correct: it's fine to use standard functions without 64 bit suffixes if _FILE_OFFSET_BITS is set to 64.
[1] https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html#index-_005fTIME_005fBITS
Edited by Alexander Kanavin