package/libgphoto2: fix build with gcc >= 14
PATCH 1/1 package/libgphoto2: fix build with gcc >= 14
The commit adds a backported upstream patch to fix the following build failure:
jl2005c/jl2005bcd_decompress.c: In function 'jl2005bcd_decompress':jl2005c/jl2005bcd_decompress.c:161:46: error: passing argument 3 of 'jpeg_mem_dest' from incompatible pointer type [-Wincompatible-pointer-types]
161 | jpeg_mem_dest (&cinfo, &jpeg_header, &jpeg_header_size);
| ^~~~~~~~~~~~~~~~~
| |
| long unsigned int *The same fix was merged in master with commit d2ad5b883342 ("package/libgphoto2: fix build with gcc >= 14") for version 2.5.33. The patch has been adapted to version 2.5.27, where the libjpeg check lives in configure.ac rather than in gphoto-m4/gp-libjpeg.m4.
Fixes:
- https://autobuild.buildroot.org/results/09f2756d3d26a9e27ef596428c84d37c5d2d5bb2
Signed-off-by Dario Binacchi <[email protected]>
--- ...s-for-the-size-type-of-jpeg_mem_dest.patch | 142 ++++++++++++++++++ package/libgphoto2/libgphoto2.mk | 2 + 2 files changed, 144 insertions(+) create mode 100644 package/libgphoto2/0002-autoconf-checks-for-the-size-type-of-jpeg_mem_dest.patch
package/libgphoto2/0002-autoconf-checks-for-the-size-type-of-jpeg_mem_dest.patch new file +142 -0
@@ -0,0 +1,142 @@ +From 4bcdd2b604cd96815ff4b8bdfe7c7a587970929d Mon Sep 17 00:00:00 2001 +From: Marcus Meissner <[email protected]> +Date: Sun, 29 Mar 2026 21:31:49 +0200 +Subject: [PATCH] autoconf checks for the size type of jpeg_mem_dest + +fixes https://github.com/gphoto/libgphoto2/pull/1176 + +[Dario: backport to 2.5.27, where the libjpeg check lives in +configure.ac instead of libgphoto2_port/gphoto-m4/gp-libjpeg.m4] +Upstream: https://github.com/gphoto/libgphoto2/commit/ca4441f48117c681cecfb3c883115e0546aed985 +Signed-off-by: Dario Binacchi <[email protected]> +--- + camlibs/ax203/ax203.c | 2 +- + camlibs/ax203/ax203_compress_jpeg.c | 2 +- + camlibs/ax203/jpeg_memsrcdest.h | 2 ++ + camlibs/jl2005c/jl2005bcd_decompress.c | 2 +- + camlibs/jl2005c/jpeg_memsrcdest.h | 2 ++ + camlibs/ptp2/chdk.c | 2 +- + configure.ac | 32 ++++++++++++++++++++++++++ + 7 files changed, 40 insertions(+), 4 deletions(-) + +diff --git a/camlibs/ax203/ax203.c b/camlibs/ax203/ax203.c +index db696110d8aa..540b4ff9ca4f 100644 +--- a/camlibs/ax203/ax203.c ++++ b/camlibs/ax203/ax203.c +@@ -1202,7 +1202,7 @@ ax203_encode_image(Camera *camera, int **src, char *dest, unsigned int dest_size + struct jpeg_compress_struct cinfo; + struct jpeg_error_mgr jcerr; + JOCTET *jpeg_dest = NULL; +- unsigned long jpeg_size = 0; ++ JPEG_SIZE jpeg_size = 0; + JSAMPLE row[camera->pl->width * 3]; + JSAMPROW row_pointer[1] = { row }; + #endif +diff --git a/camlibs/ax203/ax203_compress_jpeg.c b/camlibs/ax203/ax203_compress_jpeg.c +index 1ec7534ff484..22068afd79c0 100644 +--- a/camlibs/ax203/ax203_compress_jpeg.c ++++ b/camlibs/ax203/ax203_compress_jpeg.c +@@ -124,7 +124,7 @@ ax206_compress_jpeg(Camera *camera, int **in, uint8_t *outbuf, int out_size, + jvirt_barray_ptr *in_coefficients; + unsigned int i, x, y; + int stop, size, ret, outc; +- unsigned long regular_jpeg_size = 0, buf_size = 0; ++ JPEG_SIZE regular_jpeg_size = 0, buf_size = 0; + int last_dc_val[3] = { 0, 0, 0 }; + + /* We have a rgb24bit image in the desired dimensions, first we +diff --git a/camlibs/ax203/jpeg_memsrcdest.h b/camlibs/ax203/jpeg_memsrcdest.h +index b13bf3f4055e..ea0cd7ab4872 100644 +--- a/camlibs/ax203/jpeg_memsrcdest.h ++++ b/camlibs/ax203/jpeg_memsrcdest.h +@@ -2,6 +2,8 @@ + + #if JPEG_LIB_VERSION < 80 && !defined(MEM_SRCDST_SUPPORTED) + ++#define JPEG_SIZE unsigned long ++ + void + jpeg_mem_src (j_decompress_ptr cinfo, unsigned char * buffer, + unsigned long bufsize); +diff --git a/camlibs/jl2005c/jl2005bcd_decompress.c b/camlibs/jl2005c/jl2005bcd_decompress.c +index 005bf8e52ac4..461e714c6de5 100644 +--- a/camlibs/jl2005c/jl2005bcd_decompress.c ++++ b/camlibs/jl2005c/jl2005bcd_decompress.c +@@ -85,7 +85,7 @@ jl2005bcd_decompress (unsigned char *output, unsigned char *input, + struct jpeg_error_mgr jcerr, jderr; + JOCTET *jpeg_header = NULL; + int outputsize = 0; +- unsigned long jpeg_header_size = 0; ++ JPEG_SIZE jpeg_header_size = 0; + int i, x, y, x1, y1, jpeg_data_size, jpeg_data_idx, eoi, size, ret; + JSAMPLE green[8 * 16]; + JSAMPLE red[8 * 8]; +diff --git a/camlibs/jl2005c/jpeg_memsrcdest.h b/camlibs/jl2005c/jpeg_memsrcdest.h +index b13bf3f4055e..ea0cd7ab4872 100644 +--- a/camlibs/jl2005c/jpeg_memsrcdest.h ++++ b/camlibs/jl2005c/jpeg_memsrcdest.h +@@ -2,6 +2,8 @@ + + #if JPEG_LIB_VERSION < 80 && !defined(MEM_SRCDST_SUPPORTED) + ++#define JPEG_SIZE unsigned long ++ + void + jpeg_mem_src (j_decompress_ptr cinfo, unsigned char * buffer, + unsigned long bufsize); +diff --git a/camlibs/ptp2/chdk.c b/camlibs/ptp2/chdk.c +index c9b553ab3bba..b2924a34293c 100644 +--- a/camlibs/ptp2/chdk.c ++++ b/camlibs/ptp2/chdk.c +@@ -1166,7 +1166,7 @@ static void yuv_live_to_jpeg(unsigned char *p_yuv, + struct jpeg_error_mgr jerr; + JSAMPROW row_ptr[1]; + uint8_t *outbuf = NULL, *tmprowbuf = NULL; +- unsigned long outlen = 0; ++ JPEG_SIZE outlen = 0; + unsigned int row_inc; + int sshift, dshift, xshift, skip; + +diff --git a/configure.ac b/configure.ac +index 4b5e12d8e34c..6503809e7688 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -315,6 +315,38 @@ AS_IF([test "x$with_jpeg" != "xno"], [ + libjpeg_msg="yes" + ]) + ]) ++ dnl find type of memdest ++ AC_LANG_PUSH([C]) ++ ++ AC_MSG_CHECKING([type of jpeg_mem_dest size]) ++ AC_COMPILE_IFELSE([ ++ #include <stdio.h> ++ #include <unistd.h> ++ #include <jpeglib.h> ++ void f(j_compress_ptr cinfo, unsigned char ** outbuffer, unsigned long * outsize) { ++ jpeg_mem_dest(cinfo, outbuffer, outsize); ++ } ++ ],[ ++ AC_MSG_RESULT([unsigned long*]) ++ AC_DEFINE([JPEG_SIZE],[unsigned long], "JPEG memdest size type") ++ ],[ ++ AC_COMPILE_IFELSE([ ++ #include <stdio.h> ++ #include <unistd.h> ++ #include <jpeglib.h> ++ void f(j_compress_ptr cinfo, unsigned char ** outbuffer, size_t * outsize) { ++ jpeg_mem_dest(cinfo, outbuffer, outsize); ++ } ++ ],[ ++ AC_MSG_RESULT([size_t*]) ++ AC_DEFINE([JPEG_SIZE],[size_t], "JPEG memdest size type") ++ ],[ ++ AC_MSG_RESULT([unknown, using unsigned long*]) ++ AC_DEFINE([JPEG_SIZE],[unsigned long], "JPEG memdest size type") ++ ]) ++ ] ++ ) ++ AC_LANG_POP([C]) + ]) + GP_CONFIG_MSG([JPEG mangling support],[${libjpeg_msg}]) +
package/libgphoto2/libgphoto2.mk +2 -0
@@ -9,6 +9,8 @@ LIBGPHOTO2_SOURCE = libgphoto2-$(LIBGPHOTO2_VERSION).tar.xz LIBGPHOTO2_SITE = https://github.com/gphoto/libgphoto2/releases/download/v$(LIBGPHOTO2_VERSION) LIBGPHOTO2_LICENSE = LGPL-2.1+, GPL-2.0 (adc65), GPL-2.0+ (some camlibs), \ LGPL-2.0 (sipix), LGPL-3.0+ (pentax), BSD-3-Clause (ax203/tinyjpeg) +# 0002-autoconf-checks-for-the-size-type-of-jpeg_mem_dest.patch +LIBGPHOTO2_AUTORECONF = YES # There is a single license file for the LGPL-2.1, no license files # for other licenses LIBGPHOTO2_LICENSE_FILES = COPYING
Signature · 6 lines
2.43.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot