I'm trying to compile the libheif library from source on my fedora 39 machine. On both the latest tagged release and the master branch I run into this error:

I'm not sure what I'm doing wrong or how to fix it?

```
[ 87%] Building CXX object libheif/plugins/CMakeFiles/heif-j2kdec.dir/decoder_openjpeg.cc.o
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc: In function ‘const char* openjpeg_plugin_name()’:
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:46:3: error: ‘snprintf’ was not declared in this scope
   46 |   snprintf(plugin_name, MAX_PLUGIN_NAME_LENGTH, "OpenJPEG %s", opj_version());
      |   ^~~~~~~~
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:30:1: note: ‘snprintf’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’?
   29 | #include <cassert>
  +++ |+#include <cstdio>
   30 | 
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc: At global scope:
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:117:8: error: ‘OPJ_SIZE_T’ does not name a type
  117 | static OPJ_SIZE_T opj_memory_stream_read(void* p_buffer, OPJ_SIZE_T p_nb_bytes, void* p_user_data)
      |        ^~~~~~~~~~
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:149:8: error: ‘OPJ_SIZE_T’ does not name a type
  149 | static OPJ_SIZE_T opj_memory_stream_write(void* p_buffer, OPJ_SIZE_T p_nb_bytes, void* p_user_data)
      |        ^~~~~~~~~~
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:158:8: error: ‘OPJ_OFF_T’ does not name a type
  158 | static OPJ_OFF_T opj_memory_stream_skip(OPJ_OFF_T p_nb_bytes, void* p_user_data)
      |        ^~~~~~~~~
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:191:8: error: ‘OPJ_BOOL’ does not name a type
  191 | static OPJ_BOOL opj_memory_stream_seek(OPJ_OFF_T p_nb_bytes, void* p_user_data)
      |        ^~~~~~~~
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:220:1: error: ‘opj_stream_t’ does not name a type
  220 | opj_stream_t* opj_stream_create_default_memory_stream(openjpeg_decoder* p_decoder, OPJ_BOOL p_is_read_stream)
      | ^~~~~~~~~~~~
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc: In function ‘heif_error openjpeg_decode_image(void*, heif_image**)’:
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:256:3: error: ‘OPJ_BOOL’ was not declared in this scope
  256 |   OPJ_BOOL success;
      |   ^~~~~~~~
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:258:3: error: ‘opj_codec_t’ was not declared in this scope; did you mean ‘opj_poc_t’?
  258 |   opj_codec_t* l_codec;
      |   ^~~~~~~~~~~
      |   opj_poc_t
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:258:16: error: ‘l_codec’ was not declared in this scope
  258 |   opj_codec_t* l_codec;
      |                ^~~~~~~
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:262:35: error: ‘OPJ_CODEC_J2K’ was not declared in this scope; did you mean ‘CODEC_J2K’?
  262 |   l_codec = opj_create_decompress(OPJ_CODEC_J2K);
      |                                   ^~~~~~~~~~~~~
      |                                   CODEC_J2K
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:263:3: error: ‘success’ was not declared in this scope
  263 |   success = opj_setup_decoder(l_codec, &decompression_parameters);
      |   ^~~~~~~
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:272:11: error: expected ‘;’ before ‘is_read_stream’
  272 |   OPJ_BOOL is_read_stream = true;
      |           ^~~~~~~~~~~~~~~
      |           ;
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:273:3: error: ‘opj_stream_t’ was not declared in this scope
  273 |   opj_stream_t* stream = opj_stream_create_default_memory_stream(decoder, is_read_stream);
      |   ^~~~~~~~~~~~
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:273:17: error: ‘stream’ was not declared in this scope; did you mean ‘strcat’?
  273 |   opj_stream_t* stream = opj_stream_create_default_memory_stream(decoder, is_read_stream);
      |                 ^~~~~~
      |                 strcat
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:273:75: error: ‘is_read_stream’ was not declared in this scope
  273 |   opj_stream_t* stream = opj_stream_create_default_memory_stream(decoder, is_read_stream);
      |                                                                           ^~~~~~~~~~~~~~
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:273:26: error: ‘opj_stream_create_default_memory_stream’ was not declared in this scope
  273 |   opj_stream_t* stream = opj_stream_create_default_memory_stream(decoder, is_read_stream);
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:278:13: error: ‘opj_read_header’ was not declared in this scope
  278 |   success = opj_read_header(stream, l_codec, &image);
      |             ^~~~~~~~~~~~~~~
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:288:35: error: ‘OPJ_CLRSPC_UNSPECIFIED’ was not declared in this scope; did you mean ‘CLRSPC_UNSPECIFIED’?
  288 |   else if ((image->color_space != OPJ_CLRSPC_UNSPECIFIED) && (image->color_space != OPJ_CLRSPC_SRGB)) {
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
      |                                   CLRSPC_UNSPECIFIED
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:288:85: error: ‘OPJ_CLRSPC_SRGB’ was not declared in this scope; did you mean ‘CLRSPC_SRGB’?
  288 |   else if ((image->color_space != OPJ_CLRSPC_UNSPECIFIED) && (image->color_space != OPJ_CLRSPC_SRGB)) {
      |                                                                                     ^~~~~~~~~~~~~~~
      |                                                                                     CLRSPC_SRGB
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:306:13: error: ‘opj_end_decompress’ was not declared in this scope; did you mean ‘opj_create_decompress’?
  306 |   success = opj_end_decompress(l_codec, stream);
      |             ^~~~~~~~~~~~~~~~~~
      |             opj_create_decompress
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:314:3: error: ‘opj_stream_destroy’ was not declared in this scope; did you mean ‘opj_image_destroy’?
  314 |   opj_stream_destroy(stream);
      |   ^~~~~~~~~~~~~~~~~~
      |   opj_image_destroy
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:359:24: error: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int’ [-Werror=sign-compare]
  359 |   for (size_t c = 0; c < image->numcomps; c++) {
      |                      ~~^~~~~~~~~~~~~~~~~
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc: At global scope:
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:212:13: error: ‘void opj_memory_stream_do_nothing(void*)’ defined but not used [-Werror=unused-function]
  212 | static void opj_memory_stream_do_nothing(void* p_user_data)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [libheif/plugins/CMakeFiles/heif-j2kdec.dir/build.make:76: libheif/plugins/CMakeFiles/heif-j2kdec.dir/decoder_openjpeg.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:563: libheif/plugins/CMakeFiles/heif-j2kdec.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
```
Cannot compile OpenJPEG decoder plugin
This is a GitHub Issue
repo:libheif
owner:strukturag
Title : Cannot compile OpenJPEG decoder plugin
Issue date:

