View Ticket
Not logged in
2018-07-29
11:03 Closed ticket [f3f2e7d32b]: Fails to build with OpenJPEG 2.3.0 plus 4 other changes artifact: b06ce18cf6 user: sandro
2017-10-18
14:58 Ticket [f3f2e7d32b]: 3 changes artifact: 0a9064c690 user: anonymous
14:43 Ticket [f3f2e7d32b]: 5 changes artifact: 02496fbc03 user: anonymous
2017-10-06
23:31 New ticket [f3f2e7d32b]. artifact: 6d202d3ac5 user: anonymous

Ticket Hash: f3f2e7d32bf737e746ee86a78342d373ff7c9e74
Title: Fails to build with OpenJPEG 2.3.0
Status: Closed Type: Build_Problem
Severity: Critical Priority: Immediate
Subsystem: Resolution: Fixed
Last Modified: 2018-07-29 11:03:03
Version Found In: trunk
User Comments:
anonymous added on 2017-10-06 23:31:38:
> checking openjpeg-2.0/openjpeg.h usability... no
> checking openjpeg-2.0/openjpeg.h presence... no
> checking for openjpeg-2.0/openjpeg.h... no
> checking openjpeg-2.1/openjpeg.h usability... no
> checking openjpeg-2.1/openjpeg.h presence... no
> checking for openjpeg-2.1/openjpeg.h... no
> checking openjpeg-2.2/openjpeg.h usability... no
> checking openjpeg-2.2/openjpeg.h presence... no
> checking for openjpeg-2.2/openjpeg.h... no
> configure: error: 'OpenJpeg-2' is required but the header (openjpeg.h) doesn't seem to be installed on this system

The openjpeg-2.3 directory is not checked, and the conditional in the code only supports 2.0, 2.1 or 2.2.

anonymous added on 2017-10-18 14:43:43:
The following patch was added to the Debian package:

Description: Add support for OpenJPEG 2.3.
Author: Bas Couwennberg <sebastic@debian.org>
Bug: https://www.gaia-gis.it/fossil/librasterlite2/info/f3f2e7d32bf737e7

--- a/config.h.in
+++ b/config.h.in
@@ -73,6 +73,9 @@
 /* Define to 1 if you have the <openjpeg-2.2/openjpeg.h> header file. */
 #undef HAVE_OPENJPEG_2_2_OPENJPEG_H

+/* Define to 1 if you have the <openjpeg-2.3/openjpeg.h> header file. */
+#undef HAVE_OPENJPEG_2_3_OPENJPEG_H
+
 /* Define to 1 if you have the <png.h> header file. */
 #undef HAVE_PNG_H

@@ -160,6 +163,9 @@
 /* testing for OpenJpeg 2.2 */
 #undef OPENJPEG_2_2

+/* testing for OpenJpeg 2.3 */
+#undef OPENJPEG_2_3
+
 /* Name of package */
 #undef PACKAGE

--- a/configure.ac
+++ b/configure.ac
@@ -32,6 +32,8 @@ AH_TEMPLATE([OPENJPEG_2_1],
             [testing for OpenJpeg 2.1])
 AH_TEMPLATE([OPENJPEG_2_2],
             [testing for OpenJpeg 2.2])
