Opened 4 years ago

Closed 4 years ago

#60694 closed defect (duplicate)

gdal needs a patch to build against chalrs 2.1

Reported by: bal-agates Owned by: Veence (Vincent)
Priority: Normal Milestone:
Component: ports Version: 2.6.2
Keywords: Cc:
Port: gdal

Description

I ran into problems trying to upgrade grass7 which attempted to rebuild gdal and charls. charls 2.1.0 seemed to build OK but gdal had problems. At least one of the problems appears directly related to charls @2.1.0_0 sourcecode. The 2.1.0 release of ./include/charls/public_types.h contains a duplicate enum value for ParameterValueNotSupported and InvalidCompressedData. Apparently the compiler doesn't detect this until both are used in a case statement? After the 2.1.0 release of charls someone has made a fix

$ git diff 6e7249b60e429c5c5a38520f8c93dd24ef25401e public_types.h
diff --git a/include/charls/public_types.h b/include/charls/public_types.h
index 8e7974a..e6886ef 100644
--- a/include/charls/public_types.h
+++ b/include/charls/public_types.h
@@ -367,7 +367,7 @@ enum class jpegls_errc
     // Legacy enumerator names, will be removed in next major release. Not tagged with [[deprecated]] as that is a C++17 extension.
     OK = success,
     InvalidJlsParameters = invalid_argument,
-    ParameterValueNotSupported = invalid_encoded_data,
+    ParameterValueNotSupported = parameter_value_not_supported,
     UncompressedBufferTooSmall = destination_buffer_too_small,
     CompressedBufferTooSmall = source_buffer_too_small,
     InvalidCompressedData = invalid_encoded_data,

I didn't try patch public_types.h because there were many other changes after the 2.1.0 release and I didn't want to research those. I reverted back to charls @2.0.0_1 and then gdal successfully built. There was another problem that is likely a gdal project problem (?) in that jpeglsdataset.cpp used conditional compile directives with variables CHARLS_2 and CHARLS_2_1 and even though I had charls 2.1.0 installed CHARLS_2_1 was not set. Only CHARLS_2 was set.

Here is a snippet with GDAL build errors

:info:build jpeglsdataset.cpp:126:35: error: no member named 'ImageTypeNotSupported' in 'charls::jpegls_errc'
:info:build         case CharlsApiResultType::ImageTypeNotSupported: return "ImageTypeNotSupported";
:info:build              ~~~~~~~~~~~~~~~~~~~~~^
:info:build jpeglsdataset.cpp:127:35: error: no member named 'UnsupportedBitDepthForTransform' in 'charls::jpegls_errc'; did you mean 'UnsupportedColorTransform'?
:info:build         case CharlsApiResultType::UnsupportedBitDepthForTransform: return "UnsupportedBitDepthForTransform";
:info:build              ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:info:build                                   UnsupportedColorTransform
:info:build /opt/local/include/CharLS/public_types.h:360:5: note: 'UnsupportedColorTransform' declared here
:info:build     UnsupportedColorTransform = color_transform_not_supported,
:info:build     ^
:info:build jpeglsdataset.cpp:125:14: error: duplicate case value: 'ParameterValueNotSupported' and 'InvalidCompressedData' both equal '5'
:info:build         case CharlsApiResultType::InvalidCompressedData: return "InvalidCompressedData";
:info:build              ^
:info:build jpeglsdataset.cpp:121:14: note: previous case defined here
:info:build         case CharlsApiResultType::ParameterValueNotSupported: return "ParameterValueNotSupported";
:info:build              ^
:info:build jpeglsdataset.cpp:129:14: error: duplicate case value 'UnsupportedColorTransform'
:info:build         case CharlsApiResultType::UnsupportedColorTransform: return "UnsupportedColorTransform";
:info:build              ^
:info:build jpeglsdataset.cpp:127:14: note: previous case defined here
:info:build         case CharlsApiResultType::UnsupportedBitDepthForTransform: return "UnsupportedBitDepthForTransform";
:info:build              ^
:info:build 4 errors generated.
:info:build make[2]: *** [../o/jpeglsdataset.lo] Error 1
:info:build make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_gis_gdal/gdal/work/gdal-3.1.0/gdal/frmts/jpegls'
:info:build make[1]: *** [jpegls-install-obj] Error 2

Change History (5)

comment:1 Changed 4 years ago by kencu (Ken)

duplicate of 60625 which has a link to an upstream patch for gdal.

Just waiting for someone to do it.

comment:2 Changed 4 years ago by kencu (Ken)

Keywords: charls gdal grass7 duplicate enum removed
Port: gdal added; charls removed
Summary: charls duplicate enum caused gdal build failuregdal needs a patch to build against chals 2.1

comment:3 Changed 4 years ago by kencu (Ken)

Summary: gdal needs a patch to build against chals 2.1gdal needs a patch to build against chalrs 2.1

comment:4 Changed 4 years ago by kencu (Ken)

Owner: set to Veence
Status: newassigned

comment:5 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: duplicate
Status: assignedclosed
Note: See TracTickets for help on using tickets.