#1065153 v4l-utils: FTBFS on armhf/armel: _TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64

#1065153#5
Date:
2024-03-01 09:28:14 UTC
From:
To:
Dear Maintainer,

v4l-utils fails to build from source on armhf and armel with the
following error:

In file included from /usr/include/features.h:393,
                 from /usr/include/arm-linux-gnueabi/bits/libc-header-start.h:33,
                 from /usr/include/stdlib.h:26,
                 from ../lib/libv4l2/v4l2convert.c:27:
/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"
      |     ^~~~~

#1065153#10
Date:
2024-03-01 10:34:19 UTC
From:
To:
The build logs show that the time64 flags -D_FILE_OFFSET_BITS=64
-D_TIME_BITS=64 are used as expected throughout the build process, with
the exception of v4l2convert.c.o which uses -D_FILE_OFFSET_BITS=32:

[94/286] cc -Ilib/libv4l2/v4l2convert.so.p -Ilib/libv4l2 -I../lib/libv4l2 -I../lib/include -I../include -fdiagnostics-color=always -Wall -Winvalid-pch -std=gnu99 -Wpointer-arith -D_GNU_SOURCE -DPROMOTED_MODE_T=int -DENABLE_NLS -include /<<PKGBUILDDIR>>/obj-arm-linux-gnueabihf/config.h -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -U_FILE_OFFSET_BITS -D_FILE_OFFSET_BITS=32 -D_LARGEFILE64_SOURCE -MD -MQ lib/libv4l2/v4l2convert.so.p/v4l2convert.c.o -MF lib/libv4l2/v4l2convert.so.p/v4l2convert.c.o.d -o lib/libv4l2/v4l2convert.so.p/v4l2convert.c.o -c ../lib/libv4l2/v4l2convert.c

This seems intentional, see meson.build:

  v4l2_wrapper_args = [
      # As the library needs to provide both 32-bit and 64-bit versions
      # of file operations, disable transparent large file support (fixes
      # 'Error: symbol `open64/mmap64' is already defined' compile failure
      # otherwise)
      '-U_FILE_OFFSET_BITS',
      '-D_FILE_OFFSET_BITS=32',
      '-D_LARGEFILE64_SOURCE',
  ]

https://sources.debian.org/src/v4l-utils/1.26.1-3.1/meson.build/#L51

#1065153#13
Date:
2024-03-01 17:08:45 UTC
From:
To:
Hello,

Bug #1065153 in libv4l reported by you has been fixed in the
Git repository and is awaiting an upload. You can see the commit
message below and you can check the diff of the fix at:

https://salsa.debian.org/debian/libv4l/-/commit/c656a24b12c6256a7066117f572fabf0bdee5e73

(this message was generated automatically)
-- 
Greetings

https://bugs.debian.org/1065153

#1065153#20
Date:
2024-03-01 17:20:13 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
v4l-utils, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1065153@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Gregor Jasny <gjasny@googlemail.com> (supplier of updated v4l-utils package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Fri, 01 Mar 2024 17:52:19 +0100
Source: v4l-utils
Architecture: source
Version: 1.26.1-4
Distribution: unstable
Urgency: medium
Maintainer: Gregor Jasny <gjasny@googlemail.com>
Changed-By: Gregor Jasny <gjasny@googlemail.com>
Closes: 1065153
Changes:
 v4l-utils (1.26.1-4) unstable; urgency=medium
 .
   * Avoid invalid file and time bits combination (Closes: #1065153)
Checksums-Sha1:
 f05d955ecc4a156f70f21f7c55920bc028d7d6d9 3242 v4l-utils_1.26.1-4.dsc
 ab5f0c05d9fb195a71c2706812ef82b468baee83 23220 v4l-utils_1.26.1-4.debian.tar.xz
 dc37c15e01469fb27286d0194433992fa16a4075 18197 v4l-utils_1.26.1-4_arm64.buildinfo
Checksums-Sha256:
 6a32865ed3b91e087984e038027bceab8ba824ec31f3d29ac52e5c36cf8f3954 3242 v4l-utils_1.26.1-4.dsc
 4d0f834042eb9ad0ae0ba7d4ec409d3e96b2cf5fb3957e673ab5b2ba571d5d35 23220 v4l-utils_1.26.1-4.debian.tar.xz
 d63360d53f276140d69fceb360fb03040d10aa25fea50d53cfe2ca992c9a74d0 18197 v4l-utils_1.26.1-4_arm64.buildinfo
Files:
 825ce034642032711939f67b09556e77 3242 video optional v4l-utils_1.26.1-4.dsc
 989524f95dbed9666073ed56590b437a 23220 video optional v4l-utils_1.26.1-4.debian.tar.xz
 386902dab7592c40a19873a54910bb68 18197 video optional v4l-utils_1.26.1-4_arm64.buildinfo
-----BEGIN PGP SIGNATURE-----

iQJKBAEBCAA0FiEEBdAWnCbkFZNBgSnfGZpk+t+1AP8FAmXiC2kWHGdqYXNueUBn
b29nbGVtYWlsLmNvbQAKCRAZmmT637UA/5CHD/4wJtFxtLq+PBOrZaxGEW9JiZBy
NAQMTqmVGlVoEfYvpCo/yJPJrFOeJ4lesX2eAz/IZqL7nXZgCkezUboJPdPjDaVC
Hd5EwOVFvf7LhKx4ugDpqKv21j7GMAn/DnK0TVjDdww5+8OFxKwhsARnNr4J2C3b
52pF53Thx1tCP+tvaAyCMnOEnufrdCDlZWpCgFd3YCbhcTc78qcCHCiEhZ5z1Ouj
CT7VUuEcBX17ZU8t8o32TC7s5LEgyWxSq+zsmoRjDSE0tH7utRVxCo5P60zdIBxM
7730j/hDmNQT9vDYtLDP+jAEM0hATrVif3Ltt2s75sr2C1xyEyqEh8/jP8aD9Pqr
7MwLDF8fwljFtB0JufiN+UOaDMDVbowwjjuhRnvIFvs1MbwEtclNn5C6qDWC2fef
FhArRwa6RsiaGIteoQc6uN8F3XC/xPSdvzGhv69CmkZQ//H/+tPj8AjUwAorNg8B
CAzipMk0gs6TMuZBCLxgjuAHatrUfhDLw64WjeMQqzvuJUbgHM7D5WWMH2RgcxcD
VgObSZ4ZrDcCvnpggKzV2FnhxK5Ot+iU1Pgaujem0oEzfDCkTpU6XJmlvqapX2tF
W2F8Zc65hk9O35aefDLcBvzhJZJcT9xYpEZBo8pgkn7yyAH47IMF9hOQfPSSIGjf
3dK/yQ9k1TYJXxHccg==
=xS9+
-----END PGP SIGNATURE-----

#1065153#25
Date:
2024-03-01 19:37:25 UTC
From:
To:
Hello,

You're right disabling LFS was intentional. Those "wrappers" are meent
to be preloaded with LD_PRELOAD and should intercept all V4L related
calls like open, close, mmap, etc.

I believe the conflict arose because the Debian CFLAGS now define a 64
bit time_t value on 32bit architectures. I believe none of the code
within those wrappers is sensitive to time_t. Therefore I also undefined
the _TIME_BITS. That should resolve the issue for the Debian package.

For upstream the problem is a little bit trickier because the "tracer"
also uses those flags. But the tracer consists of lots of files. Maybe
those have to be split up.

Thanks,
Gregor