opencardev / openauto

AndroidAuto headunit emulator
GNU General Public License v3.0
134 stars 47 forks source link

Compilation error: invalid new-expression of abstract class type ‘f1x::openauto::autoapp::service::VideoService’ #9

Open xtensa opened 4 years ago

xtensa commented 4 years ago

Trying to compile op rpi4 and getting this error. Seems like ServiceFactory is trying to instantiate abstract class.

[ 4%] Building CXX object CMakeFiles/autoapp.dir/src/autoapp/Service/ServiceFactory.cpp.o In file included from /usr/include/arm-linux-gnueabihf/c++/8/bits/c++allocator.h:33, from /usr/include/c++/8/bits/allocator.h:46, from /usr/include/c++/8/string:41, from /usr/include/arm-linux-gnueabihf/qt5/QtCore/qbytearray.h:52, from /usr/include/arm-linux-gnueabihf/qt5/QtCore/qstring.h:49, from /usr/include/arm-linux-gnueabihf/qt5/QtCore/qcoreapplication.h:44, from /usr/include/arm-linux-gnueabihf/qt5/QtWidgets/qapplication.h:44, from /usr/include/arm-linux-gnueabihf/qt5/QtWidgets/QApplication:1, from /home/pi/openauto-opencardev/openauto/src/autoapp/Service/ServiceFactory.cpp:19: /usr/include/c++/8/ext/new_allocator.h: In instantiation of ‘void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = f1x::openauto::autoapp::service::VideoService; _Args = {boost::asio::io_context&, std::shared_ptr<f1x::aasdk::messenger::IMessenger>&, std::shared_ptr<f1x::openauto::autoapp::projection::IVideoOutput>}; _Tp = f1x::openauto::autoapp::service::VideoService]’: /usr/include/c++/8/bits/alloc_traits.h:475:4: required from ‘static void std::allocator_traits<std::allocator<_Tp> >::construct(std::allocator_traits<std::allocator<_Tp> >::allocator_type&, _Up*, _Args&& ...) [with _Up = f1x::openauto::autoapp::service::VideoService; _Args = {boost::asio::io_context&, std::shared_ptr<f1x::aasdk::messenger::IMessenger>&, std::shared_ptr<f1x::openauto::autoapp::projection::IVideoOutput>}; _Tp = f1x::openauto::autoapp::service::VideoService; std::allocator_traits<std::allocator<_Tp> >::allocator_type = std::allocator<f1x::openauto::autoapp::service::VideoService>]’ /usr/include/c++/8/bits/shared_ptr_base.h:545:39: required from ‘std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::_Sp_counted_ptr_inplace(_Alloc, _Args&& ...) [with _Args = {boost::asio::io_context&, std::shared_ptr<f1x::aasdk::messenger::IMessenger>&, std::shared_ptr<f1x::openauto::autoapp::projection::IVideoOutput>}; _Tp = f1x::openauto::autoapp::service::VideoService; _Alloc = std::allocator<f1x::openauto::autoapp::service::VideoService>; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)1]’ /usr/include/c++/8/bits/shared_ptr_base.h:677:16: required from ‘std::__shared_count<_Lp>::__shared_count(_Tp*&, std::_Sp_alloc_shared_tag<_Alloc>, _Args&& ...) [with _Tp = f1x::openauto::autoapp::service::VideoService; _Alloc = std::allocator<f1x::openauto::autoapp::service::VideoService>; _Args = {boost::asio::io_context&, std::shared_ptr<f1x::aasdk::messenger::IMessenger>&, std::shared_ptr<f1x::openauto::autoapp::projection::IVideoOutput>}; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)1]’ /usr/include/c++/8/bits/shared_ptr_base.h:1342:71: required from ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc = std::allocator<f1x::openauto::autoapp::service::VideoService>; _Args = {boost::asio::io_context&, std::shared_ptr<f1x::aasdk::messenger::IMessenger>&, std::shared_ptr<f1x::openauto::autoapp::projection::IVideoOutput>}; _Tp = f1x::openauto::autoapp::service::VideoService; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)1]’ /usr/include/c++/8/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<f1x::openauto::autoapp::service::VideoService>; _Args = {boost::asio::io_context&, std::shared_ptr<f1x::aasdk::messenger::IMessenger>&, std::shared_ptr<f1x::openauto::autoapp::projection::IVideoOutput>}; _Tp = f1x::openauto::autoapp::service::VideoService]’ /usr/include/c++/8/bits/shared_ptr.h:705:14: required from ‘std::shared_ptr<_Tp> std::allocate_shared(const _Alloc&, _Args&& ...) [with _Tp = f1x::openauto::autoapp::service::VideoService; _Alloc = std::allocator<f1x::openauto::autoapp::service::VideoService>; _Args = {boost::asio::io_context&, std::shared_ptr<f1x::aasdk::messenger::IMessenger>&, std::shared_ptr<f1x::openauto::autoapp::projection::IVideoOutput>}]’ /usr/include/c++/8/bits/shared_ptr.h:721:39: required from ‘std::shared_ptr<_Tp> std::make_shared(_Args&& ...) [with _Tp = f1x::openauto::autoapp::service::VideoService; _Args = {boost::asio::io_context&, std::shared_ptr<f1x::aasdk::messenger::IMessenger>&, std::shared_ptr<f1x::openauto::autoapp::projection::IVideoOutput>}]’ /home/pi/openauto-opencardev/openauto/src/autoapp/Service/ServiceFactory.cpp:81:88: required from here /usr/include/c++/8/ext/new_allocator.h:136:4: **error: invalid new-expression of abstract class type ‘f1x::openauto::autoapp::service::VideoService’** { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /home/pi/openauto-opencardev/openauto/src/autoapp/Service/ServiceFactory.cpp:25: /home/pi/openauto-opencardev/openauto/include/f1x/openauto/autoapp/Service/VideoService.hpp:36:7: **note: because the following virtual functions are pure within** ‘f1x::openauto::autoapp::service::VideoService’: class VideoService: public aasdk::channel::av::IVideoServiceChannelEventHandler, public IService, public std::enable_shared_from_this<VideoService> ^~~~~~~~~~~~ In file included from /home/pi/openauto-opencardev/aasdk/include/f1x/aasdk/Channel/AV/IVideoServiceChannel.hpp:28, from /home/pi/openauto-opencardev/aasdk/include/f1x/aasdk/Channel/AV/VideoServiceChannel.hpp:22, from /home/pi/openauto-opencardev/openauto/include/f1x/openauto/autoapp/Service/VideoService.hpp:22, from /home/pi/openauto-opencardev/openauto/src/autoapp/Service/ServiceFactory.cpp:25: /home/pi/openauto-opencardev/aasdk/include/f1x/aasdk/Channel/AV/IVideoServiceChannelEventHandler.hpp:50:18: note: ‘virtual void f1x::aasdk::channel::av::IVideoServiceChannelEventHandler::onAVChannelStopIndication(const f1x::aasdk::proto::messages::AVChannelStopIndication&)’ virtual void onAVChannelStopIndication(const proto::messages::AVChannelStopIndication& indication) = 0; ^~~~~~~~~~~~~~~~~~~~~~~~~ make[2]: *** [CMakeFiles/autoapp.dir/build.make:406: CMakeFiles/autoapp.dir/src/autoapp/Service/ServiceFactory.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/autoapp.dir/all] Error 2 make: *** [Makefile:84: all] Error 2

Additional info: $ uname -a Linux raspberrypi 4.19.118-v7l+ #1311 SMP Mon Apr 27 14:26:42 BST 2020 armv7l GNU/Linux

Not sure if the issue should be posted here or to aasdk, because virtual function that is causing the problem (onAVChannelStopIndication) was introdused in aasdk.

xtensa commented 4 years ago

And the fix for this issue attached:

openauto_fix1.diff.txt

:)