Building openCV fails
See original GitHub issueHi,
make system_dependencies
make opencv_build
as stated in https://github.com/kivy-garden/garden.zbarcam/blob/develop/OpenCV.md, stops with the following errors :
error: ‘AVFMT_RAWPICTURE’ was not declared in this scope
if (oc->oformat->flags & AVFMT_RAWPICTURE) {
error: ‘AVFMT_RAWPICTURE’ was not declared in this scope
if( (oc->oformat->flags & AVFMT_RAWPICTURE) == 0 )
error: ‘AVFMT_RAWPICTURE’ was not declared in this scope
if (!(oc->oformat->flags & AVFMT_RAWPICTURE)) {
error: ‘CODEC_FLAG_GLOBAL_HEADER’ was not declared in this scope
c->flags |= CODEC_FLAG_GLOBAL_HEADER;
I managed to have it built by changing the Makefile from :
$(OPENCV_BUILD):
curl --location https://github.com/opencv/opencv/archive/$(OPENCV_VERSION).tar.gz \
--progress-bar --output $(OPENCV_BASENAME).tar.gz
tar -xf $(OPENCV_BASENAME).tar.gz
cmake \
-D BUILD_DOCS=OFF -D BUILD_PACKAGE=OFF -D BUILD_PERF_TESTS=OFF \
-D BUILD_TESTS=OFF -D BUILD_opencv_apps=OFF \
-D BUILD_opencv_nonfree=OFF -D BUILD_opencv_stitching=OFF \
-D BUILD_opencv_superres=OFF -D BUILD_opencv_ts=OFF \
-D BUILD_WITH_DEBUG_INFO=OFF -D WITH_1394=OFF -D WITH_CUDA=OFF \
-D WITH_CUFFT=OFF -D WITH_GIGEAPI=OFF -D WITH_JASPER=OFF \
-D WITH_OPENEXR=OFF -D WITH_PVAPI=OFF -D WITH_GTK=OFF \
-D BUILD_opencv_python=ON -B$(OPENCV_BASENAME)/build -H$(OPENCV_BASENAME)
cmake --build $(OPENCV_BASENAME)/build -- -j$(NPROC)
To :
$(OPENCV_BUILD):
curl --location https://github.com/opencv/opencv/archive/$(OPENCV_VERSION).tar.gz \
--progress-bar --output $(OPENCV_BASENAME).tar.gz
tar -xf $(OPENCV_BASENAME).tar.gz
sed -i '1s/^/#define AV_CODEC_FLAG_GLOBAL_HEADER (1 << 22)\n#define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER\n#define AVFMT_RAWPICTURE 0x0020\n/' "$(OPENCV_BASENAME)/modules/highgui/src/cap_ffmpeg_impl.hpp"
cmake \
-D BUILD_DOCS=OFF -D BUILD_PACKAGE=OFF -D BUILD_PERF_TESTS=OFF \
-D BUILD_TESTS=OFF -D BUILD_opencv_apps=OFF \
-D BUILD_opencv_nonfree=OFF -D BUILD_opencv_stitching=OFF \
-D BUILD_opencv_superres=OFF -D BUILD_opencv_ts=OFF \
-D BUILD_WITH_DEBUG_INFO=OFF -D WITH_1394=OFF -D WITH_CUDA=OFF \
-D WITH_CUFFT=OFF -D WITH_GIGEAPI=OFF -D WITH_JASPER=OFF \
-D WITH_OPENEXR=OFF -D WITH_PVAPI=OFF -D WITH_GTK=OFF \
-D BUILD_opencv_python=ON -B$(OPENCV_BASENAME)/build -H$(OPENCV_BASENAME)
cmake --build $(OPENCV_BASENAME)/build -- -j$(NPROC)
If it can help
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Not able to build openCV from source
Error occurs when building files using make command. System information (version) OpenCV => 4.5.1 Operating System / Platform => Virtual ...
Read more >Failed to build opencv-python - Stack Overflow
I created a virtual environment to use and when I tried to install the opencv library, I got an error message. I am...
Read more >ERROR: Failed building wheel for opencv-python #18359
hi i am running on python3.7 and pip 20.2.3 on ubuntu 18.04, arm64. when i am trying to install opencv using pip3 install...
Read more >Got an error while installing opencv-python - Edureka
I want to install opencv-python using command prompt but it is showing me the error as follows: I am using command as follows:...
Read more >Error when installing opencv (any version) on Ubuntu 18.04
This error means that the libavcodec (directly installed on your system or in-directly installed via FFmpeg) library present on your system ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, another thing to report I cloned the repo and after reproducing all the steps I could not launch the demo application, with the following error :
A little search made me do
to have it work. Maybe the numpy version in requirements is too low ?
Closing as we just moved to the new builtin opencv module which is available under PyPI 🎉 Refs https://github.com/kivy-garden/zbarcam/issues/23 Thanks again for the help 🍻