riebl / vanetza

Open-source implementation of the ETSI C-ITS protocol stack
Other
204 stars 156 forks source link

Not able to compile #104

Closed gmusjha closed 3 years ago

gmusjha commented 4 years ago

Trying to compile based on instruction at the web site. Encountered following error:

Scanning dependencies of target security [ 77%] Building CXX object vanetza/security/CMakeFiles/security.dir/backend.cpp.o [ 77%] Building CXX object vanetza/security/CMakeFiles/security.dir/backend_null.cpp.o [ 77%] Building CXX object vanetza/security/CMakeFiles/security.dir/basic_elements.cpp.o [ 77%] Building CXX object vanetza/security/CMakeFiles/security.dir/cam_ssp.cpp.o [ 78%] Building CXX object vanetza/security/CMakeFiles/security.dir/certificate.cpp.o [ 78%] Building CXX object vanetza/security/CMakeFiles/security.dir/certificate_cache.cpp.o [ 78%] Building CXX object vanetza/security/CMakeFiles/security.dir/default_certificate_validator.cpp.o [ 78%] Building CXX object vanetza/security/CMakeFiles/security.dir/delegating_security_entity.cpp.o [ 78%] Building CXX object vanetza/security/CMakeFiles/security.dir/ecc_point.cpp.o [ 79%] Building CXX object vanetza/security/CMakeFiles/security.dir/ecdsa256.cpp.o [ 79%] Building CXX object vanetza/security/CMakeFiles/security.dir/encryption_parameter.cpp.o [ 79%] Building CXX object vanetza/security/CMakeFiles/security.dir/header_field.cpp.o [ 79%] Building CXX object vanetza/security/CMakeFiles/security.dir/int_x.cpp.o [ 79%] Building CXX object vanetza/security/CMakeFiles/security.dir/length_coding.cpp.o [ 80%] Building CXX object vanetza/security/CMakeFiles/security.dir/naive_certificate_provider.cpp.o [ 80%] Building CXX object vanetza/security/CMakeFiles/security.dir/null_certificate_provider.cpp.o [ 80%] Building CXX object vanetza/security/CMakeFiles/security.dir/null_certificate_validator.cpp.o [ 80%] Building CXX object vanetza/security/CMakeFiles/security.dir/payload.cpp.o [ 81%] Building CXX object vanetza/security/CMakeFiles/security.dir/persistence.cpp.o [ 81%] Building CXX object vanetza/security/CMakeFiles/security.dir/public_key.cpp.o [ 81%] Building CXX object vanetza/security/CMakeFiles/security.dir/recipient_info.cpp.o [ 81%] Building CXX object vanetza/security/CMakeFiles/security.dir/region.cpp.o /home/sjha/omnetSumoProjects2/Vanetza/vanetza/vanetza/security/region.cpp: In function ‘vanetza::security::ThreeDLocation::Elevation vanetza::security::to_elevation(vanetza::units::Length)’: ../Vanetza/vanetza/vanetza/security/region.cpp:681:77: error: cannot convert ‘const Elevation {aka const std::array<unsigned char, 2ul>}’ to ‘unsigned char’ in initialization ThreeDLocation::Elevation elevation { ThreeDLocation::unknown_elevation }; ^ make[2]: [vanetza/security/CMakeFiles/security.dir/region.cpp.o] Error 1 make[1]: [vanetza/security/CMakeFiles/security.dir/all] Error 2 make: *** [all] Error 2

riebl commented 4 years ago

I guess your C++ compiler is just too old and thus does not support C++11 to full extent. Which version do you use?

gmusjha commented 4 years ago

gcc --version gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39) Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

As such it does supports C++ 11 standard in other portion of my code

riebl commented 4 years ago

4.8 has only incomplete/buggy support for C++11. I highly recommend to update your compiler. If this is no option, you can replace the initialization of ThreeDLocation::unknown_elevation using {{ }} by ({ }).

bseptember commented 4 years ago

Had the same issue with 5.4... However, this seems to solve the issue of building... image

raul-parada commented 4 years ago

Any plan to allow C++20 version compiler? It allows template functions.

riebl commented 4 years ago

Feel free to use any C++ compiler supporting C++11 or later. Vanetza does not forbid usage of C++20 at all, however, sources in this repository shall remain compatible with C++11 for now.