ermig1979 / Simd

C++ image processing and machine learning library with using of SIMD: SSE, AVX, AVX-512, AMX for x86/x64, VMX(Altivec) and VSX(Power7) for PowerPC, NEON for ARM.
http://ermig1979.github.io/Simd
MIT License
2.04k stars 407 forks source link

Fails to compile with GCC 10 #131

Closed facug91 closed 3 years ago

facug91 commented 3 years ago

I'm working in Ubuntu 18.04, more precisely in this Docker image ubuntu:18.04
I'm manually installing gcc with:

RUN apt-get update \
  && apt-get -y upgrade \
  && add-apt-repository ppa:ubuntu-toolchain-r/test \
  && apt-get install -y \
    gcc-10 g++-10 \
  && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10 \
  && update-alternatives --set gcc "/usr/bin/gcc-10" 

Which is installing gcc 10.1 When I want to compile the latest release, it throws the following error:

In file included from /usr/include/c++/10/bits/locale_conv.h:41,
                 from /usr/include/c++/10/locale:43,
                 from /usr/include/c++/10/iomanip:43,
                 from /home/investigacion/dep/Simd/prj/cmake/../../src/Simd/SimdLog.h:32,
                 from /home/investigacion/dep/Simd/prj/cmake/../../src/Simd/SimdStore.h:30,
                 from /home/investigacion/dep/Simd/src/Simd/SimdAvx2Gemm32f.cpp:24:
/usr/include/c++/10/bits/unique_ptr.h: In instantiation of 'constexpr std::unique_ptr<_Tp, _Dp>::unique_ptr() [with _Del = std::__future_base::_Result_base::_Deleter; <template-parameter-2-2> = void; _Tp = std::__future_base::_Result_base; _Dp = std::__future_base::_Result_base::_Deleter]':
/usr/include/c++/10/future:324:77:   required from here
/usr/include/c++/10/bits/unique_ptr.h:269:9: error: no matching function for call to 'std::__uniq_ptr_data<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter, true, true>::__uniq_ptr_data()'
  269 |  : _M_t()
      |         ^
/usr/include/c++/10/bits/unique_ptr.h:209:40: note: candidate: 'std::__uniq_ptr_data<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter, true, true>::__uniq_ptr_data(std::__uniq_ptr_impl<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>::pointer) [inherited from std::__uniq_ptr_impl<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>]'
  209 |       using __uniq_ptr_impl<_Tp, _Dp>::__uniq_ptr_impl;
      |                                        ^~~~~~~~~~~~~~~
/usr/include/c++/10/bits/unique_ptr.h:209:40: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/10/bits/unique_ptr.h:209:40: note: candidate: 'template<class _Del> std::__uniq_ptr_data<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter, true, true>::__uniq_ptr_data(std::__uniq_ptr_impl<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>::pointer, _Del&&) [inherited from std::__uniq_ptr_impl<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>]'
/usr/include/c++/10/bits/unique_ptr.h:209:40: note:   template argument deduction/substitution failed:
/usr/include/c++/10/bits/unique_ptr.h:269:9: note:   candidate expects 2 arguments, 0 provided
  269 |  : _M_t()
      |         ^
/usr/include/c++/10/bits/unique_ptr.h:210:7: note: candidate: 'std::__uniq_ptr_data<_Tp, _Dp, <anonymous>, <anonymous> >::__uniq_ptr_data(std::__uniq_ptr_data<_Tp, _Dp, <anonymous>, <anonymous> >&&) [with _Tp = std::__future_base::_Result_base; _Dp = std::__future_base::_Result_base::_Deleter; bool <anonymous> = true; bool <anonymous> = true]'
  210 |       __uniq_ptr_data(__uniq_ptr_data&&) = default;
      |       ^~~~~~~~~~~~~~~
/usr/include/c++/10/bits/unique_ptr.h:210:7: note:   candidate expects 1 argument, 0 provided
[ 65%] Building CXX object CMakeFiles/Simd.dir/home/investigacion/dep/Simd/src/Simd/SimdAvx2HogLite.cpp.o
[ 65%] Building CXX object CMakeFiles/Simd.dir/home/investigacion/dep/Simd/src/Simd/SimdAvx2Int16ToGray.cpp.o
CMakeFiles/Simd.dir/build.make:3286: recipe for target 'CMakeFiles/Simd.dir/home/investigacion/dep/Simd/src/Simd/SimdAvx2Gemm32f.cpp.o' failed
make[3]: *** [CMakeFiles/Simd.dir/home/investigacion/dep/Simd/src/Simd/SimdAvx2Gemm32f.cpp.o] Error 1
make[3]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/Simd.dir/all' failed
make[2]: *** [CMakeFiles/Simd.dir/all] Error 2
CMakeFiles/Makefile2:111: recipe for target 'CMakeFiles/Simd.dir/rule' failed
make[1]: *** [CMakeFiles/Simd.dir/rule] Error 2
Makefile:131: recipe for target 'Simd' failed
make: *** [Simd] Error 2

I think there must be some class or struct that needs an explicit default constructor, but I cannot find which one.

ermig1979 commented 3 years ago

I have fixed this bug.

facug91 commented 3 years ago

Thanks!

facug91 commented 3 years ago

I've noticed that in GCC 10.2 (with Ubuntu 20.04) it's also happening. It might be good to fix that as well. I was about to make a pull request with that change, but I don't know if you wanted to do something like:

#if defined(__GNUC__) && (__GNUC__ == 10) && (__GNUC_MINOR__ >= 1)

or something more specific like:

#if defined(__GNUC__) && (__GNUC__ == 10) && (__GNUC_MINOR__ >= 1) && (__GNUC_MINOR__ <= 2)
ermig1979 commented 3 years ago

Of course you are right. This looks like more general solution.

sbudenkov commented 1 year ago

Hi, The problem is still visible with: Compiler Version: 11.3.0

ermig1979 commented 1 year ago

Hi! I just have built Simd with g++ 11.3.0. There are no errors.

sbudenkov commented 1 year ago

Maybe my version is outdated. Could you please point a version where the problem was fixed?

ermig1979 commented 1 year ago

The bug was fixed in version 4.6.95. The release was in November of 2020.

sbudenkov commented 1 year ago

Hi again, The problem is visible with 4.7.102 on Ubuntu 22.04. I'll try with the latest release 5.2.121.

sbudenkov commented 1 year ago

With 5.2.121 everything is ok.

ermig1979 commented 1 year ago

Thanks for testing of old version. I found very old error which wasn't fixed since 2017.