Bug#1068251: glibc: FTBFS on 32-bit architectures due to GCC defaulting to 64-bit time_t
Hi, On 2024-04-09 07:56, Helmut Grohne wrote: > Hi Aurelien, > > On Mon, Apr 08, 2024 at 11:24:40PM +0200, Aurelien Jarno wrote: > > Thanks for you analysis and your patch. In short your proposal is to > > extend the initial patch from Steve to fully hide the fact that the > > compiler default to -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64. > > > > This indeed works and fixes the FTBFS. However it seems that, at least > > for some of the issues, it just hides them. For instance the wrong type > > for timeval.tv_usec, reported by Simon upstream [1], was detected by the > > conformance tests. Quoting utmpx.h/conform.out: > > I think this needs a more nuanced look. From the comments in the > conformance test suite, it is evident that it expects to be run without > _FILE_OFFSET_BITS and _TIME_BITS. Many of the symbols it requires to > exist only exist when these macros are unset. The conformance test suite > has a comment saying that it should be testing the case where > _FILE_OFFSET_BITS is defined, but it currently does not provide > expectations for that case. > > Before we can reasonably run the conformance test suite with these > macros set (and really, the test suite should be in control of these > macros), we cannot reasonably use it with them set. Let us now imagine a > future where the conformance test suite has been extended to provide > expectations (which in lots of cases means that *64 symbols disappear > when -D_FILE_OFFSET_BITS=64). Then what still remains is Simon's issue: > > > | /tmp/tmp98wzaavx/test.c:4:35: error: conflicting types for ‘b2_10’; have > > ‘__suseconds64_t’ {aka ‘long long int’} > > | 4 | extern __typeof__ (a2_10.tv_usec) b2_10; > > | | ^ > > | /tmp/tmp98wzaavx/test.c:3:20: note: previous declaration of ‘b2_10’ with > > type ‘suseconds_t’ {aka ‘long int’} > > | 3 | extern suseconds_t b2_10; > > | |^ > > | FAIL: Type of member tv_usec > > Indeed, this is not something that can easily be fixed and where > upstream is still debating on what the correct solution should be. It > also is an issue that existed for a long time. If you head over to a > bookworm glibc and enable -D_TIME_BITS=64 there, you'll also notice that > tv_usec and suseconds_t have different sizes. So yes, this is a bug, but > it is not one that is directly related to Debian changing the default. > We merely increased the visibility of this problem that existed earlier > already. I agree that this is an existing issue. My point there was mostly that your solution is just hiding a real issue that is found by the testsuite, and basically the testsuite runs in a different configuration than the one used on the system. We might just miss new issues for new upstream versions, which is not something very comfortable for a base library. > Given that > * the issue is already present in bookworm, > * there are two mutually exclusive solutions and > * upstream is still discussing the best solution > I recommend deferring this aspect. While the issue is already present in bookworm, it is not visible because the toolchain has different defaults. > > And we know it is the reason for the FTBFS of libflorist [2], so should > > we just ignore that issue anyway? > > The libflorist issue likely is a consequence. It arises from > gnat_to_gnu_field where GNAT verifies that the value (of type > suseconds_t) to be assigned to a field (tv_usec) has the matching size. > This is directly based on the POSIX expectation and will be fixed with > the glibc issue. > > How about filing a separate bug with glibc that tracks this POSIX > divergence and mark the libflorist bug as being blocked by this other > glibc bug? It can be RC or not, but since it affects bookworm, it won't > block testing migration. Yes we can do that. That said I am not sure we can claim the issue affects bookworm, as again the toolchain does not have the same defaults and therefore libflorist does not FTBFS in bookworm. Regards Aurelien -- Aurelien Jarno GPG: 4096R/1DDD8C9B aurel...@aurel32.net http://aurel32.net signature.asc Description: PGP signature
Bug#1068251: glibc: FTBFS on 32-bit architectures due to GCC defaulting to 64-bit time_t
Hi Aurelien, On Mon, Apr 08, 2024 at 11:24:40PM +0200, Aurelien Jarno wrote: > Thanks for you analysis and your patch. In short your proposal is to > extend the initial patch from Steve to fully hide the fact that the > compiler default to -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64. > > This indeed works and fixes the FTBFS. However it seems that, at least > for some of the issues, it just hides them. For instance the wrong type > for timeval.tv_usec, reported by Simon upstream [1], was detected by the > conformance tests. Quoting utmpx.h/conform.out: I think this needs a more nuanced look. From the comments in the conformance test suite, it is evident that it expects to be run without _FILE_OFFSET_BITS and _TIME_BITS. Many of the symbols it requires to exist only exist when these macros are unset. The conformance test suite has a comment saying that it should be testing the case where _FILE_OFFSET_BITS is defined, but it currently does not provide expectations for that case. Before we can reasonably run the conformance test suite with these macros set (and really, the test suite should be in control of these macros), we cannot reasonably use it with them set. Let us now imagine a future where the conformance test suite has been extended to provide expectations (which in lots of cases means that *64 symbols disappear when -D_FILE_OFFSET_BITS=64). Then what still remains is Simon's issue: > | /tmp/tmp98wzaavx/test.c:4:35: error: conflicting types for ‘b2_10’; have > ‘__suseconds64_t’ {aka ‘long long int’} > | 4 | extern __typeof__ (a2_10.tv_usec) b2_10; > | | ^ > | /tmp/tmp98wzaavx/test.c:3:20: note: previous declaration of ‘b2_10’ with > type ‘suseconds_t’ {aka ‘long int’} > | 3 | extern suseconds_t b2_10; > | |^ > | FAIL: Type of member tv_usec Indeed, this is not something that can easily be fixed and where upstream is still debating on what the correct solution should be. It also is an issue that existed for a long time. If you head over to a bookworm glibc and enable -D_TIME_BITS=64 there, you'll also notice that tv_usec and suseconds_t have different sizes. So yes, this is a bug, but it is not one that is directly related to Debian changing the default. We merely increased the visibility of this problem that existed earlier already. Given that * the issue is already present in bookworm, * there are two mutually exclusive solutions and * upstream is still discussing the best solution I recommend deferring this aspect. > And we know it is the reason for the FTBFS of libflorist [2], so should > we just ignore that issue anyway? The libflorist issue likely is a consequence. It arises from gnat_to_gnu_field where GNAT verifies that the value (of type suseconds_t) to be assigned to a field (tv_usec) has the matching size. This is directly based on the POSIX expectation and will be fixed with the glibc issue. How about filing a separate bug with glibc that tracks this POSIX divergence and mark the libflorist bug as being blocked by this other glibc bug? It can be RC or not, but since it affects bookworm, it won't block testing migration. Helmut
Bug#1068251: glibc: FTBFS on 32-bit architectures due to GCC defaulting to 64-bit time_t
Hi Helmut, On 2024-04-08 22:19, Helmut Grohne wrote: > Control: tags -1 + patch > > Hi Aurelien and Canonical folks, > > On Tue, Apr 02, 2024 at 08:53:31PM +0200, Aurelien Jarno wrote: > > Starting with gcc-12 version 12.3.0-15, -D_TIME_BITS=64 together with > > -D_FILE_OFFSET_BITS=64 are passed by default on 32-bit architectures > > except i386. > > > > This has been partially fixed in the 2.37-15.1 NMU by adding > > -U_TIME_BITS to CFLAGS, however it causes failures in the testsuite: > > There are two subtleties about -U_TIME_BITS in a moment. > > > | +-+ > > | | Encountered regressions that don't match expected failures. | > > | +-+ > > | FAIL: conform/ISO/stdio.h/linknamespace > > The detail for this failure is: > > | [initial] fgetpos64 > | [initial] fopen64 > | [initial] freopen64 > | [initial] fsetpos64 >| [initial] tmpfine64 > > What linknamespace.py wants to tell us here is that it expected > fgetpos64, but no fgetpos64 was declared. It was not declared, because > there is no difference between fgetpos and fgetpos64 after defining > -D_FILE_OFFSET_BITS=64 (which is also in the default compiler flags). > > The other failures are of very similar kind, but there also is another > kind. > > > | FAIL: conform/POSIX/sys/stat.h/conform > > The detail for this failure contains: > > | /tmp/tmpnzda_r9j/test.c:90:35: error: conflicting types for 'b2_8'; have > '__time64_t' {aka 'long long int'} > |90 | extern __typeof__ (a2_8.st_atime) b2_8; > | | ^~~~ > | /tmp/tmpnzda_r9j/test.c:89:17: note: previous declaration of 'b2_8' with > type '__time_t' {aka 'long int'} > |89 | extern __time_t b2_8; > | | ^~~~ > > Here, it tells us that it expected the st_atime field of struct stat to > have type __time_t (the 32 bit one), but it really has __time64_t. > > Looking at the invocation of linknamespace.py you can see: > > | python3 -B linknamespace.py --cc='arm-linux-gnueabihf-gcc-12' > --flags='-I../include > -I/build/reproducible-path/glibc-2.37/build-tree/armhf-libc > -I../sysdeps/unix/sysv/linux/arm/le -I../sysdeps/unix/sysv/linux/arm > -I../sysdeps/arm/nptl -I../sysdeps/unix/sysv/linux/include > -I../sysdeps/unix/sysv/linux -I../sysdeps/nptl -I../sysdeps/pthread > -I../sysdeps/gnu -I../sysdeps/unix/inet -I../sysdeps/unix/sysv > -I../sysdeps/unix/arm -I../sysdeps/unix -I../sysdeps/posix > -I../sysdeps/arm/le/armv7/multiarch -I../sysdeps/arm/armv7/multiarch > -I../sysdeps/arm/le/armv7 -I../sysdeps/arm/armv7 -I../sysdeps/arm/armv6t2 > -I../sysdeps/arm/armv6 -I../sysdeps/arm/le -I../sysdeps/arm/include > -I../sysdeps/arm -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/flt-32 > -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754 -I../sysdeps/generic > -nostdinc -isystem /usr/lib/gcc/arm-linux-gnueabihf/12/include -isystem > /build/reproducible-path/glibc-2.37/debian/include -I..' ... > > In particular, what you do not see is -U_TIME_BITS inside --flags. > > > Ubuntu has just ignored those failures for now, but I am just afraid > > that if we do the same, nobody will fix them. > > Armed with this knowledge, I think we need two changes. For one thing > debian/sysdeps/linux.mk needs to add -U_FILE_OFFSET_BITS to extra_cflags > to revert any possible ABI changing effects. For another, the > conformance tests use independent compiler flags defined in > conform/Makefile. There, a naive patch seems to be: > > -conformtest-cc-flags = -I../include $(+sysdep-includes) $(sysincludes) -I.. > +conformtest-cc-flags = -U_FILE_OFFSET_BITS -U_TIME_BITS -I../include > $(+sysdep-includes) $(sysincludes) -I.. > > With these two changes, I am able to successfully build glibc on armhf > with the conformance test suite passing. > > > In addition it means that upstream glibc does not build anymore by > > default on a 32-bit Debian. Not really a Debian issue, but that is not > > nice either and should probably be fixed. > > I think that latter change may be applicable upstream. Running the > conformance test suite with either _FILE_OFFSET_BITS or _TIME_BITS set > is not expected nor supported. This is partially evident from > conform/linknamespace.py in a comment: > > | # * Header inclusions should be compiled several times with > | # different options such as -O2, -D_FORTIFY_SOURCE and > | # -D_FILE_OFFSET_BITS=64 to find out what symbols are undefined > | # from such a compilation; this is not yet implemented. > > The conformance test suite clearly wants to manage these macros (and its > effects on symbols) explicitly and does not expect them to be > pre-defined. Thanks for you analysis and your patch. In short your proposal is to extend the initial patch from Steve to fully hide the fact that the compiler default to -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64. This
Bug#1068251: glibc: FTBFS on 32-bit architectures due to GCC defaulting to 64-bit time_t
Control: tags -1 + patch Hi Aurelien and Canonical folks, On Tue, Apr 02, 2024 at 08:53:31PM +0200, Aurelien Jarno wrote: > Starting with gcc-12 version 12.3.0-15, -D_TIME_BITS=64 together with > -D_FILE_OFFSET_BITS=64 are passed by default on 32-bit architectures > except i386. > > This has been partially fixed in the 2.37-15.1 NMU by adding > -U_TIME_BITS to CFLAGS, however it causes failures in the testsuite: There are two subtleties about -U_TIME_BITS in a moment. > | +-+ > | | Encountered regressions that don't match expected failures. | > | +-+ > | FAIL: conform/ISO/stdio.h/linknamespace The detail for this failure is: | [initial] fgetpos64 | [initial] fopen64 | [initial] freopen64 | [initial] fsetpos64 | [initial] tmpfile64 What linknamespace.py wants to tell us here is that it expected fgetpos64, but no fgetpos64 was declared. It was not declared, because there is no difference between fgetpos and fgetpos64 after defining -D_FILE_OFFSET_BITS=64 (which is also in the default compiler flags). The other failures are of very similar kind, but there also is another kind. > | FAIL: conform/POSIX/sys/stat.h/conform The detail for this failure contains: | /tmp/tmpnzda_r9j/test.c:90:35: error: conflicting types for 'b2_8'; have '__time64_t' {aka 'long long int'} |90 | extern __typeof__ (a2_8.st_atime) b2_8; | | ^~~~ | /tmp/tmpnzda_r9j/test.c:89:17: note: previous declaration of 'b2_8' with type '__time_t' {aka 'long int'} |89 | extern __time_t b2_8; | | ^~~~ Here, it tells us that it expected the st_atime field of struct stat to have type __time_t (the 32 bit one), but it really has __time64_t. Looking at the invocation of linknamespace.py you can see: | python3 -B linknamespace.py --cc='arm-linux-gnueabihf-gcc-12' --flags='-I../include -I/build/reproducible-path/glibc-2.37/build-tree/armhf-libc -I../sysdeps/unix/sysv/linux/arm/le -I../sysdeps/unix/sysv/linux/arm -I../sysdeps/arm/nptl -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux -I../sysdeps/nptl -I../sysdeps/pthread -I../sysdeps/gnu -I../sysdeps/unix/inet -I../sysdeps/unix/sysv -I../sysdeps/unix/arm -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/arm/le/armv7/multiarch -I../sysdeps/arm/armv7/multiarch -I../sysdeps/arm/le/armv7 -I../sysdeps/arm/armv7 -I../sysdeps/arm/armv6t2 -I../sysdeps/arm/armv6 -I../sysdeps/arm/le -I../sysdeps/arm/include -I../sysdeps/arm -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754 -I../sysdeps/generic -nostdinc -isystem /usr/lib/gcc/arm-linux-gnueabihf/12/include -isystem /build/reproducible-path/glibc-2.37/debian/include -I..' ... In particular, what you do not see is -U_TIME_BITS inside --flags. > Ubuntu has just ignored those failures for now, but I am just afraid > that if we do the same, nobody will fix them. Armed with this knowledge, I think we need two changes. For one thing debian/sysdeps/linux.mk needs to add -U_FILE_OFFSET_BITS to extra_cflags to revert any possible ABI changing effects. For another, the conformance tests use independent compiler flags defined in conform/Makefile. There, a naive patch seems to be: -conformtest-cc-flags = -I../include $(+sysdep-includes) $(sysincludes) -I.. +conformtest-cc-flags = -U_FILE_OFFSET_BITS -U_TIME_BITS -I../include $(+sysdep-includes) $(sysincludes) -I.. With these two changes, I am able to successfully build glibc on armhf with the conformance test suite passing. > In addition it means that upstream glibc does not build anymore by > default on a 32-bit Debian. Not really a Debian issue, but that is not > nice either and should probably be fixed. I think that latter change may be applicable upstream. Running the conformance test suite with either _FILE_OFFSET_BITS or _TIME_BITS set is not expected nor supported. This is partially evident from conform/linknamespace.py in a comment: | # * Header inclusions should be compiled several times with | # different options such as -O2, -D_FORTIFY_SOURCE and | # -D_FILE_OFFSET_BITS=64 to find out what symbols are undefined | # from such a compilation; this is not yet implemented. The conformance test suite clearly wants to manage these macros (and its effects on symbols) explicitly and does not expect them to be pre-defined. Hope this helps Helmut
Processed: Re: Bug#1068251: glibc: FTBFS on 32-bit architectures due to GCC defaulting to 64-bit time_t
Processing control commands: > tags -1 + patch Bug #1068251 [src:glibc] glibc: FTBFS on 32-bit architectures due to GCC defaulting to 64-bit time_t Added tag(s) patch. -- 1068251: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1068251 Debian Bug Tracking System Contact ow...@bugs.debian.org with problems
Bug#1068251: glibc: FTBFS on 32-bit architectures due to GCC defaulting to 64-bit time_t
Source: glibc Version: 2.37-15.1 Severity: serious Tags: ftbfs Justification: fails to build from source (but built successfully in the past) X-Debbugs-Cc: debian-...@lists.debian.org Starting with gcc-12 version 12.3.0-15, -D_TIME_BITS=64 together with -D_FILE_OFFSET_BITS=64 are passed by default on 32-bit architectures except i386. This has been partially fixed in the 2.37-15.1 NMU by adding -U_TIME_BITS to CFLAGS, however it causes failures in the testsuite: | +-+ | | Encountered regressions that don't match expected failures. | | +-+ | FAIL: conform/ISO/stdio.h/linknamespace | FAIL: conform/ISO11/stdio.h/linknamespace | FAIL: conform/ISO99/stdio.h/linknamespace | FAIL: conform/POSIX/aio.h/linknamespace | FAIL: conform/POSIX/dirent.h/linknamespace | FAIL: conform/POSIX/fcntl.h/conform | FAIL: conform/POSIX/fcntl.h/linknamespace | FAIL: conform/POSIX/glob.h/conform | FAIL: conform/POSIX/mqueue.h/conform | FAIL: conform/POSIX/mqueue.h/linknamespace | FAIL: conform/POSIX/stdio.h/linknamespace | FAIL: conform/POSIX/sys/mman.h/linknamespace | FAIL: conform/POSIX/sys/stat.h/conform | FAIL: conform/POSIX/unistd.h/conform | FAIL: conform/POSIX/unistd.h/linknamespace | FAIL: conform/POSIX/utime.h/conform | FAIL: conform/POSIX2008/aio.h/linknamespace | FAIL: conform/POSIX2008/dirent.h/linknamespace | FAIL: conform/POSIX2008/fcntl.h/conform | FAIL: conform/POSIX2008/fcntl.h/linknamespace | FAIL: conform/POSIX2008/glob.h/conform | FAIL: conform/POSIX2008/mqueue.h/conform | FAIL: conform/POSIX2008/mqueue.h/linknamespace | FAIL: conform/POSIX2008/signal.h/conform | FAIL: conform/POSIX2008/stdio.h/linknamespace | FAIL: conform/POSIX2008/stdlib.h/linknamespace | FAIL: conform/POSIX2008/sys/mman.h/linknamespace | FAIL: conform/POSIX2008/sys/select.h/conform | FAIL: conform/POSIX2008/sys/stat.h/conform | FAIL: conform/POSIX2008/sys/statvfs.h/linknamespace | FAIL: conform/POSIX2008/unistd.h/linknamespace | FAIL: conform/UNIX98/aio.h/linknamespace | FAIL: conform/UNIX98/dirent.h/linknamespace | FAIL: conform/UNIX98/fcntl.h/conform | FAIL: conform/UNIX98/fcntl.h/linknamespace | FAIL: conform/UNIX98/glob.h/conform | FAIL: conform/UNIX98/mqueue.h/conform | FAIL: conform/UNIX98/mqueue.h/linknamespace | FAIL: conform/UNIX98/stdio.h/linknamespace | FAIL: conform/UNIX98/stdlib.h/linknamespace | FAIL: conform/UNIX98/sys/mman.h/linknamespace | FAIL: conform/UNIX98/sys/resource.h/linknamespace | FAIL: conform/UNIX98/sys/statvfs.h/linknamespace | FAIL: conform/UNIX98/sys/time.h/conform | FAIL: conform/UNIX98/unistd.h/linknamespace | FAIL: conform/UNIX98/utmpx.h/conform | FAIL: conform/XOPEN2K/aio.h/linknamespace | FAIL: conform/XOPEN2K/dirent.h/linknamespace | FAIL: conform/XOPEN2K/fcntl.h/conform | FAIL: conform/XOPEN2K/fcntl.h/linknamespace | FAIL: conform/XOPEN2K/glob.h/conform | FAIL: conform/XOPEN2K/mqueue.h/conform | FAIL: conform/XOPEN2K/mqueue.h/linknamespace | FAIL: conform/XOPEN2K/stdio.h/linknamespace | FAIL: conform/XOPEN2K/stdlib.h/linknamespace | FAIL: conform/XOPEN2K/sys/mman.h/linknamespace | FAIL: conform/XOPEN2K/sys/resource.h/linknamespace | FAIL: conform/XOPEN2K/sys/select.h/conform | FAIL: conform/XOPEN2K/sys/statvfs.h/linknamespace | FAIL: conform/XOPEN2K/sys/time.h/conform | FAIL: conform/XOPEN2K/unistd.h/linknamespace | FAIL: conform/XOPEN2K/utmpx.h/conform | FAIL: conform/XOPEN2K8/aio.h/linknamespace | FAIL: conform/XOPEN2K8/dirent.h/linknamespace | FAIL: conform/XOPEN2K8/fcntl.h/conform | FAIL: conform/XOPEN2K8/fcntl.h/linknamespace | FAIL: conform/XOPEN2K8/ftw.h/conform | FAIL: conform/XOPEN2K8/glob.h/conform | FAIL: conform/XOPEN2K8/mqueue.h/conform | FAIL: conform/XOPEN2K8/mqueue.h/linknamespace | FAIL: conform/XOPEN2K8/signal.h/conform | FAIL: conform/XOPEN2K8/stdio.h/linknamespace | FAIL: conform/XOPEN2K8/stdlib.h/linknamespace | FAIL: conform/XOPEN2K8/sys/mman.h/linknamespace | FAIL: conform/XOPEN2K8/sys/resource.h/linknamespace | FAIL: conform/XOPEN2K8/sys/select.h/conform | FAIL: conform/XOPEN2K8/sys/stat.h/conform | FAIL: conform/XOPEN2K8/sys/statvfs.h/linknamespace | FAIL: conform/XOPEN2K8/sys/time.h/conform | FAIL: conform/XOPEN2K8/unistd.h/linknamespace | FAIL: conform/XOPEN2K8/utmpx.h/conform | FAIL: conform/XPG4/dirent.h/linknamespace | FAIL: conform/XPG4/fcntl.h/conform | FAIL: conform/XPG4/fcntl.h/linknamespace | FAIL: conform/XPG4/glob.h/conform | FAIL: conform/XPG4/stdio.h/linknamespace | FAIL: conform/XPG4/unistd.h/linknamespace | FAIL: conform/XPG42/dirent.h/linknamespace | FAIL: conform/XPG42/fcntl.h/conform | FAIL: conform/XPG42/fcntl.h/linknamespace | FAIL: conform/XPG42/glob.h/conform | FAIL: conform/XPG42/stdio.h/linknamespace | FAIL: conform/XPG42/stdlib.h/linknamespace | FAIL: conform/XPG42/sys/mman.h/linknamespace | FAIL: conform/XPG42/sys/resource.h/linknamespace | FAIL: conform/XPG42/sys/statvfs.h/linknamespace | FAIL: