[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1066836: libcamera: ftbfs with 64-bit time_t



Package: libcamera
Version: 0.2.0-1
Severity: serious
Tags: patch
Justification: ftbfs
User: ubuntu-devel@lists.ubuntu.com
Usertags: origin-ubuntu noble ubuntu-patch

Dear maintainers,

libcamera fails to build from source on 32-bit architectures under 64-bit
time_t, because it has a module that legitimately un-sets _FILE_OFFSET_BITS
for building but this is not allowed without also unsetting _TIME_BITS:

[...]
[267/430] c++ -Isrc/v4l2/v4l2-compat.so.p -Isrc/v4l2 -I../src/v4l2 -Iinclude -I../include -Iinclude/libcamera/ipa -Iinclude/libcamera -fdiagnostics-color=always -Wall -Winvalid-pch -Wextra -Werror -std=c++17 -Wno-redundant-move -Wno-psabi -Wshadow -include /<<PKGBUILDDIR>>/obj-arm-linux-gnueabihf/config.h -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -fno-stack-clash-protection -fdebug-prefix-map=/<<PKGBUILDDIR>>=/usr/src/libcamera-0.2.0-1ubuntu3 -Wno-error -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 -Wdate-time -D_FORTIFY_SOURCE=3 -fPIC -DLIBCAMERA_BASE_PRIVATE -U_FILE_OFFSET_BITS -D_FILE_OFFSET_BITS=32 -D_LARGEFILE64_SOURCE -fvisibility=hidden -MD -MQ src/v4l2/v4l2-compat.so.p/v4l2_camera.cpp.o -MF src/v4l2/v4l2-compat.so.p/v4l2_camera.cpp.o.d -o src/v4l2/v4l2-compat.so.p/v4l2_camera.cpp.o -c ../src/v4l2/v4l2_camera.cpp
FAILED: src/v4l2/v4l2-compat.so.p/v4l2_camera.cpp.o 
c++ -Isrc/v4l2/v4l2-compat.so.p -Isrc/v4l2 -I../src/v4l2 -Iinclude -I../include -Iinclude/libcamera/ipa -Iinclude/libcamera -fdiagnostics-color=always -Wall -Winvalid-pch -Wextra -Werror -std=c++17 -Wno-redundant-move -Wno-psabi -Wshadow -include /<<PKGBUILDDIR>>/obj-arm-linux-gnueabihf/config.h -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -fno-stack-clash-protection -fdebug-prefix-map=/<<PKGBUILDDIR>>=/usr/src/libcamera-0.2.0-1ubuntu3 -Wno-error -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 -Wdate-time -D_FORTIFY_SOURCE=3 -fPIC -DLIBCAMERA_BASE_PRIVATE -U_FILE_OFFSET_BITS -D_FILE_OFFSET_BITS=32 -D_LARGEFILE64_SOURCE -fvisibility=hidden -MD -MQ src/v4l2/v4l2-compat.so.p/v4l2_camera.cpp.o -MF src/v4l2/v4l2-compat.so.p/v4l2_camera.cpp.o.d -o src/v4l2/v4l2-compat.so.p/v4l2_camera.cpp.o -c ../src/v4l2/v4l2_camera.cpp
In file included from /usr/include/features.h:394,
                 from /usr/include/arm-linux-gnueabihf/c++/13/bits/os_defines.h:39,
                 from /usr/include/arm-linux-gnueabihf/c++/13/bits/c++config.h:679,
                 from /usr/include/c++/13/bits/requires_hosted.h:31,
                 from /usr/include/c++/13/deque:60,
                 from ../src/v4l2/v4l2_camera.h:10,
                 from ../src/v4l2/v4l2_camera.cpp:8:
/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"
      |     ^~~~~
[...]

  (https://launchpad.net/ubuntu/+source/libcamera/0.2.0-1ubuntu3/+build/27902670)

Since this is a legitimate un-setting of _FILE_OFFSET_BITS in order to get
access to the necessary libc6 prototypes and macros, and since the functions
being intercepted are not sensitive to time_t, the simplest solution is to
also unset _TIME_BITS.

Please see the attached patch, which has been uploaded to Ubuntu to fix this
build failure.

Thanks for considering,
-- 
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@ubuntu.com                                     vorlon@debian.org
diff -Nru libcamera-0.2.0/debian/control libcamera-0.2.0/debian/control
--- libcamera-0.2.0/debian/control	2024-01-17 13:27:50.000000000 -0800
+++ libcamera-0.2.0/debian/control	2024-03-13 22:27:39.000000000 -0700
@@ -1,7 +1,6 @@
 Source: libcamera
 Priority: optional
-Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
-XSBC-Original-Maintainer: Debian Multimedia Maintainers <debian-multimedia@lists.debian.org>
+Maintainer: Debian Multimedia Maintainers <debian-multimedia@lists.debian.org>
 Uploaders: Emmanuel Arias <emmanuelarias30@gmail.com>,
            IOhannes m zmölnig (Debian/GNU) <umlaeute@debian.org>,
            Andrej Shadura <andrewsh@debian.org>,
diff -Nru libcamera-0.2.0/debian/patches/64-bit-time-t-compat.patch libcamera-0.2.0/debian/patches/64-bit-time-t-compat.patch
--- libcamera-0.2.0/debian/patches/64-bit-time-t-compat.patch	1969-12-31 16:00:00.000000000 -0800
+++ libcamera-0.2.0/debian/patches/64-bit-time-t-compat.patch	2024-03-13 22:27:33.000000000 -0700
@@ -0,0 +1,21 @@
+Description: 64-bit time_t compatibility for v4l2 module
+ The v4l2 build unsets _FILE_OFFSET_BITS, which is not allowed when setting
+ _TIME_BITS=64.  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.
+Author: Steve Langasek <steve.langasek@canonical.com>
+Forwarded: no
+Last-Update: 2024-03-13
+
+Index: libcamera-0.2.0/src/v4l2/meson.build
+===================================================================
+--- libcamera-0.2.0.orig/src/v4l2/meson.build
++++ libcamera-0.2.0/src/v4l2/meson.build
+@@ -23,6 +23,7 @@
+     # file operations, disable transparent large file support.
+     '-U_FILE_OFFSET_BITS',
+     '-D_FILE_OFFSET_BITS=32',
++    '-U_TIME_BITS',
+     '-D_LARGEFILE64_SOURCE',
+     '-fvisibility=hidden',
+ ]
diff -Nru libcamera-0.2.0/debian/patches/series libcamera-0.2.0/debian/patches/series
--- libcamera-0.2.0/debian/patches/series	2024-01-17 13:27:50.000000000 -0800
+++ libcamera-0.2.0/debian/patches/series	2024-03-13 22:25:15.000000000 -0700
@@ -1,2 +1,3 @@
 ppc64el-fix-ftbfs-gcc.patch
 skip_failing_tests.patch
+64-bit-time-t-compat.patch

Reply to: