COVESA / capicxx-someip-tools

Common API C++ SOMEIP tooling
Mozilla Public License 2.0
76 stars 55 forks source link

Compile error because of some pure virtual functions #20

Closed kkretsch closed 7 months ago

kkretsch commented 3 years ago

I tried to follow the SomeIP hello world steps using the 3.1 versions of the generators. The fidl and fdepl files are used for generating src-gen. Compiling the CMake results give this error:

Scanning dependencies of target HelloWorldService
[ 10%] Building CXX object CMakeFiles/HelloWorldService.dir/src/HelloWorldStubImpl.cpp.o
[ 20%] Building CXX object CMakeFiles/HelloWorldService.dir/src-gen/v1/commonapi/HelloWorldSomeIPStubAdapter.cpp.o
In file included from /usr/include/x86_64-linux-gnu/c++/9/bits/c++allocator.h:33,
                 from /usr/include/c++/9/bits/allocator.h:46,
                 from /usr/include/c++/9/string:41,
                 from /usr/include/c++/9/stdexcept:39,
                 from /usr/include/c++/9/array:39,
                 from /usr/include/c++/9/tuple:39,
                 from /usr/include/c++/9/functional:54,
                 from /home/kai/data/src/commonAPIproject/src-gen/v1/commonapi/HelloWorldStub.hpp:13,
                 from /home/kai/data/src/commonAPIproject/src-gen/v1/commonapi/HelloWorldSomeIPStubAdapter.hpp:13,
                 from /home/kai/data/src/commonAPIproject/src-gen/v1/commonapi/HelloWorldSomeIPStubAdapter.cpp:10:
