| Message ID | 20260406134106.4145818-1-dario.binacchi@amarulasolutions.com |
|---|---|
| State | New |
| Headers | show |
| Series |
|
| Related | show |
Hello everybody! On 2026-04-06 at 15:41, Dario Binacchi wrote: > The commit adds an 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 * > > Fixes: > - https://autobuild.buildroot.org/results/cb983d9ad90170aa8d7f2b9a5dfc30055d83b5de > > Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Tested-by: Edgar Bonet <bonet@grenoble.cnrs.fr> I did a build-test as follows: cat >gphoto2_defconfig <<EOF BR2_mips64el=y BR2_TOOLCHAIN_BUILDROOT_UCLIBC=y BR2_PACKAGE_JPEG=y BR2_PACKAGE_LIBGPHOTO2=y EOF make defconfig BR2_DEFCONFIG=gphoto2_defconfig make libgphoto2 On commit adf99a634b357 (master at the time of the test), this test reproduces the build failure seen on the autobuilder.[1] Applying this patch, the build succeeds. Regards, Edgar Bonet. [1] https://autobuild.buildroot.org/results/cb983d9ad90170aa8d7f2b9a5dfc30055d83b5de > --- > ...s-for-the-size-type-of-jpeg_mem_dest.patch | 143 ++++++++++++++++++ > package/libgphoto2/libgphoto2.mk | 2 + > 2 files changed, 145 insertions(+) > create mode 100644 package/libgphoto2/0001-autoconf-checks-for-the-size-type-of-jpeg_mem_dest.patch > > diff --git a/package/libgphoto2/0001-autoconf-checks-for-the-size-type-of-jpeg_mem_dest.patch b/package/libgphoto2/0001-autoconf-checks-for-the-size-type-of-jpeg_mem_dest.patch > new file mode 100644 > index 000000000000..543678181b06 > --- /dev/null > +++ b/package/libgphoto2/0001-autoconf-checks-for-the-size-type-of-jpeg_mem_dest.patch > @@ -0,0 +1,143 @@ > +From ca4441f48117c681cecfb3c883115e0546aed985 Mon Sep 17 00:00:00 2001 > +From: Marcus Meissner <marcus@jet.franken.de> > +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 > + > +Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> > +Upstream: https://github.com/gphoto/libgphoto2/commit/ca4441f48117c681cecfb3c883115e0546aed985 > +--- > + 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 +- > + libgphoto2_port/gphoto-m4/gp-libjpeg.m4 | 32 +++++++++++++++++++++++++ > + 7 files changed, 40 insertions(+), 4 deletions(-) > + > +diff --git a/camlibs/ax203/ax203.c b/camlibs/ax203/ax203.c > +index 62f572686c44..b9db8ebdabf1 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 674ab7128f8e..22ba2ac1e2c7 100644 > +--- a/camlibs/ax203/jpeg_memsrcdest.h > ++++ b/camlibs/ax203/jpeg_memsrcdest.h > +@@ -5,6 +5,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 dff2d6264025..8c3307fd6098 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 4334e099688a..94fca070d05b 100644 > +--- a/camlibs/jl2005c/jpeg_memsrcdest.h > ++++ b/camlibs/jl2005c/jpeg_memsrcdest.h > +@@ -5,6 +5,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 2787a7261c4a..2646c3ba0fb1 100644 > +--- a/camlibs/ptp2/chdk.c > ++++ b/camlibs/ptp2/chdk.c > +@@ -1145,7 +1145,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/libgphoto2_port/gphoto-m4/gp-libjpeg.m4 b/libgphoto2_port/gphoto-m4/gp-libjpeg.m4 > +index ce9e816fdbce..4870882a686d 100644 > +--- a/libgphoto2_port/gphoto-m4/gp-libjpeg.m4 > ++++ b/libgphoto2_port/gphoto-m4/gp-libjpeg.m4 > +@@ -77,6 +77,38 @@ found and made to work. > + GP_CONFIG_MSG([JPEG mangling support], > + [${have_libjpeg}]) > + ]) > ++ 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]) > + ], > + [AC_MSG_ERROR([ > + Unhandled value given to --with-jpeg: ${with_jpeg} > +-- > +2.43.0 > + > diff --git a/package/libgphoto2/libgphoto2.mk b/package/libgphoto2/libgphoto2.mk > index 95c0190ee63d..4265d1c57e10 100644 > --- a/package/libgphoto2/libgphoto2.mk > +++ b/package/libgphoto2/libgphoto2.mk > @@ -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) > +# 0001-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 To unsubscribe from this group and stop receiving emails from it, send an email to linux-amarula+unsubscribe@amarulasolutions.com.
diff --git a/package/libgphoto2/0001-autoconf-checks-for-the-size-type-of-jpeg_mem_dest.patch b/package/libgphoto2/0001-autoconf-checks-for-the-size-type-of-jpeg_mem_dest.patch new file mode 100644 index 000000000000..543678181b06 --- /dev/null +++ b/package/libgphoto2/0001-autoconf-checks-for-the-size-type-of-jpeg_mem_dest.patch @@ -0,0 +1,143 @@ +From ca4441f48117c681cecfb3c883115e0546aed985 Mon Sep 17 00:00:00 2001 +From: Marcus Meissner <marcus@jet.franken.de> +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 + +Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> +Upstream: https://github.com/gphoto/libgphoto2/commit/ca4441f48117c681cecfb3c883115e0546aed985 +--- + 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 +- + libgphoto2_port/gphoto-m4/gp-libjpeg.m4 | 32 +++++++++++++++++++++++++ + 7 files changed, 40 insertions(+), 4 deletions(-) + +diff --git a/camlibs/ax203/ax203.c b/camlibs/ax203/ax203.c +index 62f572686c44..b9db8ebdabf1 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 674ab7128f8e..22ba2ac1e2c7 100644 +--- a/camlibs/ax203/jpeg_memsrcdest.h ++++ b/camlibs/ax203/jpeg_memsrcdest.h +@@ -5,6 +5,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 dff2d6264025..8c3307fd6098 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 4334e099688a..94fca070d05b 100644 +--- a/camlibs/jl2005c/jpeg_memsrcdest.h ++++ b/camlibs/jl2005c/jpeg_memsrcdest.h +@@ -5,6 +5,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 2787a7261c4a..2646c3ba0fb1 100644 +--- a/camlibs/ptp2/chdk.c ++++ b/camlibs/ptp2/chdk.c +@@ -1145,7 +1145,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/libgphoto2_port/gphoto-m4/gp-libjpeg.m4 b/libgphoto2_port/gphoto-m4/gp-libjpeg.m4 +index ce9e816fdbce..4870882a686d 100644 +--- a/libgphoto2_port/gphoto-m4/gp-libjpeg.m4 ++++ b/libgphoto2_port/gphoto-m4/gp-libjpeg.m4 +@@ -77,6 +77,38 @@ found and made to work. + GP_CONFIG_MSG([JPEG mangling support], + [${have_libjpeg}]) + ]) ++ 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]) + ], + [AC_MSG_ERROR([ + Unhandled value given to --with-jpeg: ${with_jpeg} +-- +2.43.0 + diff --git a/package/libgphoto2/libgphoto2.mk b/package/libgphoto2/libgphoto2.mk index 95c0190ee63d..4265d1c57e10 100644 --- a/package/libgphoto2/libgphoto2.mk +++ b/package/libgphoto2/libgphoto2.mk @@ -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) +# 0001-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
The commit adds an 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 * Fixes: - https://autobuild.buildroot.org/results/cb983d9ad90170aa8d7f2b9a5dfc30055d83b5de Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> --- ...s-for-the-size-type-of-jpeg_mem_dest.patch | 143 ++++++++++++++++++ package/libgphoto2/libgphoto2.mk | 2 + 2 files changed, 145 insertions(+) create mode 100644 package/libgphoto2/0001-autoconf-checks-for-the-size-type-of-jpeg_mem_dest.patch