question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Building openCV fails

See original GitHub issue

Hi,

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:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
darosiorcommented, Oct 20, 2018

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 :

opencv - ImportError: numpy.core.multiarray failed to import

A little search made me do

pip install -U numpy

to have it work. Maybe the numpy version in requirements is too low ?

0reactions
AndreMirascommented, Sep 10, 2019

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 🍻

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found