Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Shintani__Eigo
Beginner
353 Views

error when compiling openCV 4.0 on ubuntu 18.04

Hi,

When I try to compile openCV 4.0 source file, it is stopped by errors of

opencv-4.0.0/modules/dnn/src/dnn.cpp:1595:72: error: invalid new-expression of abstract class type ‘cv::dnn::InfEngineBackendNet’
                 net = Ptr<InfEngineBackendNet>(new InfEngineBackendNet());


opencv-4.0.0/modules/dnn/src/dnn.cpp:2556:78: error: invalid new-expression of abstract class type ‘cv::dnn::InfEngineBackendNet’
     backendNode->net = Ptr<InfEngineBackendNet>(new InfEngineBackendNet(ieNet));

 

/usr/include/c++/7/ext/aligned_buffer.h:52:25: error: cannot declare field ‘__gnu_cxx::__aligned_membuf<cv::dnn::InfEngineBackendNet>::_Tp2::_M_t’ to be of abstract type ‘cv::dnn::InfEngineBackendNet’
       struct _Tp2 { _Tp _M_t; };

 

This is done on ubuntu 18.04. Are there missing libraries ?

 

Best,

Eigo

0 Kudos
7 Replies
Maksim_S_Intel
Employee
353 Views

Looks like you have to set INF_ENGINE_RELEASE cmake variable to match your Inference Engine version. For example:

-DINF_ENGINE_RELEASE=2018050000

for Inference Engine from OpenVINO 2018R5.

Check cmake code and comments here and here.

Or you are using older OpenCV version which does not support newer Inference Engine interface. Try to update to 4.0.1 or master.

Shintani__Eigo
Beginner
353 Views

Hi Maksim,

I tried

$export INTEL_CVSDK_DIR=/opt/intel/computer_vision_sdk

$cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DINF_ENGINE_RELEASE=2018050455 ..

$make

but the same error message appeared.

OpenVINO is installed on /opt/intel/computer_vision_sdk_2018.5.455/

Best,

Eigo

 

Maksim_S_Intel
Employee
353 Views

Did you try OpenCV 4.0.1? INF_ENGINE_RELEASE should be "2018050000".

Shintani__Eigo
Beginner
353 Views

Hi Maksim,

Yes, but it was the same situation. The whole error message is

/home/shintani/Downloads/opencv-4.0.0/modules/dnn/src/dnn.cpp: In member function ‘void cv::dnn::dnn4_v20180917::Net::Impl::initInfEngineBackend()’:
/home/shintani/Downloads/opencv-4.0.0/modules/dnn/src/dnn.cpp:1595:72: error: invalid new-expression of abstract class type ‘cv::dnn::InfEngineBackendNet’
                 net = Ptr<InfEngineBackendNet>(new InfEngineBackendNet());
                                                                        ^
In file included from /home/shintani/Downloads/opencv-4.0.0/modules/dnn/src/dnn.cpp:44:0:
/home/shintani/Downloads/opencv-4.0.0/modules/dnn/src/op_inf_engine.hpp:44:7: note:   because the following virtual functions are pure within ‘cv::dnn::InfEngineBackendNet’:
 class InfEngineBackendNet : public InferenceEngine::ICNNNetwork
       ^~~~~~~~~~~~~~~~~~~

/opt/intel/computer_vision_sdk_2018.5.455/deployment_tools/inference_engine/include/ie_icnn_network.hpp:190:24: note:     virtual InferenceEngine::StatusCode InferenceEngine::ICNNNetwork::serialize(const string&, const string&, InferenceEngine::ResponseDesc*) const
     virtual StatusCode serialize(const std::string &xmlPath, const std::string &binPath, ResponseDesc* resp) const noexcept = 0;
                        ^~~~~~~~~
/home/shintani/Downloads/opencv-4.0.0/modules/dnn/src/dnn.cpp: In static member function ‘static cv::dnn::dnn4_v20180917::Net cv::dnn::dnn4_v20180917::Net::readFromModelOptimizer(const String&, const String&)’:
/home/shintani/Downloads/opencv-4.0.0/modules/dnn/src/dnn.cpp:2556:78: error: invalid new-expression of abstract class type ‘cv::dnn::InfEngineBackendNet’
     backendNode->net = Ptr<InfEngineBackendNet>(new InfEngineBackendNet(ieNet));
                                                                              ^

BTW, for openCV 3.4.4 it does not matter.

 

Best,

Eigo

 

Maksim_S_Intel
Employee
353 Views

In file included from /home/shintani/Downloads/opencv-4.0.0/modules/dnn/src/dnn.cpp:44:0:
/home/shintani/Downloads/opencv-4.0.0/modules/dnn/src/op_inf_engine.hpp:44:7: note:   because the following virtual functions are pure within ‘cv::dnn::InfEngineBackendNet’:
 class InfEngineBackendNet : public InferenceEngine::ICNNNetwork
       ^~~~~~~~~~~~~~~~~~~

Your error message points to class declaration on line 44, it was on this line in version 4.0.0 and had shifted to line 45 in version 4.0.1. So you are still building with version 4.0.0 which does not support OpenVINO 2018R5. Please try version 4.0.1 and make sure you make a clean build (create new build directory).

Shintani__Eigo
Beginner
353 Views

Hi Maksim,

OK, could you tell me how i can get version 4.0.1 ?

Eigo

Green__Jim
Beginner
353 Views

No need to compile OpenCV.

OpenVINO for Linux has included OpenCV4.

Just set vars, and you will import cv2

Reply