Open GothicFox opened 5 years ago
Hello @BottleChain the newest release of GoCV requires OpenCV 4.0+
Check out the latest info here: https://github.com/hybridgroup/gocv#installation-2
Hope that helps!
I had the same Problem on Fedora 29. At first I tried to install via make install. But I got the same error as above, so I followed the complete installation list. I wanted to install it globally, so my finall make command was make sudo_install To me it seems like there are two issues:
To fix the first issue, set the PKG_CONFIG_PATH to: /usr/local/lib64/pkgconfig export PKG_CONFIG_PATH="/usr/local/lib64/pkgconfig" To fix the second issue, set the LD_LIBRARY_PATH to: /usr/local/lib64/ export LD_LIBRARY_PATH ="/usr/local/lib64/"
If you want these variables to be set even if you close your current terminal, but these either in ~/.bashrc or ~/.bash_profile depending on your distribution.
To verify that the variables are set:
Is this the expected way to do this, or is there a deeper problem and I'm just using a workaround?
If my solution is correct could these steps be put in the makefile, or should I make a pr for the installation readme?
edit: at least to me it seems that the libraries are not moved to the right folder. ldconfig looks in /usr/lib64, /lib64 /lib and /usr/lib the make file moves the files to /usr/local/lib64 which is a really good idea because it follows the FHS standard, but per default ldconfig doesn't look in that directory for libs. If you add the path to /etc/ld.so.conf then it works. So the solution seems to either add the environment variable $LD_LIBRARY_PATH, or edit the /etc/ld.so.conf file. Add this to the makefile or write it as a workaround?
I faced the same issue; the way I fixed it was by creating 'opencv.pc' file to /usr/local/lib/pkgconfig
when I run, pkg-config --cflags --libs opencv, I get the following:
Package opencv was not found in the pkg-config search path. Perhaps you should add the directory containing `opencv.pc' to the PKG_CONFIG_PATH environment variable No package 'opencv' found
The error message saying that opencv.pc is missing, so the solution is to add this file and import it into the environment variable. The steps as follows:
sudo vi /usr/local/lib/pkgconfig/opencv.pc
inside the new file paste the following:
prefix=/usr/local exec_prefix=${prefix} includedir=${prefix}/include libdir=${exec_prefix}/lib64
Name: opencv Description: The opencv library Version:4.2.0 Cflags: -I${includedir}/opencv4 Libs: -L${libdir} -lopencv_stitching -lopencv_objdetect -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_video -lopencv_photo -lopencv_ml -lopencv_imgproc -lopencv_flann -lopencv_core
Save the file and exit, and then import the file into the environment variable:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
The output result when executing pkg-config --cflags --libs opencv again is as follows:
-I/usr/local/include/opencv4 -L/usr/local/lib64 -lopencv_stitching -lopencv_objdetect -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_video -lopencv_photo -lopencv_ml -lopencv_imgproc -lopencv_flann -lopencv_core
I hope this will help you!
There is a file :
/usr/local/lib/pkgconfig/opencv4.pc
pkg-config --cflags -- opencv4
-I/usr/local/include/opencv4
i'm on macos sierra 10.12.6, and after i following the tuturials and run cmd: go run ./cmd/version/main.go, i got the following error message:
pkg-config --cflags -- opencv
Package opencv was not found in the pkg-config search path. Perhaps you should add the directory containing `opencv.pc' to the PKG_CONFIG_PATH environment variable No package 'opencv' found pkg-config: exit status 1
so please help , thx!
Your Environment
env.sh
orenv.cmd
script before trying togo run
orgo build
? i put following into my ~/.bash_profile and sourced it:export CGO_CXXFLAGS="--std=c++11" export CGO_CPPFLAGS="-I/usr/local/Cellar/opencv/3.4.3/include" export CGO_LDFLAGS="-L/usr/local/Cellar/opencv/3.4.3/lib -lopencv_stitching -lopencv_superres -lopencv_videostab -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dnn_objdetect -lopencv_dpm -lopencv_face -lopencv_photo -lopencv_fuzzy -lopencv_hfs -lopencv_img_hash -lopencv_line_descriptor -lopencv_optflow -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_surface_matching -lopencv_tracking -lopencv_datasets -lopencv_dnn -lopencv_plot -lopencv_xfeatures2d -lopencv_shape -lopencv_video -lopencv_ml -lopencv_ximgproc -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_flann -lopencv_xobjdetect -lopencv_imgcodecs -lopencv_objdetect -lopencv_xphoto -lopencv_imgproc -lopencv_core"