gphoto / libgphoto2

The libgphoto2 camera access and control library.
GNU Lesser General Public License v2.1
989 stars 316 forks source link

Build failure with stricter C compilers (e.g. GCC 14) #941

Closed thesamesam closed 7 months ago

thesamesam commented 7 months ago

Describe the bug

Modern C compilers are becoming stricter with a variety of changes over the last year or so.

GCC 14 in particular (to be released in ~April 2024) fails to build libgphoto2-2.5.31 like:

/var/tmp/portage/media-libs/libgphoto2-2.5.31/work/libgphoto2-2.5.31/camlibs/ptp2/chdk.c: In function 'yuv_live_to_jpeg':
/var/tmp/portage/media-libs/libgphoto2-2.5.31/work/libgphoto2-2.5.31/camlibs/ptp2/chdk.c:1187:41: error: passing argument 3 of 'jpeg_mem_dest' from incompatible pointer type [-Wincompatible-pointer-types]
 1187 |         jpeg_mem_dest (&cinfo, &outbuf, &outlen);
      |                                         ^~~~~~~
      |                                         |
      |                                         uint64_t * {aka long long unsigned int *}
In file included from /var/tmp/portage/media-libs/libgphoto2-2.5.31/work/libgphoto2-2.5.31/camlibs/ptp2/chdk.c:32:
/usr/include/jpeglib.h:975:43: note: expected 'long unsigned int *' but argument is of type 'uint64_t *' {aka 'long long unsigned int *'}
  975 |                            unsigned long *outsize);
      |                            ~~~~~~~~~~~~~~~^~~~~~~
make[3]: *** [Makefile:4257: ptp2/la-chdk.lo] Error 1

Originally reported downstream in Gentoo at https://bugs.gentoo.org/919086.

Name the camera N/A

libgphoto2 and gphoto2 version libgphoto2-2.5.1

To Reproduce Steps to reproduce the behavior: This can be emulated with -Werror=incompatible-pointer-types -Werror=implicit -Werror=int-conversion on an older GCC or Clang.

msmeissn commented 7 months ago

thanks, should be fixed

thesamesam commented 7 months ago

That works, thanks a bunch for the quick fix!