langroodi / Adaptive-AUTOSAR

Adaptive Runtime AUTOSAR Linux Simulator
MIT License
386 stars 155 forks source link

Unable to compile on ubuntu 20 using clang and cmake on VSCode terminal. #7

Closed risaldar closed 2 years ago

risaldar commented 2 years ago

Unable to compile on ubuntu 20 using clang and cmake on VSCode terminal. Can you please check and let me know what is wrong... and BTW will i eventually see any communication on Ethernet running DDS?

hasan@dhasan-VirtualBox:~/Desktop/work/Adaptive-AUTOSAR$ cmake --build . Scanning dependencies of target gtest [ 2%] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o [ 4%] Linking CXX static library ../../../lib/libgtest.a [ 4%] Built target gtest Scanning dependencies of target gtest_main [ 6%] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o [ 8%] Linking CXX static library ../../../lib/libgtest_main.a [ 8%] Built target gtest_main Scanning dependencies of target ara_sm [ 11%] Linking CXX static library libara_sm.a [ 11%] Built target ara_sm Scanning dependencies of target ara_com [ 13%] Building CXX object CMakeFiles/ara_com.dir/src/ara/com/helper/payload_helper.cpp.o [ 15%] Building CXX object CMakeFiles/ara_com.dir/src/ara/com/helper/ipv4_address.cpp.o In file included from /home/dhasan/Desktop/work/Adaptive-AUTOSAR/src/ara/com/helper/ipv4_address.cpp:1: /home/dhasan/Desktop/work/Adaptive-AUTOSAR/src/ara/com/helper/./ipv4_address.h: In function ‘constexpr bool ara::com::helper::operator==(ara::com::helper::Ipv4Address, ara::com::helper::Ipv4Address)’: /home/dhasan/Desktop/work/Adaptive-AUTOSAR/src/ara/com/helper/./ipv4_address.h:52:39: error: call to non-‘constexpr’ function ‘std::array<_Tp, _Nm>::value_type& std::array<_Tp, _Nm>::operator[](std::array<_Tp, _Nm>::size_type) [with _Tp = unsigned char; long unsigned int _Nm = 4; std::array<_Tp, _Nm>::reference = unsigned char&; std::array<_Tp, _Nm>::value_type = unsigned char; std::array<_Tp, _Nm>::size_type = long unsigned int]’ 52 | (address1.Octets[0] == address2.Octets[0]) && | ^ make[2]: [CMakeFiles/ara_com.dir/build.make:76: CMakeFiles/ara_com.dir/src/ara/com/helper/ipv4_address.cpp.o] Error 1 make[1]: [CMakeFiles/Makefile2:205: CMakeFiles/ara_com.dir/all] Error 2 make: *** [Makefile:141: all] Error 2

langroodi commented 2 years ago

It is a bit weird that the project can be built successfully both locally and also in the build server. The compiler is complaining about the [] operator of the std::array as a non-constexpr function within a constexpr function (in ipv4_address class) which is correct because that operator becomes constexpr from C++ 17. However, the project needs to be compiled on C++ 14.

First I need to be sure that why the build server is not complaining about that. To find that out, I need to know which Clang and CMake version you are using?

Regarding your second question about Ethernet communication and DDS, currently there is no communication over TCP/IP and I am still working on a library as a wrapper around BSD sockets to enable that communication. Additionally, the network abstraction is going to only support SOME/IP. Even though supporting DDS is also required by the standard, I have no plan yet to implement that.