Skip to contentSkip to conversation

package/libv4l: backport upstream patch to fix time_t issue

PATCH Applied Thomas Petazzoni via buildroot 2 participants 4 messages Apr 14, 2025 – May 2, 2025 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/libv4l: backport upstream patch to fix time_t issue

libv4l has some really special code that is built explicitly with _FILE_OFFSET_BITS=32, which doesn't work with _TIME_BITS=64, causing build failures when BR2_TIME_BITS_64=y. This build issue has been fixed upstream. While how the upstream patch exactly works is unclear, it's the patch that upstream has decided to implement to resolve the build issue, so we simply backport it.

The issue exists since at least upstream commit 99f245f5e2826c7ae3ac8de530bc2fbd906eb62b, which was merged in v4l-utils 1.26.0.

Fixes:

https://autobuild.buildroot.org/results/616608ef2a44efff67fa21b3263b341da82744c4/

---
 ...on.build-fix-arm-_TIME_BITS-64-error.patch | 37 +++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 package/libv4l/0001-meson.build-fix-arm-_TIME_BITS-64-error.patch
package/libv4l/0001-meson.build-fix-arm-_TIME_BITS-64-error.patch new file +37 -0
new file mode 100644
index 0000000000..db59eae7e6
@@ -0,0 +1,37 @@
+From 6faf5e963eadeab8b7d47d5b3c14f06e0ae1da01 Mon Sep 17 00:00:00 2001
+From: Hans Verkuil <[email protected]>
+Date: Sat, 12 Apr 2025 12:30:13 +0200
+Subject: [PATCH] meson.build: fix arm _TIME_BITS=64 error
+
+Undefine _TIME_BITS to avoid this error on 32-bit arm:
+
+/usr/include/features-time64.h:26:5: error: #error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
+
+Signed-off-by: Hans Verkuil <[email protected]>
+Upstream: d517cfdcdc16533ab7e06e97c07ca089cf261aef
+Signed-off-by: Thomas Petazzoni <[email protected]>
+---
+ meson.build | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index 269a9da7..31927cda 100644
+--- a/meson.build
++++ b/meson.build
+@@ -53,8 +53,12 @@ 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)
++    # otherwise).
++    #
++    # Also disable _TIME_BITS=64 since this is allowed only with
++    # _FILE_OFFSET_BITS=64, which is now 32.
+     '-U_FILE_OFFSET_BITS',
++    '-U_TIME_BITS',
+     '-D_FILE_OFFSET_BITS=32',
+     '-D_LARGEFILE64_SOURCE',
+ ]
+-- 
+2.49.0
+
Signature · 6 lines
2.49.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 2/2 package/libv4l: disable some options when BR2_STATIC_LIBS

Since libv4l was bumped to 1.28.1 and converted to use the meson build system in Buildroot commit 41ce1cc690b0837a1822079317bf317ddaeac17b, the build started failing on BR2_STATIC_LIBS=y configurations due to compiling code that isn't compatible with static linking.

This commit fixes that by disabling the plugin code and the wrappers.

Fixes:

https://autobuild.buildroot.org/results/89c6c7c0fd991d777ac7cd2b2322424099fa89cc/

---
 package/libv4l/libv4l.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/libv4l/libv4l.mk +4 -0
index e8bcc2bdfc..a535b8e8a6 100644
@@ -16,6 +16,10 @@ LIBV4L_LDFLAGS = $(TARGET_LDFLAGS)
 LIBV4L_LICENSE = GPL-2.0+ (utilities), LGPL-2.1+ (libraries)
 LIBV4L_LICENSE_FILES = COPYING COPYING.libv4l lib/libv4l1/libv4l1-kernelcode-license.txt
 
+ifeq ($(BR2_STATIC_LIBS),y)
+LIBV4L_CONF_OPTS += -Dv4l-plugins=false -Dv4l-wrappers=false
+endif
+
 ifeq ($(BR2_PACKAGE_ALSA_LIB),y)
 LIBV4L_DEPENDENCIES += alsa-lib
 endif
Signature · 6 lines
2.49.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
In reply to Thomas Petazzoni via buildroot
Quoted 11 lines · Thomas Petazzoni via buildroot

libv4l has some really special code that is built explicitly with _FILE_OFFSET_BITS=32, which doesn't work with _TIME_BITS=64, causing build failures when BR2_TIME_BITS_64=y. This build issue has been fixed upstream. While how the upstream patch exactly works is unclear, it's the patch that upstream has decided to implement to resolve the build issue, so we simply backport it.

The issue exists since at least upstream commit 99f245f5e2826c7ae3ac8de530bc2fbd906eb62b, which was merged in v4l-utils 1.26.0.

Quoted 6 lines

Fixes:

https://autobuild.buildroot.org/results/616608ef2a44efff67fa21b3263b341da82744c4/

Series applied to master, thanks.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw
In reply to Thomas Petazzoni via buildroot
Quoted 11 lines · Thomas Petazzoni via buildroot

libv4l has some really special code that is built explicitly with _FILE_OFFSET_BITS=32, which doesn't work with _TIME_BITS=64, causing build failures when BR2_TIME_BITS_64=y. This build issue has been fixed upstream. While how the upstream patch exactly works is unclear, it's the patch that upstream has decided to implement to resolve the build issue, so we simply backport it.

The issue exists since at least upstream commit 99f245f5e2826c7ae3ac8de530bc2fbd906eb62b, which was merged in v4l-utils 1.26.0.

Quoted 5 lines

Fixes:

   https://autobuild.buildroot.org/results/616608ef2a44efff67fa21b3263b341da82744c4/

Applied both to 2025.02.x, thanks.

Regards,
Arnout

Quoted 38 lines
---
  ...on.build-fix-arm-_TIME_BITS-64-error.patch | 37 +++++++++++++++++++
  1 file changed, 37 insertions(+)

create mode 100644 package/libv4l/0001-meson.build-fix-arm-_TIME_BITS-64-error.patch

package/libv4l/0001-meson.build-fix-arm-_TIME_BITS-64-error.patch new file +27 -0
new file mode 100644
index 0000000000..db59eae7e6
@@ -0,0 +1,37 @@
+From 6faf5e963eadeab8b7d47d5b3c14f06e0ae1da01 Mon Sep 17 00:00:00 2001
+From: Hans Verkuil <[email protected]>
+Date: Sat, 12 Apr 2025 12:30:13 +0200
+Subject: [PATCH] meson.build: fix arm _TIME_BITS=64 error
+
+Undefine _TIME_BITS to avoid this error on 32-bit arm:
+
+/usr/include/features-time64.h:26:5: error: #error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
+
+Signed-off-by: Hans Verkuil <[email protected]>
+Upstream: d517cfdcdc16533ab7e06e97c07ca089cf261aef
+Signed-off-by: Thomas Petazzoni <[email protected]>
+---
+ meson.build | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index 269a9da7..31927cda 100644
+--- a/meson.build
++++ b/meson.build
+@@ -53,8 +53,12 @@ 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)
++    # otherwise).
++    #

package/libv4l/0001-meson.build-fix-arm-_TIME_BITS-64-error.patch line 37

Quoted 10 lines
package/libv4l/0001-meson.build-fix-arm-_TIME_BITS-64-error.patch new file +10 -0
++    # Also disable _TIME_BITS=64 since this is allowed only with
++    # _FILE_OFFSET_BITS=64, which is now 32.
+     '-U_FILE_OFFSET_BITS',
++    '-U_TIME_BITS',
+     '-D_FILE_OFFSET_BITS=32',
+     '-D_LARGEFILE64_SOURCE',
+ ]
+--
+2.49.0
+

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot