hybridgroup / gocv

Go package for computer vision using OpenCV 4 and beyond. Includes support for DNN, CUDA, OpenCV Contrib, and OpenVINO.
https://gocv.io
Other
6.76k stars 870 forks source link

Problem with version after installation: # runtime/cgo /usr/bin/ld: cannot find -ldliaPlugin /usr/bin/ld: cannot find -lHeteroPlugin ... #372

Closed marcosantar93 closed 5 years ago

marcosantar93 commented 6 years ago

Description

After installing following instructions, I get the following error when I try to see the version

go run ./cmd/version/main.go
# gocv.io/x/gocv
features2d.cpp: In function ‘void DrawKeyPoints(Mat, KeyPoints, Mat, Scalar, int)’:
features2d.cpp:366:93: error: no matching function for call to ‘cv::DrawMatchesFlags::DrawMatchesFlags(int&)’
         cv::drawKeypoints(*src, keypts, *dst, color, static_cast<cv::DrawMatchesFlags>(flags));
                                                                                             ^
In file included from /opt/intel//computer_vision_sdk_2018.3.343/opencv/include/opencv2/calib3d.hpp:48:0,
                 from /opt/intel//computer_vision_sdk_2018.3.343/opencv/include/opencv2/opencv.hpp:56,
                 from features2d.h:5,
                 from features2d.cpp:1:
/opt/intel//computer_vision_sdk_2018.3.343/opencv/include/opencv2/features2d.hpp:1174:19: note: candidate: constexpr cv::DrawMatchesFlags::DrawMatchesFlags()
 struct CV_EXPORTS DrawMatchesFlags
                   ^
/opt/intel//computer_vision_sdk_2018.3.343/opencv/include/opencv2/features2d.hpp:1174:19: note:   candidate expects 0 arguments, 1 provided
/opt/intel//computer_vision_sdk_2018.3.343/opencv/include/opencv2/features2d.hpp:1174:19: note: candidate: constexpr cv::DrawMatchesFlags::DrawMatchesFlags(const cv::DrawMatchesFlags&)
/opt/intel//computer_vision_sdk_2018.3.343/opencv/include/opencv2/features2d.hpp:1174:19: note:   no known conversion for argument 1 from ‘int’ to ‘const cv::DrawMatchesFlags&’
/opt/intel//computer_vision_sdk_2018.3.343/opencv/include/opencv2/features2d.hpp:1174:19: note: candidate: constexpr cv::DrawMatchesFlags::DrawMatchesFlags(cv::DrawMatchesFlags&&)
/opt/intel//computer_vision_sdk_2018.3.343/opencv/include/opencv2/features2d.hpp:1174:19: note:   no known conversion for argument 1 from ‘int’ to ‘cv::DrawMatchesFlags&&’
Makefile:93: recipe for target 'verify' failed
make: *** [verify] Error 2

Steps to Reproduce

  1. Install latest version on Ubuntu 16.04 following READ.md

Your Environment

marcosantar93 commented 6 years ago

I uninstalled an OpenCV version which was installed with an Intel SDK and tried the whole installation once again, and I am getting this error whenever I run the program:

# runtime/cgo
/usr/bin/ld: cannot find -ldliaPlugin
/usr/bin/ld: cannot find -lHeteroPlugin
/usr/bin/ld: cannot find -lMKLDNNPlugin
/usr/bin/ld: cannot find -lmyriadPlugin
/usr/bin/ld: cannot find -linference_engine
/usr/bin/ld: cannot find -lclDNNPlugin
/usr/bin/ld: cannot find -lopencv_pvl
collect2: error: ld returned 1 exit status
marcosantar93 commented 6 years ago

It worked after changing CGO_LDFLAGS to null

CGO_LDFLAGS=-L/opencv/lib -L/deployment_tools/inference_engine/lib/ubuntu_16.04/intel64 -lpthread -ldl -ldliaPlugin -lHeteroPlugin -lMKLDNNPlugin -lmyriadPlugin -linference_engine -lclDNNPlugin -lopencv_core -lopencv_pvl -lopencv_videoio -lopencv_imgproc -lopencv_highgui -lopencv_imgcodecs -lopencv_objdetect -lopencv_features2d -lopencv_video -lopencv_dnn -lopencv_calib3d

CGO_LDFLAGS=