+AH_TEMPLATE([OPENJPEG_2_3],
+            [testing for OpenJpeg 2.3])

 # config depending options
 AH_TEMPLATE([OMIT_LZMA],
@@ -152,13 +154,16 @@ AC_ARG_ENABLE(openjpeg, [AS_HELP_STRING(
     # they could be either on -/include/openjpeg-2.0
     #                   or on -/include/openjpeg-2.1
     #                   or on -/include/openjpeg-2.2
+    #                   or on -/include/openjpeg-2.3
     #
     AC_CHECK_HEADERS(openjpeg-2.0/openjpeg.h)
     AC_CHECK_HEADERS(openjpeg-2.1/openjpeg.h)
     AC_CHECK_HEADERS(openjpeg-2.2/openjpeg.h)
+    AC_CHECK_HEADERS(openjpeg-2.3/openjpeg.h)
     if test x"$ac_cv_header_openjpeg_2_0_openjpeg_h" != x"yes" &&
         test x"$ac_cv_header_openjpeg_2_1_openjpeg_h" != x"yes" &&
-        test x"$ac_cv_header_openjpeg_2_2_openjpeg_h" != x"yes";
+        test x"$ac_cv_header_openjpeg_2_2_openjpeg_h" != x"yes" &&
+        test x"$ac_cv_header_openjpeg_2_3_openjpeg_h" != x"yes";
     then
         AC_MSG_ERROR(['OpenJpeg-2' is required but the header (openjpeg.h) doesn't seem to be installed on this system])
     fi
--- a/src/rl2openjpeg.c
+++ b/src/rl2openjpeg.c
@@ -63,6 +63,9 @@ the terms of any one of the MPL, the GPL
 #ifdef HAVE_OPENJPEG_2_2_OPENJPEG_H
 #include <openjpeg-2.2/openjpeg.h>
 #else
+#ifdef HAVE_OPENJPEG_2_3_OPENJPEG_H
+#include <openjpeg-2.3/openjpeg.h>
+#else
 #ifdef __ANDROID__             /* Android specific */
 #include <openjpeg.h>
 #else
@@ -70,6 +73,7 @@ the terms of any one of the MPL, the GPL
 #endif
 #endif
 #endif
+#endif

 struct jp2_memfile
 {
@@ -404,7 +408,7 @@ compress_jpeg2000 (rl2RasterPtr ptr, uns
     opj_stream_set_write_function (stream, write_callback);
     opj_stream_set_seek_function (stream, seek_callback);
     opj_stream_set_skip_function (stream, skip_callback);
-#if defined(HAVE_OPENJPEG_2_1_OPENJPEG_H) || defined(HAVE_OPENJPEG_2_2_OPENJPEG_H)
+#if defined(HAVE_OPENJPEG_2_1_OPENJPEG_H) || defined(HAVE_OPENJPEG_2_2_OPENJPEG_H) || defined(HAVE_OPENJPEG_2_3_OPENJPEG_H)
     opj_stream_set_user_data (stream, &clientdata, NULL);
 #else
     opj_stream_set_user_data (stream, &clientdata);
@@ -764,7 +768,7 @@ rl2_decode_jpeg2000_scaled (int scale, c
     clientdata.size = jpeg2000_sz;
     clientdata.eof = jpeg2000_sz;
     clientdata.current = 0;
-#if defined(HAVE_OPENJPEG_2_1_OPENJPEG_H) || defined(HAVE_OPENJPEG_2_2_OPENJPEG_H)
+#if defined(HAVE_OPENJPEG_2_1_OPENJPEG_H) || defined(HAVE_OPENJPEG_2_2_OPENJPEG_H) || defined(HAVE_OPENJPEG_2_3_OPENJPEG_H)
     opj_stream_set_user_data (stream, &clientdata, NULL);
 #else
     opj_stream_set_user_data (stream, &clientdata);
@@ -1336,7 +1340,7 @@ rl2_get_jpeg2000_infos (const char *path
     clientdata.size = jpeg2000_sz;
     clientdata.eof = jpeg2000_sz;
     clientdata.current = 0;
-#if defined(HAVE_OPENJPEG_2_1_OPENJPEG_H) || defined(HAVE_OPENJPEG_2_2_OPENJPEG_H)
+#if defined(HAVE_OPENJPEG_2_1_OPENJPEG_H) || defined(HAVE_OPENJPEG_2_2_OPENJPEG_H) || defined(HAVE_OPENJPEG_2_3_OPENJPEG_H)
     opj_stream_set_user_data (stream, &clientdata, NULL);
 #else
     opj_stream_set_user_data (stream, &clientdata);
@@ -1437,7 +1441,7 @@ rl2_get_jpeg2000_blob_type (const unsign
     clientdata.size = jpeg2000_sz;
     clientdata.eof = jpeg2000_sz;
     clientdata.current = 0;
-#if defined(HAVE_OPENJPEG_2_1_OPENJPEG_H) || defined(HAVE_OPENJPEG_2_2_OPENJPEG_H)
+#if defined(HAVE_OPENJPEG_2_1_OPENJPEG_H) || defined(HAVE_OPENJPEG_2_2_OPENJPEG_H) || defined(HAVE_OPENJPEG_2_3_OPENJPEG_H)
     opj_stream_set_user_data (stream, &clientdata, NULL);
 #else
     opj_stream_set_user_data (stream, &clientdata);

anonymous added on 2017-10-18 14:58:29:
Changing the config script for every minor openjpeg version bump doesn't scale.

Please use pkg-config instead. GDAL has started doing this recently too, see:

 http://trac.osgeo.org/gdal/changeset/40329
 http://trac.osgeo.org/gdal/changeset/40331

sandro added on 2018-07-29 11:03:03:
fixed by commit e3d324390b