team-charls/charls

gcc-5 compilation fail

Czaki opened this issue · 2 comments

Czaki commented

In version 2.1.0rc1 on gcc-5 the configuration of cmake pass, but compilation fail.

Cmake configuration

Build charls
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building as master project, CMake version: 3.12.4
-- Configuring done
-- Generating done

Error info

[ 10%] Building CXX object CMakeFiles/charls.dir/src/charls_jpegls_encoder.cpp.o
/home/vsts/work/1/s/build_utils/libs_src/charls/src/charls_jpegls_encoder.cpp: In member function ‘void charls_jpegls_encoder::encode(const void*, size_t, uint32_t)’:
/home/vsts/work/1/s/build_utils/libs_src/charls/src/charls_jpegls_encoder.cpp:148:37: error: ‘interleave_mode’ is not a class, namespace, or enumeration
             if (interleave_mode_ != interleave_mode::none)
                                     ^
/home/vsts/work/1/s/build_utils/libs_src/charls/src/charls_jpegls_encoder.cpp:165:38: error: ‘color_transformation’ is not a class, namespace, or enumeration
         if (color_transformation_ != color_transformation::none)
                                      ^
/home/vsts/work/1/s/build_utils/libs_src/charls/src/charls_jpegls_encoder.cpp:181:33: error: ‘interleave_mode’ is not a class, namespace, or enumeration
         if (interleave_mode_ == interleave_mode::none)
                                 ^
CMakeFiles/charls.dir/build.make:75: recipe for target 'CMakeFiles/charls.dir/src/charls_jpegls_encoder.cpp.o' failed

I have seen this problem before, GCC 5.x seems to have problems with enum name lookup when a class has a member function with the same name. GCC 7.4.0 (used by the CI build environment) has no problems with it and MSVC and clang can also compile this file without problems.
I have pushed commit 4a97b98 with additional namespace prefix to make v.2.1.0 compatible with GCC 5.4.

Can you check if this solves the issue? (my current VMs have only GCC 7.x and 8.x available)

Czaki commented

Yes. It works for me (i test on azure pipelines).