--- start body ---
I'm trying to compile the libheif library from source on my fedora 39 machine. On both the latest tagged release and the master branch I run into this error:

I'm not sure what I'm doing wrong or how to fix it?

```
[ 87%] Building CXX object libheif/plugins/CMakeFiles/heif-j2kdec.dir/decoder_openjpeg.cc.o
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc: In function ‘const char* openjpeg_plugin_name()’:
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:46:3: error: ‘snprintf’ was not declared in this scope
   46 |   snprintf(plugin_name, MAX_PLUGIN_NAME_LENGTH, "OpenJPEG %s", opj_version());
      |   ^~~~~~~~
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:30:1: note: ‘snprintf’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’?
   29 | #include <cassert>
  +++ |+#include <cstdio>
   30 | 
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc: At global scope:
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:117:8: error: ‘OPJ_SIZE_T’ does not name a type
  117 | static OPJ_SIZE_T opj_memory_stream_read(void* p_buffer, OPJ_SIZE_T p_nb_bytes, void* p_user_data)
      |        ^~~~~~~~~~
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:149:8: error: ‘OPJ_SIZE_T’ does not name a type
  149 | static OPJ_SIZE_T opj_memory_stream_write(void* p_buffer, OPJ_SIZE_T p_nb_bytes, void* p_user_data)
      |        ^~~~~~~~~~
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:158:8: error: ‘OPJ_OFF_T’ does not name a type
  158 | static OPJ_OFF_T opj_memory_stream_skip(OPJ_OFF_T p_nb_bytes, void* p_user_data)
      |        ^~~~~~~~~
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:191:8: error: ‘OPJ_BOOL’ does not name a type
  191 | static OPJ_BOOL opj_memory_stream_seek(OPJ_OFF_T p_nb_bytes, void* p_user_data)
      |        ^~~~~~~~
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:220:1: error: ‘opj_stream_t’ does not name a type
  220 | opj_stream_t* opj_stream_create_default_memory_stream(openjpeg_decoder* p_decoder, OPJ_BOOL p_is_read_stream)
      | ^~~~~~~~~~~~
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc: In function ‘heif_error openjpeg_decode_image(void*, heif_image**)’:
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:256:3: error: ‘OPJ_BOOL’ was not declared in this scope
  256 |   OPJ_BOOL success;
      |   ^~~~~~~~
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:258:3: error: ‘opj_codec_t’ was not declared in this scope; did you mean ‘opj_poc_t’?
  258 |   opj_codec_t* l_codec;
      |   ^~~~~~~~~~~
      |   opj_poc_t
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:258:16: error: ‘l_codec’ was not declared in this scope
  258 |   opj_codec_t* l_codec;
      |                ^~~~~~~
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:262:35: error: ‘OPJ_CODEC_J2K’ was not declared in this scope; did you mean ‘CODEC_J2K’?
  262 |   l_codec = opj_create_decompress(OPJ_CODEC_J2K);
      |                                   ^~~~~~~~~~~~~
      |                                   CODEC_J2K
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:263:3: error: ‘success’ was not declared in this scope
  263 |   success = opj_setup_decoder(l_codec, &decompression_parameters);
      |   ^~~~~~~
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:272:11: error: expected ‘;’ before ‘is_read_stream’
  272 |   OPJ_BOOL is_read_stream = true;
      |           ^~~~~~~~~~~~~~~
      |           ;
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:273:3: error: ‘opj_stream_t’ was not declared in this scope
  273 |   opj_stream_t* stream = opj_stream_create_default_memory_stream(decoder, is_read_stream);
      |   ^~~~~~~~~~~~
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:273:17: error: ‘stream’ was not declared in this scope; did you mean ‘strcat’?
  273 |   opj_stream_t* stream = opj_stream_create_default_memory_stream(decoder, is_read_stream);
      |                 ^~~~~~
      |                 strcat
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:273:75: error: ‘is_read_stream’ was not declared in this scope
  273 |   opj_stream_t* stream = opj_stream_create_default_memory_stream(decoder, is_read_stream);
      |                                                                           ^~~~~~~~~~~~~~
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:273:26: error: ‘opj_stream_create_default_memory_stream’ was not declared in this scope
  273 |   opj_stream_t* stream = opj_stream_create_default_memory_stream(decoder, is_read_stream);
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:278:13: error: ‘opj_read_header’ was not declared in this scope
  278 |   success = opj_read_header(stream, l_codec, &image);
      |             ^~~~~~~~~~~~~~~
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:288:35: error: ‘OPJ_CLRSPC_UNSPECIFIED’ was not declared in this scope; did you mean ‘CLRSPC_UNSPECIFIED’?
  288 |   else if ((image->color_space != OPJ_CLRSPC_UNSPECIFIED) && (image->color_space != OPJ_CLRSPC_SRGB)) {
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
      |                                   CLRSPC_UNSPECIFIED
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:288:85: error: ‘OPJ_CLRSPC_SRGB’ was not declared in this scope; did you mean ‘CLRSPC_SRGB’?
  288 |   else if ((image->color_space != OPJ_CLRSPC_UNSPECIFIED) && (image->color_space != OPJ_CLRSPC_SRGB)) {
      |                                                                                     ^~~~~~~~~~~~~~~
      |                                                                                     CLRSPC_SRGB
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:306:13: error: ‘opj_end_decompress’ was not declared in this scope; did you mean ‘opj_create_decompress’?
  306 |   success = opj_end_decompress(l_codec, stream);
      |             ^~~~~~~~~~~~~~~~~~
      |             opj_create_decompress
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:314:3: error: ‘opj_stream_destroy’ was not declared in this scope; did you mean ‘opj_image_destroy’?
  314 |   opj_stream_destroy(stream);
      |   ^~~~~~~~~~~~~~~~~~
      |   opj_image_destroy
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:359:24: error: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int’ [-Werror=sign-compare]
  359 |   for (size_t c = 0; c < image->numcomps; c++) {
      |                      ~~^~~~~~~~~~~~~~~~~
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc: At global scope:
/home/username/tmp/libheif-1.17.6/libheif/plugins/decoder_openjpeg.cc:212:13: error: ‘void opj_memory_stream_do_nothing(void*)’ defined but not used [-Werror=unused-function]
  212 | static void opj_memory_stream_do_nothing(void* p_user_data)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [libheif/plugins/CMakeFiles/heif-j2kdec.dir/build.make:76: libheif/plugins/CMakeFiles/heif-j2kdec.dir/decoder_openjpeg.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:563: libheif/plugins/CMakeFiles/heif-j2kdec.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
```
--- end body ---