This solution seems a bit forced, any thoughts or suggestions? Or should I close this issue?

deadprogram commented 5 years ago

Hello @marcosantar93 if you want to use GoCV with the Intel OpenVINO you must follow these instructions here: https://github.com/hybridgroup/gocv/tree/master/openvino

You cannot "mix and match" both versions at the same time. You may either use the OpenCV 4.0 that you would build from source from the main project README (https://github.com/hybridgroup/gocv/blob/master/README.md) or you may use the OpenVINO install by following the OpenVINO instructions as linked above.

Hope that helps!

marcosantar93 commented 5 years ago

I'll try it in a few days and let you know. Thanks for the answer!

marcosantar93 commented 5 years ago

I could complete the installation from the link that you provided. However, when I run the openvino version program, I get this error:

/usr/bin/ld: cannot find -ldliaPlugin
collect2: error: ld returned 1 exit status

I could find that library on the lib directories referenced on env.sh, so I deleted the -ldliaPlugin flag and I could see the openvino version without any problems. However, when I run the DNN-detection example, I get the following error whenever I set the target to NetTargetFP16 or NetTargetFP32. It runs without problems with backend set to OpenVINO and NetTargetCPU.

go run ./cmd/dnn-detection/main.go 0 cmd/dnn-detection/res10_300x300_ssd_iter_140000.caffemodel cmd/dnn-detection/deploy.prototxt openvino fp16
Start reading device: 0
terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(4.0.1-openvino) /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/dnn/src/op_inf_engine.cpp:553: error: (-215:Assertion failed) in function 'initPlugin'
> Failed to initialize Inference Engine backend: Cannot find plugin to use :Tried load plugin : clDNNPlugin,  error: Plugin clDNNPlugin cannot be loaded: cannot load plugin: clDNNPlugin from : Cannot load library 'libclDNNPlugin.so': libOpenCL.so.1: cannot open shared object file: No such file or directory, skipping
> 
> 
> 
> 
SIGABRT: abort
PC=0x7f4007aa0428 m=0 sigcode=18446744073709551610
signal arrived during cgo execution

goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x4c14d0, 0xc000053d68, 0xc000053d70)
    /usr/local/go/src/runtime/cgocall.go:128 +0x5e fp=0xc000053d38 sp=0xc000053d00 pc=0x432efe
gocv.io/x/gocv._Cfunc_Net_Forward(0x29ff970, 0x29f39c0, 0x0)
    _cgo_gotypes.go:4041 +0x4e fp=0xc000053d68 sp=0xc000053d38 pc=0x4bc30e
gocv.io/x/gocv.(*Net).Forward.func2(0x29ff970, 0x29f39c0, 0x29f39c0)
    /home/marco/work/src/gocv.io/x/gocv/dnn.go:133 +0x60 fp=0xc000053da0 sp=0xc000053d68 pc=0x4be3f0
gocv.io/x/gocv.(*Net).Forward(0xc000053e98, 0x0, 0x0, 0x0)
    /home/marco/work/src/gocv.io/x/gocv/dnn.go:133 +0x83 fp=0xc000053dd0 sp=0xc000053da0 pc=0x4bd223
main.main()
    /home/marco/work/src/gocv.io/x/gocv/cmd/dnn-detection/main.go:117 +0x520 fp=0xc000053f98 sp=0xc000053dd0 pc=0x4bf5b0
runtime.main()
    /usr/local/go/src/runtime/proc.go:201 +0x207 fp=0xc000053fe0 sp=0xc000053f98 pc=0x459477
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:1333 +0x1 fp=0xc000053fe8 sp=0xc000053fe0 pc=0x481701

rax    0x0
rbx    0x4078e60
rcx    0x7f4007aa0428
rdx    0x6
rdi    0x53a9
rsi    0x53a9
rbp    0x7f4007e30700
rsp    0x7fff087f6898
r8     0x4a
r9     0x7f400f019a80
r10    0x8
r11    0x206
r12    0x40786e0
r13    0x4078b10
r14    0x4078b30
r15    0x229
rip    0x7f4007aa0428
rflags 0x206
cs     0x33
fs     0x0
gs     0x0
exit status 2

I checked and the library is where it should.

deadprogram commented 5 years ago

Closing due to inactivity, please open if needed. Thank you.