riebl/vanetza

Building Vanetza fails with GCC 12.1.0

awillecke opened this issue · 1 comments

Hi Raphael,

building the current master of Vanetza fails with GCC 12.1.0 because of a missing include of <array> in region.hpp:

[ 93%] Built target asn1
[ 93%] Building CXX object vanetza/security/CMakeFiles/security.dir/recipient_info.cpp.o
[ 93%] Building CXX object vanetza/security/CMakeFiles/security.dir/region.cpp.o
[ 93%] Building CXX object vanetza/security/CMakeFiles/security.dir/secured_message.cpp.o
In file included from <vanetza_dir>/vanetza/vanetza/security/region.cpp:3:
<vanetza_dir>/vanetza/vanetza/security/region.hpp:37:15: error: field ‘elevation’ has incomplete type ‘vanetza::security::ThreeDLocation::Elevation’ {aka ‘std::array<unsigned char, 2>’}
   37 |     Elevation elevation;
      |               ^~~~~~~~~
In file included from /usr/include/c++/12.1.0/functional:54,
                 from <vanetza_dir>/vanetza/vanetza/common/byte_order.hpp:5,
                 from <vanetza_dir>/vanetza/vanetza/common/archives.hpp:4,
                 from <vanetza_dir>/vanetza/vanetza/common/serialization.hpp:4,
                 from <vanetza_dir>/vanetza/vanetza/security/region.cpp:1:
/usr/include/c++/12.1.0/tuple:1595:45: note: declaration of ‘using Elevation = struct std::array<unsigned char, 2>’ {aka ‘struct std::array<unsigned char, 2>’}
 1595 |   template<typename _Tp, size_t _Nm> struct array;
      |                                             ^~~~~
<vanetza_dir>/vanetza/vanetza/security/region.hpp:30:97: error: ‘elevation’ has incomplete type
   30 |     ThreeDLocation(geonet::geo_angle_i32t latitude, geonet::geo_angle_i32t longitude, Elevation elevation) :
      |                                                                                       ~~~~~~~~~~^~~~~~~~~
/usr/include/c++/12.1.0/tuple:1595:45: note: declaration of ‘using Elevation = struct std::array<unsigned char, 2>’ {aka ‘struct std::array<unsigned char, 2>’}
 1595 |   template<typename _Tp, size_t _Nm> struct array;
      |                                             ^~~~~
<vanetza_dir>/vanetza/vanetza/security/region.hpp:32:83: error: ‘elevation’ has incomplete type
   32 |     ThreeDLocation(units::GeoAngle latitude, units::GeoAngle longitude, Elevation elevation) :
      |                                                                         ~~~~~~~~~~^~~~~~~~~
/usr/include/c++/12.1.0/tuple:1595:45: note: declaration of ‘using Elevation = struct std::array<unsigned char, 2>’ {aka ‘struct std::array<unsigned char, 2>’}
 1595 |   template<typename _Tp, size_t _Nm> struct array;
      |                                             ^~~~~
<vanetza_dir>/vanetza/vanetza/security/region.cpp:18:49: error: variable ‘const vanetza::security::ThreeDLocation::Elevation vanetza::security::ThreeDLocation::unknown_elevation’ has initializer but incomplete type
   18 | const ThreeDLocation::Elevation ThreeDLocation::unknown_elevation {{ 0xF0, 0x00 }};
      |                                                 ^~~~~~~~~~~~~~~~~
<vanetza_dir>/vanetza/vanetza/security/region.cpp:19:49: error: variable ‘const vanetza::security::ThreeDLocation::Elevation vanetza::security::ThreeDLocation::min_elevation’ has initializer but incomplete type
   19 | const ThreeDLocation::Elevation ThreeDLocation::min_elevation {{ 0xF0, 0x01 }};
      |                                                 ^~~~~~~~~~~~~
<vanetza_dir>/vanetza/vanetza/security/region.cpp:20:49: error: variable ‘const vanetza::security::ThreeDLocation::Elevation vanetza::security::ThreeDLocation::max_elevation’ has initializer but incomplete type
   20 | const ThreeDLocation::Elevation ThreeDLocation::max_elevation {{ 0xEF, 0xFF }};
      |                                                 ^~~~~~~~~~~~~
[ 93%] Building CXX object vanetza/security/CMakeFiles/security.dir/serialization.cpp.o
[ 93%] Building CXX object vanetza/security/CMakeFiles/security.dir/sha.cpp.o
<vanetza_dir>/vanetza/vanetza/security/region.cpp:676:62: error: return type ‘using Elevation = struct std::array<unsigned char, 2>’ {aka ‘struct std::array<unsigned char, 2>’} is incomplete
  676 | ThreeDLocation::Elevation to_elevation(units::Length altitude)
      |                                                              ^
<vanetza_dir>/vanetza/vanetza/security/region.cpp:676:27: error: ambiguating new declaration of ‘void vanetza::security::to_elevation(vanetza::units::Length)’
  676 | ThreeDLocation::Elevation to_elevation(units::Length altitude)
      |                           ^~~~~~~~~~~~
<vanetza_dir>/vanetza/vanetza/security/region.hpp:405:27: note: old declaration ‘vanetza::security::ThreeDLocation::Elevation vanetza::security::to_elevation(vanetza::units::Length)’
  405 | ThreeDLocation::Elevation to_elevation(units::Length altitude);
      |                           ^~~~~~~~~~~~
<vanetza_dir>/vanetza/vanetza/security/region.cpp: In function ‘void vanetza::security::to_elevation(vanetza::units::Length)’:
<vanetza_dir>/vanetza/vanetza/security/region.cpp:681:31: error: variable ‘vanetza::security::ThreeDLocation::Elevation elevation’ has initializer but incomplete type
  681 |     ThreeDLocation::Elevation elevation { ThreeDLocation::unknown_elevation };
      |                               ^~~~~~~~~
make[2]: *** [vanetza/security/CMakeFiles/security.dir/build.make:370: vanetza/security/CMakeFiles/security.dir/region.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:664: vanetza/security/CMakeFiles/security.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Best regards
Alex

riebl commented

Hi Alex,

Thanks for the hint! I have fixed this issue with 95167c8.

Best regards,
Raphael