You are not logged in.

#1 2018-10-16 08:01:47

averagejoe
Member
Registered: 2015-10-09
Posts: 7

Problems with compiling OpenCV 3.2.0

Hello,

I need to compile OpenCV version 3.2.0 for it is required in labs at school. Pacman provides 3.4.3.-3 and AUR provides the git version. I'd like to note that i've never edited PKGBUILD's before but they seem quite straightforward. This is what i've done so far with no success:

I cloned https://aur.archlinux.org/packages/opencv-git/ and edited the PKGBUILD as follows:

pkgver=3.2.0.r0.g70bbf17b13

source=('git+https://github.com/opencv/opencv.git#tag=3.2.0'
          'git+https://github.com/opencv/opencv_contrib.git#tag=3.2.0')

This is all fine and working, git gets cloned and configuration is a success. However when 'makepkg -s'  starts to make package, I get a quite frustrating error:

In file included from /home/awsomeusername/build/opencv-git/src/opencv/modules/core/src/hal_internal.cpp:49:
/home/awesomeusername/build/opencv-git/src/build/opencv_lapack.h:1:10: fatal error: CBLAS_H_PATH-NOTFOUND//usr/include/cblas.h: No such file or directory
 #include "CBLAS_H_PATH-NOTFOUND//usr/include/cblas.h"
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

As far as I can tell this indicates that cmake can't find the file at '/usr/include/cblas.h' however:

awesomeusername@machine:~$ ls /usr/include/cblas.h 
/usr/include/cblas.h

So the question is, why am I presented with this error while it seems to me that the file exists. blas is installed via pacman and its version is: blas-3.8.0-2.

Thanks for reading my post ! smile

--

Joe

Last edited by averagejoe (2018-10-16 10:39:36)

Offline

#2 2018-10-16 15:51:53

Lone_Wolf
Forum Moderator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,922

Re: Problems with compiling OpenCV 3.2.0

The error is probably caused by something else way before the abort, we'd need the whole makepkg log to investigate.

There's an easier  way that doesn't involve editing : use the same PKGBUILD arch linux used for 3.2.0-5 (the last version we had before opencv 3.3.0 ).

It can be tricky to find the correct one in archlinux svntogit repos, so I found it for you :
https://git.archlinux.org/svntogit/pack … 78a4b682cf

Try building that.

Last edited by Lone_Wolf (2018-10-16 15:52:33)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#3 2018-10-17 07:01:03

averagejoe
Member
Registered: 2015-10-09
Posts: 7

Re: Problems with compiling OpenCV 3.2.0

Lone_Wolf wrote:

The error is probably caused by something else way before the abort, we'd need the whole makepkg log to investigate.

There's an easier  way that doesn't involve editing : use the same PKGBUILD arch linux used for 3.2.0-5 (the last version we had before opencv 3.3.0 ).

It can be tricky to find the correct one in archlinux svntogit repos, so I found it for you :
https://git.archlinux.org/svntogit/pack … 78a4b682cf

Try building that.

Thanks for the tip!

I tried exactly this but ended up getting the same type of error - file(<stdlib.h>) exists in multiple locations but make can't find it. But at least now I logged the whole makepkg process. I also edited the PKGBUILD according to a popular stackoverflow fix regarding this problem and opencv - added this to cmake options lines: "-D ENABLE_PRECOMPILED_HEADERS=OFF".  This got me a bit further but eventually gave me an error. I'm posting both logs.

https://pastebin.com/MJ3ua145 -without editing PKGBUILD
https://pastebin.com/pF23uLbC - with cmake option "-D ENABLE_PRECOMPILED_HEADERS=OFF"

I also tried compiling with gcc-6(6.4.1), it did not yield anything better. As for makeflags I'm compiling with 4 cores(-j5) for opencv reccommends compiling with multiple cores. I tried with one core just in case but it did not produce expected results.

EDIT:
Note: I just got word that opencv 3.4.3 is actually fine to work with but I would like to pursue this compilation problem for self-educational purposes. This just means that no hurry smile.

Last edited by averagejoe (2018-10-17 07:46:53)

Offline

#4 2018-10-27 12:20:43