/usr/include/c++/9/ext/new_allocator.h: In instantiation of ‘void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = v1::commonapi::HelloWorldSomeIPStubAdapter<v1::commonapi::HelloWorldStub>; _Args = {const CommonAPI::SomeIP::Address&, const std::shared_ptr<CommonAPI::SomeIP::ProxyConnection>&, const std::shared_ptr<CommonAPI::StubBase>&}; _Tp = v1::commonapi::HelloWorldSomeIPStubAdapter<v1::commonapi::HelloWorldStub>]’:
/usr/include/c++/9/bits/alloc_traits.h:482:2:   required from ‘static void std::allocator_traits<std::allocator<_CharT> >::construct(std::allocator_traits<std::allocator<_CharT> >::allocator_type&, _Up*, _Args&& ...) [with _Up = v1::commonapi::HelloWorldSomeIPStubAdapter<v1::commonapi::HelloWorldStub>; _Args = {const CommonAPI::SomeIP::Address&, const std::shared_ptr<CommonAPI::SomeIP::ProxyConnection>&, const std::shared_ptr<CommonAPI::StubBase>&}; _Tp = v1::commonapi::HelloWorldSomeIPStubAdapter<v1::commonapi::HelloWorldStub>; std::allocator_traits<std::allocator<_CharT> >::allocator_type = std::allocator<v1::commonapi::HelloWorldSomeIPStubAdapter<v1::commonapi::HelloWorldStub> >]’
/usr/include/c++/9/bits/shared_ptr_base.h:548:39:   required from ‘std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::_Sp_counted_ptr_inplace(_Alloc, _Args&& ...) [with _Args = {const CommonAPI::SomeIP::Address&, const std::shared_ptr<CommonAPI::SomeIP::ProxyConnection>&, const std::shared_ptr<CommonAPI::StubBase>&}; _Tp = v1::commonapi::HelloWorldSomeIPStubAdapter<v1::commonapi::HelloWorldStub>; _Alloc = std::allocator<v1::commonapi::HelloWorldSomeIPStubAdapter<v1::commonapi::HelloWorldStub> >; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’
/usr/include/c++/9/bits/shared_ptr_base.h:679:16:   required from ‘std::__shared_count<_Lp>::__shared_count(_Tp*&, std::_Sp_alloc_shared_tag<_Alloc>, _Args&& ...) [with _Tp = v1::commonapi::HelloWorldSomeIPStubAdapter<v1::commonapi::HelloWorldStub>; _Alloc = std::allocator<v1::commonapi::HelloWorldSomeIPStubAdapter<v1::commonapi::HelloWorldStub> >; _Args = {const CommonAPI::SomeIP::Address&, const std::shared_ptr<CommonAPI::SomeIP::ProxyConnection>&, const std::shared_ptr<CommonAPI::StubBase>&}; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’
/usr/include/c++/9/bits/shared_ptr_base.h:1344:71:   required from ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc = std::allocator<v1::commonapi::HelloWorldSomeIPStubAdapter<v1::commonapi::HelloWorldStub> >; _Args = {const CommonAPI::SomeIP::Address&, const std::shared_ptr<CommonAPI::SomeIP::ProxyConnection>&, const std::shared_ptr<CommonAPI::StubBase>&}; _Tp = v1::commonapi::HelloWorldSomeIPStubAdapter<v1::commonapi::HelloWorldStub>; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’
/usr/include/c++/9/bits/shared_ptr.h:359:59:   required from ‘std::shared_ptr<_Tp>::shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc = std::allocator<v1::commonapi::HelloWorldSomeIPStubAdapter<v1::commonapi::HelloWorldStub> >; _Args = {const CommonAPI::SomeIP::Address&, const std::shared_ptr<CommonAPI::SomeIP::ProxyConnection>&, const std::shared_ptr<CommonAPI::StubBase>&}; _Tp = v1::commonapi::HelloWorldSomeIPStubAdapter<v1::commonapi::HelloWorldStub>]’
/usr/include/c++/9/bits/shared_ptr.h:701:14:   required from ‘std::shared_ptr<_Tp> std::allocate_shared(const _Alloc&, _Args&& ...) [with _Tp = v1::commonapi::HelloWorldSomeIPStubAdapter<v1::commonapi::HelloWorldStub>; _Alloc = std::allocator<v1::commonapi::HelloWorldSomeIPStubAdapter<v1::commonapi::HelloWorldStub> >; _Args = {const CommonAPI::SomeIP::Address&, const std::shared_ptr<CommonAPI::SomeIP::ProxyConnection>&, const std::shared_ptr<CommonAPI::StubBase>&}]’
/usr/include/c++/9/bits/shared_ptr.h:717:39:   required from ‘std::shared_ptr<_Tp> std::make_shared(_Args&& ...) [with _Tp = v1::commonapi::HelloWorldSomeIPStubAdapter<v1::commonapi::HelloWorldStub>; _Args = {const CommonAPI::SomeIP::Address&, const std::shared_ptr<CommonAPI::SomeIP::ProxyConnection>&, const std::shared_ptr<CommonAPI::StubBase>&}]’
/home/kai/data/src/commonAPIproject/src-gen/v1/commonapi/HelloWorldSomeIPStubAdapter.cpp:28:120:   required from here
/usr/include/c++/9/ext/new_allocator.h:145:20: error: invalid new-expression of abstract class type ‘v1::commonapi::HelloWorldSomeIPStubAdapter<v1::commonapi::HelloWorldStub>’
  145 |  noexcept(noexcept(::new((void *)__p)
      |                    ^~~~~~~~~~~~~~~~~~
  146 |        _Up(std::forward<_Args>(__args)...)))
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/kai/data/src/commonAPIproject/src-gen/v1/commonapi/HelloWorldSomeIPStubAdapter.cpp:10:
/home/kai/data/src/commonAPIproject/src-gen/v1/commonapi/HelloWorldSomeIPStubAdapter.hpp:101:7: note:   because the following virtual functions are pure within ‘v1::commonapi::HelloWorldSomeIPStubAdapter<v1::commonapi::HelloWorldStub>’:
  101 | class HelloWorldSomeIPStubAdapter
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/lib/cmake/CommonAPI-3.2.0/../../../include/CommonAPI-3.2/CommonAPI/SomeIP/StubManager.hpp:16,
                 from /usr/local/lib/cmake/CommonAPI-3.2.0/../../../include/CommonAPI-3.2/CommonAPI/SomeIP/Connection.hpp:23,
                 from /usr/local/lib/cmake/CommonAPI-3.2.0/../../../include/CommonAPI-3.2/CommonAPI/SomeIP/StubAdapterHelper.hpp:23,
                 from /home/kai/data/src/commonAPIproject/src-gen/v1/commonapi/HelloWorldSomeIPStubAdapter.hpp:20,
                 from /home/kai/data/src/commonAPIproject/src-gen/v1/commonapi/HelloWorldSomeIPStubAdapter.cpp:10:
/usr/local/lib/cmake/CommonAPI-3.2.0/../../../include/CommonAPI-3.2/CommonAPI/SomeIP/StubAdapter.hpp:52:36: note:       ‘virtual void CommonAPI::SomeIP::StubAdapter::registerSelectiveEventHandlers()’
   52 |      COMMONAPI_EXPORT virtual void registerSelectiveEventHandlers() = 0;
      |                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/lib/cmake/CommonAPI-3.2.0/../../../include/CommonAPI-3.2/CommonAPI/SomeIP/StubAdapter.hpp:53:36: note:       ‘virtual void CommonAPI::SomeIP::StubAdapter::unregisterSelectiveEventHandlers()’
   53 |      COMMONAPI_EXPORT virtual void unregisterSelectiveEventHandlers() = 0;
      |                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/HelloWorldService.dir/build.make:89: CMakeFiles/HelloWorldService.dir/src-gen/v1/commonapi/HelloWorldSomeIPStubAdapter.cpp.o] Fehler 1
make[1]: *** [CMakeFiles/Makefile2:78: CMakeFiles/HelloWorldService.dir/all] Fehler 2
make: *** [Makefile:84: all] Fehler 2

I'm using an Ubuntu system 20.04.2 LTS, compilers have gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) and CMake is version 3.16.3.

I fear the versions are to new to run the examples without changes?

jgaume commented 3 years ago

Dear Kai, How did you solve this problem? I have the same issue. Thanks a lot. Best, Johan

shoner commented 2 years ago

Dear jgaume, try to use commonapi-core-generator instead of commonapi-generator for latest someip version. But commonapi-core-generator no more generates HelloWorldStubDefault.cpp file. So we have to remove the file from CMakeLists.txt too.

goncaloalmeida commented 10 months ago

hello, this issue is still occurring with the last release?