LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-07-2019, 10:09 AM   #1
timsoft
Member
 
Registered: Oct 2004
Location: scotland
Distribution: slackware 15.0 64bit, 14.2 64 and 32bit and arm, ubuntu and rasbian
Posts: 495

Rep: Reputation: 144Reputation: 144
Question ffmpeg can't find opencv


i'm running on fully patched slackware 14.2 64bit.
the ffmpeg slackbuild is complaining that pkg-config can't find opencv
Code:
patching file configure
patching file libavcodec/libopenjpegdec.c
patching file libavcodec/libopenjpegenc.c
patching file libavcodec/libfdk-aacenc.c
ERROR: opencv not found using pkg-config

If you think configure made a mistake, make sure you are using the latest
version from Git.  If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.log" produced by configure as this will help
solve the problem.
it is actually called opencv4.pc in /usr/lib64/pkgconfig/
but I have tried copying opencv4.pc renaming it opencv.pc, but that didn't work. I also tried replacing " opencv " with " opencv4 " in the ffmpeg configure file prior to running it, but that didn't help apart from it complained it couldn't find opencv4 instead of opencv
running
Code:
pkg-config --exists opencv4&&echo "ok"
produces ok as you would expect, and
Code:
pkg-config --list-all|grep opencv
produces
Code:
opencv4                             OpenCV - Open Source Computer Vision Library
so pkgconfig can definitely find opencv4 even if the build script or ffmpeg configure system can't! I had a look at config.log, and tailing the last 17 lines gives
Code:
check_pkg_config opencv opencv/cxcore.h cvCreateImageHeader
pkg-config --exists --print-errors opencv
check_func_headers opencv/cxcore.h cvCreateImageHeader -I/usr/include/opencv4/opencv -I/usr/include/opencv4 -lopencv_gapi -lopencv_stitching -lopencv_videostab -lopencv_structured_light -lopencv_xphoto -lopencv_superres -lopencv_line_descriptor -lopencv_bioinspired -lopencv_rgbd -lopencv_fuzzy -lopencv_hdf -lopencv_cvv -lopencv_xobjdetect -lopencv_phase_unwrapping -lopencv_hfs -lopencv_stereo -lopencv_tracking -lopencv_datasets -lopencv_ml -lopencv_saliency -lopencv_bgsegm -lopencv_aruco -lopencv_ccalib -lopencv_img_hash -lopencv_shape -lopencv_surface_matching -lopencv_reg -lopencv_freetype -lopencv_face -lopencv_photo -lopencv_optflow -lopencv_ximgproc -lopencv_video -lopencv_plot -lopencv_dpm -lopencv_objdetect -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_imgproc -lopencv_flann -lopencv_core
check_ld cc -I/usr/include/opencv4/opencv -I/usr/include/opencv4 -lopencv_gapi -lopencv_stitching -lopencv_videostab -lopencv_structured_light -lopencv_xphoto -lopencv_superres -lopencv_line_descriptor -lopencv_bioinspired -lopencv_rgbd -lopencv_fuzzy -lopencv_hdf -lopencv_cvv -lopencv_xobjdetect -lopencv_phase_unwrapping -lopencv_hfs -lopencv_stereo -lopencv_tracking -lopencv_datasets -lopencv_ml -lopencv_saliency -lopencv_bgsegm -lopencv_aruco -lopencv_ccalib -lopencv_img_hash -lopencv_shape -lopencv_surface_matching -lopencv_reg -lopencv_freetype -lopencv_face -lopencv_photo -lopencv_optflow -lopencv_ximgproc -lopencv_video -lopencv_plot -lopencv_dpm -lopencv_objdetect -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_imgproc -lopencv_flann -lopencv_core
check_cc -I/usr/include/opencv4/opencv -I/usr/include/opencv4
BEGIN /tmp/ffconf.XXzVWgeR.c
    1   #include <opencv/cxcore.h>
    2   #include <stdint.h>
    3   long check_cvCreateImageHeader(void) { return (long) cvCreateImageHeader; }
    4   int main(void) { int ret = 0;
    5    ret |= ((intptr_t)check_cvCreateImageHeader) & 0xFFFF;
    6   return ret; }
END /tmp/ffconf.XXzVWgeR.c
gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -O2 -fPIC -std=c99 -fomit-frame-pointer -fPIC -pthread -I/usr/include/p11-kit-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/fribidi -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/bs2b -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/fribidi -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/opencv4/opencv -I/usr/include/opencv4 -c -o /tmp/ffconf.XXzsAyaV.o /tmp/ffconf.XXzVWgeR.c
/tmp/ffconf.XXzVWgeR.c:1:27: fatal error: opencv/cxcore.h: No such file or directory
compilation terminated.
ERROR: opencv not found using pkg-config
so it is trying to compile a test program, however /usr/include/opencv4/opencv does not exist (it is /usr/inlcude/opencv4/opencv2) and neither does cxcore.h exist - the nearest thing to it is core.hpp
It appears that the test case for opencv is not applicable to opencv (version 4)
has anyone managed to get ffmpeg compiling with opencv ?
 