Lone_Wolf
Forum Moderator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,922

Re: Problems with compiling OpenCV 3.2.0

I've focused on the log that builds with -D ENABLE_PRECOMPILED_HEADERS=OFF .

/home/philo/build/opencv/src/opencv-3.2.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1541:21: error:  was not declared in this scope
         c->flags |= CODEC_FLAG_GLOBAL_HEADER;
                     ^~~~~~~~~~~~~~~~~~~~~~~~
/home/philo/build/opencv/src/opencv-3.2.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1541:21: note: suggested alternative:
         c->flags |= CODEC_FLAG_GLOBAL_HEADER;
                     ^~~~~~~~~~~~~~~~~~~~~~~~
                     AV_CODEC_FLAG_GLOBAL_HEADER
/home/philo/build/opencv/src/opencv-3.2.0/modules/videoio/src/cap_ffmpeg_impl.hpp: In function :
/home/philo/build/opencv/src/opencv-3.2.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1569:30: error:  was not declared in this scope
     if (oc->oformat->flags & AVFMT_RAWPICTURE) {
                              ^~~~~~~~~~~~~~~~
/home/philo/build/opencv/src/opencv-3.2.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1569:30: note: suggested alternative:
     if (oc->oformat->flags & AVFMT_RAWPICTURE) {
                              ^~~~~~~~~~~~~~~~
                              AVFMT_NOFILE
/home/philo/build/opencv/src/opencv-3.2.0/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function :
/home/philo/build/opencv/src/opencv-3.2.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1743:35: error:  was not declared in this scope
         if( (oc->oformat->flags & AVFMT_RAWPICTURE) == 0 )
                                   ^~~~~~~~~~~~~~~~
/home/philo/build/opencv/src/opencv-3.2.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1743:35: note: suggested alternative:
         if( (oc->oformat->flags & AVFMT_RAWPICTURE) == 0 )
                                   ^~~~~~~~~~~~~~~~
                                   AVFMT_NOFILE
/home/philo/build/opencv/src/opencv-3.2.0/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function :
/home/philo/build/opencv/src/opencv-3.2.0/modules/videoio/src/cap_ffmpeg_impl.hpp:2039:32: error:  was not declared in this scope
     if (!(oc->oformat->flags & AVFMT_RAWPICTURE)) {
                                ^~~~~~~~~~~~~~~~
/home/philo/build/opencv/src/opencv-3.2.0/modules/videoio/src/cap_ffmpeg_impl.hpp:2039:32: note: suggested alternative:
     if (!(oc->oformat->flags & AVFMT_RAWPICTURE)) {
                                ^~~~~~~~~~~~~~~~
                                AVFMT_NOFILE
/home/philo/build/opencv/src/opencv-3.2.0/modules/videoio/src/cap_ffmpeg_impl.hpp: In static member function :
/home/philo/build/opencv/src/opencv-3.2.0/modules/videoio/src/cap_ffmpeg_impl.hpp:2338:25: error:  was not declared in this scope
             c->flags |= CODEC_FLAG_GLOBAL_HEADER;
                         ^~~~~~~~~~~~~~~~~~~~~~~~
/home/philo/build/opencv/src/opencv-3.2.0/modules/videoio/src/cap_ffmpeg_impl.hpp:2338:25: note: suggested alternative:
             c->flags |= CODEC_FLAG_GLOBAL_HEADER;
                         ^~~~~~~~~~~~~~~~~~~~~~~~
                         AV_CODEC_FLAG_GLOBAL_HEADER
make[2]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/build.make:154: modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_ffmpeg.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....

Looks like it has to do with ffmpeg .

opencv 3.2.0-5 was build in june 2017 and ffmpeg was at version 3.3.x then.


ffmpeg is one of those packages that need rebuilds often, so I don't think installing older ffmpeg from archlinux archive will work.

AUR has several ffmpeg 3.x versions, but I have no idea which one(s) is/are properly maintained.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#5 2018-10-27 12:47:27

loqs
Member
Registered: 2014-03-06
Posts: 17,373

Re: Problems with compiling OpenCV 3.2.0

Offline

Board footer

Powered by FluxBB