ttlappalainen / NMEA2000

NMEA2000 library for Arduino
533 stars 222 forks source link

problems compiling catch.cpp with GCC compiler #240

Open tdjastrzebski opened 3 years ago

tdjastrzebski commented 3 years ago

An error was thrown compiling catch.hpp with GCC compiler (GNU Arm Embedded Toolchain 10.3-2021.07)

NMEA2000/third-party/catch/catch.hpp:6516:27: error: 'SA_ONSTACK' was not declared in this scope; did you mean 'SS_ONSTACK'?
 6516 |             sa.sa_flags = SA_ONSTACK;
      |                           ^~~~~~~~~~
      |                           SS_ONSTACK

SA_ONSTACK is not found anywhere. Is there any external module/library required?

catch.cpp also causes a bunch of warnings which may indicate catch.hpp content is not compatible with latest GCC compiler. E.g.
parameter passing for argument of type '\_gnucxx::\_normaliterator<Catch::SectionEndInfo*, std::vector >' changed in GCC 7.1

Issued command:
arm-none-eabi-g++ -std=gnu++17 -c -mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard --specs=nano.specs -mthumb -ffunction-sections -fdata-sections -fno-rtti -fno-use-cxa-atexit -Wall -fstack-usage -MMD -MP -MFcatch.o -MTcatch.o -O0 -g catch.cpp -o catch.o

Complete output:

In file included from c:\program files (x86)\gnu arm embedded toolchain\11 2021-q2\arm-none-eabi\include\c++\10.3.1\vector:67,
                 from c:\program files (x86)\gnu arm embedded toolchain\11 2021-q2\arm-none-eabi\include\c++\10.3.1\functional:62,
                 from c:\program files (x86)\gnu arm embedded toolchain\11 2021-q2\arm-none-eabi\include\c++\10.3.1\pstl\glue_algorithm_defs.h:13,
                 from c:\program files (x86)\gnu arm embedded toolchain\11 2021-q2\arm-none-eabi\include\c++\10.3.1\algorithm:74,
                 from NMEA2000/third-party/catch/catch.hpp:378,
                 from NMEA2000/third-party/catch/catch.cpp:26:
c:\program files (x86)\gnu arm embedded toolchain\11 2021-q2\arm-none-eabi\include\c++\10.3.1\bits\stl_vector.h: In member function 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = Catch::SectionEndInfo; _Alloc = std::allocator<Catch::SectionEndInfo>]':c:\program files (x86)\gnu arm embedded toolchain\11 2021-q2\arm-none-eabi\include\c++\10.3.1\bits\stl_vector.h:1198:21: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<Catch::SectionEndInfo*, std::vector<Catch::SectionEndInfo> >' changed in GCC 7.1 
 1198 |    _M_realloc_insert(end(), __x);
      |    ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
c:\program files (x86)\gnu arm embedded toolchain\11 2021-q2\arm-none-eabi\include\c++\10.3.1\bits\stl_vector.h: In member function 'std::vector<_Tp, _Alloc>::reverse_iterator std::vector<_Tp, _Alloc>::rbegin() [with _Tp = Catch::SectionEndInfo; _Alloc = std::allocator<Catch::SectionEndInfo>]':
c:\program files (x86)\gnu arm embedded toolchain\11 2021-q2\arm-none-eabi\include\c++\10.3.1\bits\stl_vector.h:848:38: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<Catch::SectionEndInfo*, std::vector<Catch::SectionEndInfo> >' changed in GCC 7.1  
  848 |       { return reverse_iterator(end()); }
      |                                      ^
c:\program files (x86)\gnu arm embedded toolchain\11 2021-q2\arm-none-eabi\include\c++\10.3.1\bits\stl_vector.h: In member function 'std::vector<_Tp, _Alloc>::reverse_iterator std::vector<_Tp, _Alloc>::rend() [with _Tp = Catch::SectionEndInfo; _Alloc = std::allocator<Catch::SectionEndInfo>]':
c:\program files (x86)\gnu arm embedded toolchain\11 2021-q2\arm-none-eabi\include\c++\10.3.1\bits\stl_vector.h:866:40: note: parameter passing for argument of type '__gnu_cxx::__normal\_iterator<Catch::SectionEndInfo*, std::vector<Catch::SectionEndInfo> >' changed in GCC 7.1  
  866 |       { return reverse_iterator(begin()); }
      |                                        ^
In file included from c:\program files (x86)\gnu arm embedded toolchain\11 2021-q2\arm-none-eabi\include\c++\10.3.1\vector:72,
                 from c:\program files (x86)\gnu arm embedded toolchain\11 2021-q2\arm-none-eabi\include\c++\10.3.1\functional:62,
                 from c:\program files (x86)\gnu arm embedded toolchain\11 2021-q2\arm-none-eabi\include\c++\10.3.1\pstl\glue_algorithm_defs.h:13,
                 from c:\program files (x86)\gnu arm embedded toolchain\11 2021-q2\arm-none-eabi\include\c++\10.3.1\algorithm:74,
                 from NMEA2000/third-party/catch/catch.hpp:378,
                 from NMEA2000/third-party/catch/catch.cpp:26:
c:\program files (x86)\gnu arm embedded toolchain\11 2021-q2\arm-none-eabi\include\c++\10.3.1\bits\vector.tcc: In member function 'void std::vector<_Tp, _Alloc>::_M_realloc_insert(std::vector<_Tp, _Alloc>::iterator, _Args&& ...) [with _Args = {const Catch::SectionEndInfo&}; _Tp = Catch::SectionEndInfo; _Alloc = std::allocator<Catch::SectionEndInfo>]':
c:\program files (x86)\gnu arm embedded toolchain\11 2021-q2\arm-none-eabi\include\c++\10.3.1\bits\vector.tcc:426:7: note: parameter passing for argument of type 'std::vector<Catch::SectionEndInfo>::iterator' changed in GCC 7.1
  426 |       vector<_Tp, _Alloc>::
      |       ^~~~~~~~~~~~~~~~~~~
In file included from c:\program files (x86)\gnu arm embedded toolchain\11 2021-q2\arm-none-eabi\include\c++\10.3.1\bits\stl_algobase.h:67,
                 from c:\program files (x86)\gnu arm embedded toolchain\11 2021-q2\arm-none-eabi\include\c++\10.3.1\bits\char_traits.h:39,
                 from c:\program files (x86)\gnu arm embedded toolchain\11 2021-q2\arm-none-eabi\include\c++\10.3.1\ios:40,
                 from c:\program files (x86)\gnu arm embedded toolchain\11 2021-q2\arm-none-eabi\include\c++\10.3.1\istream:38,
                 from c:\program files (x86)\gnu arm embedded toolchain\11 2021-q2\arm-none-eabi\include\c++\10.3.1\sstream:38,
                 from NMEA2000/third-party/catch/catch.hpp:377,
                 from NMEA2000/third-party/catch/catch.cpp:26:
c:\program files (x86)\gnu arm embedded toolchain\11 2021-q2\arm-none-eabi\include\c++\10.3.1\bits\stl_iterator.h: In constructor 'constexpr std::reverse_iterator<_Iterator>::reverse_iterator(std::reverse_iterator<_Iterator>::iterator_type) [with _Iterator = __gnu_cxx::__normal_iterator<Catch::SectionEndInfo*, std::vector<Catch::SectionEndInfo> >]':
c:\program files (x86)\gnu arm embedded toolchain\11 2021-q2\arm-none-eabi\include\c++\10.3.1\bits\stl_iterator.h:170:7: note: parameter passing for argument of type 'std::reverse_iterator<__gnu_cxx::__normal_iterator<Catch::SectionEndInfo*, std::vector<Catch::SectionEndInfo> 
> >::iterator_type' changed in GCC 7.1
  170 |       reverse_iterator(iterator_type __x) : current(__x) { }
      |       ^~~~~~~~~~~~~~~~
tdjastrzebski commented 3 years ago

Am I correct that catch.cpp may be excluded from a build for STM32?

denravonska commented 3 years ago

Catch is for running unit tests so I'd say yes, you're correct.