team-charls/charls

[2.1.0] gcc 5 fails to find charls::interleave_mode in charls_jpegls_decoder.cpp

SpaceIm opened this issue · 2 comments

gcc5 fails to compile charls_jpegls_decoder.cpp (similar issue than #55)

[ 22%] Building CXX object source_subfolder/CMakeFiles/charls.dir/src/charls_jpegls_encoder.cpp.o
/home/conan/.conan/data/charls/2.1.0/bincrafters/testing/build/2de3d908e1d9b246c9b2b6ea5c083ff1297f138b/source_subfolder/src/charls_jpegls_decoder.cpp: In member function ‘size_t charls_jpegls_decoder::destination_size(uint32_t) const’:
/home/conan/.conan/data/charls/2.1.0/bincrafters/testing/build/2de3d908e1d9b246c9b2b6ea5c083ff1297f138b/source_subfolder/src/charls_jpegls_decoder.cpp:106:14: error: ‘interleave_mode’ is not a class, namespace, or enumeration
         case interleave_mode::none:
              ^
/home/conan/.conan/data/charls/2.1.0/bincrafters/testing/build/2de3d908e1d9b246c9b2b6ea5c083ff1297f138b/source_subfolder/src/charls_jpegls_decoder.cpp:109:14: error: ‘interleave_mode’ is not a class, namespace, or enumeration
         case interleave_mode::line:
              ^
/home/conan/.conan/data/charls/2.1.0/bincrafters/testing/build/2de3d908e1d9b246c9b2b6ea5c083ff1297f138b/source_subfolder/src/charls_jpegls_decoder.cpp:110:14: error: ‘interleave_mode’ is not a class, namespace, or enumeration
         case interleave_mode::sample:
              ^
source_subfolder/CMakeFiles/charls.dir/build.make:62: recipe for target 'source_subfolder/CMakeFiles/charls.dir/src/charls_jpegls_decoder.cpp.o' failed

Here is a patch (for 2.1.0) which fix this issue:

--- a/src/charls_jpegls_decoder.cpp
+++ b/src/charls_jpegls_decoder.cpp
@@ -103,11 +103,11 @@ struct charls_jpegls_decoder final

         switch (interleave_mode())
         {
-        case interleave_mode::none:
+        case charls::interleave_mode::none:
             return static_cast<size_t>(stride) * info.height * info.component_count;

-        case interleave_mode::line:
-        case interleave_mode::sample:
+        case charls::interleave_mode::line:
+        case charls::interleave_mode::sample:
             return static_cast<size_t>(stride) * info.height;
         }

Thanks for the patch, I will merge it.

Both the GCC 5 and GCC 6 Release series are not supported anymore, see https://www.gnu.org/software/gcc/gcc-6/

For that reason the current Azure DevOps CI pipelines uses GCC 7 to check if the CharLS can be compiled with GCC. Is it important for a Conan package to support GCC 5?

The main reason I ask is that ensuring that GCC 5 can be used as a compiler is difficult if there is no option to check if automatically and most free CI systems provide GCC 7 as the minimum.

Here you can see triplets conan public repository tries to support for each recipe: https://github.com/conan-io/conan-center-index/wiki/Supported-Platforms-And-Configurations

For example, on Windows, MinGW support is best effort.

Anyway, if a library does not support specifics triplets, it's perfectly fine, but packagers have to clearly identify these cases and raise an error to inform consumers (and allow CI to not fail). It just puts more pressure to packagers in order to maintain recipes for these libraries.
For example, for CharLS, I decided to drop gcc 4.9 support, because it would have required a big patch.

GitHub actions have support for at least gcc 4.9 and clang 3.9 : https://github.com/SpaceIm/conan-charls/actions/runs/49700598