[PATCH] v4l2: unset _TIME_BITS in addition to _FILE_OFFSET_BITS

Steve Langasek steve.langasek at ubuntu.com
Fri Mar 22 23:52:54 CET 2024


On Thu, Mar 21, 2024 at 09:21:19AM +0000, Kieran Bingham wrote:
> Hi Steve, Dylan,

> Quoting Dylan Aïssi (2024-03-20 16:58:40)
> > From: Steve Langasek <steve.langasek at canonical.com>

> > libcamera fails to build from source in Debian/Ubuntu on 32-bit
> > architectures under 64-bit time_t (to avoid the 'year 2038
> > problem'), because its v4l2 module legitimately un-sets
> > _FILE_OFFSET_BITS for building but this is not allowed without
> > also unsetting _TIME_BITS.

> > Having verified that nothing in this module is sensitive to 64-bit
> > time_t (none of the functions it intercepts handle time), we also
> > unset _TIME_BITS to allow this to build as before.

> Should we be setting -D_TIME_BITS=32 or anything like that, in the same
> way that immediately after unsetting _FILE_OFFSET_BITS we set that to
> 32?

No, there's no need to set it to another value.  The default behavior is for
it to be unset.  If some libc implementation other than glibc wants to set
it to a value other than 64, that's the business of that implementation.

I don't know why you're setting -D_FILE_OFFSET_BITS=32 either fwiw and think
this is probably wrong, but I was going for a minimal fix here for the
TIME/FILE bits incompatibility.

> > Signed-off-by: Steve Langasek <steve.langasek at canonical.com>
> > Reviewed-by: Dylan Aïssi <dylan.aissi at collabora.com>
> > ---
> >  src/v4l2/meson.build | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/src/v4l2/meson.build b/src/v4l2/meson.build
> > index e88e0b33..12d1e2a4 100644
> > --- a/src/v4l2/meson.build
> > +++ b/src/v4l2/meson.build
> > @@ -23,6 +23,7 @@ v4l2_compat_cpp_args = [
> >      # file operations, disable transparent large file support.
> >      '-U_FILE_OFFSET_BITS',
> >      '-D_FILE_OFFSET_BITS=32',
> > +    '-U_TIME_BITS',
> >      '-D_LARGEFILE64_SOURCE',
> >      '-fvisibility=hidden',
> >  ]
> > -- 
> > 2.30.2
> >
> 

Cheers,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                   https://www.debian.org/
slangasek at ubuntu.com                                     vorlon at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20240322/0fb0139e/attachment.sig>


More information about the libcamera-devel mailing list