[MacPorts] #60694: charls duplicate enum caused gdal build failure
MacPorts
noreply at macports.org
Mon Jun 22 15:22:32 UTC 2020
#60694: charls duplicate enum caused gdal build failure
-----------------------------------------------+--------------------
Reporter: bal-agates | Owner: (none)
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version: 2.6.2
Keywords: charls gdal grass7 duplicate enum | Port: charls
-----------------------------------------------+--------------------
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
}}}
--
Ticket URL: <https://trac.macports.org/ticket/60694>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list