Old 01-07-2019, 10:24 AM   #2
ponce
LQ Guru
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 7,143

Rep: Reputation: 4211Reputation: 4211Reputation: 4211Reputation: 4211Reputation: 4211Reputation: 4211Reputation: 4211Reputation: 4211Reputation: 4211Reputation: 4211Reputation: 4211
I think (I may be wrong) opencv-4.x is just not usable by ffmpeg as it's too new, so maybe your best option is to avoid passing ffmpeg.SlackBuild the parameter OPENCV=yes
 
Old 01-07-2019, 10:26 AM   #3
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657
I'm guessing you have opencv v4 installed and that will probably only work with ffmpeg v4. Try installing opencv-legacy from SBo and see if it picks that up. If it does, you may want to ping the maintainer to have him change the optional dependency for opencv to opencv-legacy.
 
Old 01-07-2019, 11:03 AM   #4
timsoft
Member
 
Registered: Oct 2004
Location: scotland
Distribution: slackware 15.0 64bit, 14.2 64 and 32bit and arm, ubuntu and rasbian
Posts: 495

Original Poster
Rep: Reputation: 144Reputation: 144
will do. I'll report back on progress (i've uninstalled opencv4 and opencv-legacy is at 14%)
 
Old 01-07-2019, 02:12 PM   #5
timsoft
Member
 
Registered: Oct 2004
Location: scotland
Distribution: slackware 15.0 64bit, 14.2 64 and 32bit and arm, ubuntu and rasbian
Posts: 495

Original Poster
Rep: Reputation: 144Reputation: 144
well thanks bassmadrigal and ponce for looking. indeed using opencv-legacy for ffmpeg (and frei0r) allows ffmpeg to complete.
After rebuilding frei0r with opencv-legacy, and then building ffmpeg with all options, i rebuilt transcode, then vid.stab and then rebuilt ffmpeg the third time. Now it should pretty much have the kitchen sink!
I'd better let Heinz know that the optional dep for ffmpeg should be opencv-legacy not opencv as it is too new.

in-fact ponce, if you're reading this, as the frei0r slackbuild maintainer, it might be worth mentioning in the frei0r readme that if people are using frei0r with ffmpeg<4 then they probably want to use opencv-legacy instead of opencv for that optional dep.
Of course it has brought to my attention there is ffmpeg4 but I have no idea if that works with audacity or vlc so I'll leave it for now. It's taken long enough for this version.
 
Old 04-10-2019, 05:24 AM   #6
oldpink
Member
 
Registered: Feb 2004
Posts: 37

Rep: Reputation: 1
I am currently using ffmpeg version 4.1.3 with no trouble at all with Auadacity and VLC (not to mention SMPlayer and various audio/visual viewers and editors), but I'm using my own hand customized SlackBuild and not the one on from Andreas Guldstrand up on slackbuilds.org.
The slackbuilds.org version has customized directories for the files, where my customized build puts everything directly in the standard /usr/lib64 /usr/include /usr/share directories.
I can tell you that my build uses as many of the optional dependencies as I could possibly build it with, and I can say that I have had no success building with --enable-opencv when using any of the OpenCV version 4.x, so (as with you) I have had to use OpenCV version 3.x (specifically, version 3.4.5) in order to build ffmpeg with that option.
I was able to get the build further along by making a symbolic link /usr/include/opencv2 pointed to /usr/include/opencv4/opencv2, but the configure phase of the build still fails with a complaint about requiring C++11, but even when I rebuilt and installed OpenCV by adding "-std=c++11" as a CXXFLAG, then tried building ffmpeg, both with and with the same CXXFLAG addition, but it still fails in the configure phase.
It's not really a big deal using the somewhat older version of OpenCV, but it's still puzzling what is causing the error, and I like to keep things pretty current.
Just thought I'd give you more info to use.

Last edited by oldpink; 04-10-2019 at 05:28 AM. Reason: typos
 
  


Reply

Tags
ffmpeg, opencv



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
install OpenCV Looking for ffmpeg/avformat.h - not found lijing8898 Linux - Software 2 06-18-2012 04:45 AM
OpenCV - Pixel format of incoming image is unsupported by OpenCV golmschenk Programming 1 04-01-2011 12:32 PM
Opencv error: /usr/bin/ld.real: cannot find -lcv; collect2: ld returned 1 exit status Ankithskarat Linux - Newbie 1 03-24-2010 12:03 AM
unable to use configure opencv with ffmpeg srinivasmiriyalu Linux - Newbie 2 10-02-2009 10:29 AM
installing ffmpeg for opencv josemalo Linux - Software 1 02-27-2006 10:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 03:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration