Centos 7 building: many missing packages e.g. videodev.h, libavutil building

asked 2017-02-13 14:40:51 -0600

updated 2017-02-14 12:56:22 -0600

I have followed the instructions at "Install OpenCV 3.1 and Python 2.7 on CentOS 7" (At www.computervisiononline.com , "my karma is insufficient to publish links" ) but am getting many errors building OpenCV on Centos 7.

I looked for and installed any similar packages I could find (a lot) but am still getting most of the errors.

$ sudo yum install gstreamer1
$ sudo yum install gstreamer1-libav
$ sudo yum install  gstreamer1-plugins-base-devel
$ sudo yum install libavutil libswscale libavresample ffmpeg libgphoto2 gphoto2
sudo yum install vtk ...

Cmake command and errors:

$ cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \
    -D INSTALL_C_EXAMPLES=OFF \
    -D INSTALL_PYTHON_EXAMPLES=ON \
    -D BUILD_EXAMPLES=ON \
    -D BUILD_OPENCV_PYTHON2=ON ..

-- Looking for linux/videodev.h - not found
-- Looking for linux/videodev2.h
-- Looking for linux/videodev2.h - found
-- Looking for sys/videoio.h
-- Looking for sys/videoio.h - not found
-- checking for module 'libavcodec'
--   package 'libavcodec' not found ...
-- checking for module 'libavformat'
--   package 'libavformat' not found
-- checking for module 'libavutil'
--   package 'libavutil' not found
-- checking for module 'libswscale'
--   package 'libswscale' not found
-- checking for module 'libavresample'
--   package 'libavresample' not found
-- Looking for libavformat/avformat.h
-- Looking for libavformat/avformat.h - not found
-- Looking for ffmpeg/avformat.h
-- Looking for ffmpeg/avformat.h - not found
-- checking for module 'libgphoto2'
--   package 'libgphoto2' not found

 . . .
-- Configuring incomplete, errors occurred! See also "/opt/opencv/opencv/build/CMakeFiles/CMakeOutput.log". See also "/opt/opencv/opencv/build/CMakeFiles/CMakeError.log".

CMakeError.log ends with

    Building C object CMakeFiles/cmTryCompileExec3179090135.dir/CheckIncludeFile.c.o
/bin/cc   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden  -O3 -DNDEBUG   -o CMakeFiles/cmTryCompileExec3179090135.dir/CheckIncludeFile.c.o   -c /opt/opencv/opencv/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c
/opt/opencv/opencv/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:29: fatal error: ffmpeg/avformat.h: No such file or directory
 #include <ffmpeg/avformat.h>
                             ^
compilation terminated.
gmake[1]: *** [CMakeFiles/cmTryCompileExec3179090135.dir/CheckIncludeFile.c.o] Error 1
gmake[1]: Leaving directory `/opt/opencv/opencv/build/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec3179090135/fast] Error 2

Full output of Cmake (Added Feb 14 10:50 am pst)

$ cd     /opt/opencv/opencv/build
$ cmake -D CMAKE_BUILD_TYPE=RELEASE     -D CMAKE_INSTALL_PREFIX=/usr/local     -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules     -D INSTALL_C_EXAMPLES=OFF     -D INSTALL_PYTHON_EXAMPLES=ON     -D BUILD_EXAMPLES=ON     -D BUILD_OPENCV_PYTHON2=ON ..
-- The CXX compiler identification is GNU 4.8.5
-- The C compiler identification is GNU 4.8.5
-- Check for working CXX compiler: /bin/c++
-- Check for working CXX compiler: /bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working C compiler: /bin/cc
-- Check for working C compiler: /bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detected version of GNU GCC: 48 (408)
-- Performing Test HAVE_CXX_FSIGNED_CHAR
-- Performing Test HAVE_CXX_FSIGNED_CHAR - Success
-- Performing Test HAVE_C_FSIGNED_CHAR
-- Performing Test HAVE_C_FSIGNED_CHAR - Success
-- Performing Test HAVE_CXX_W
-- Performing Test HAVE_CXX_W - Success
-- Performing Test HAVE_C_W
-- Performing ...
(more)
edit retag flag offensive close merge delete

Comments

It is only warning send by cmake

LBerger gravatar imageLBerger ( 2017-02-14 01:28:44 -0600 )edit

I don't think so. The build ends with " Configuring incomplete, errors occurred! " . See more error messages I added to end of original post. I can't find any object libraries or executables. The next step in the instructions is

$ sudo make
$ sudo make install

which fail because there isn't even a Makefile in the build directory. (I assume the CMake build creates it).

ttulinsky gravatar imagettulinsky ( 2017-02-14 11:09:02 -0600 )edit

Delete cmakecache.txt. run your cmake command. If problem persist uninstalled ffmpeg and reinstall it and test your ffmpef installation (check ffmpeg/avformat.h)

LBerger gravatar imageLBerger ( 2017-02-14 11:26:48 -0600 )edit

Thanks for ideas. I deleted CMakeCache.txt and the build got further. But it ended with the same or similar errors. (full output posted in original msg). Then I did

sudo yum remove ffmpeg
sudo yum install ffmpeg

but "testing ffmpeg installation", I could not find an avformat.h file,

  $ locate avformat.h
/usr/share/doc/ffmpeg/libavformat.html



$ locate */avformat.h
$

Search all files in package ffmpeg:

$ rpm -ql ffmpeg |grep 'avformat'
/usr/share/doc/ffmpeg/libavformat.html

in fact no .h files in the package

$ rpm -ql ffmpeg |grep '\.h$'

not in any package in the repos I use:

$   yum whatprovides avformat.h
Loaded plugins ...
 * base: mirrors.sonic.net
 * epel: mirror.n5tech.com
 * extras: mirror.keystealth.org

(max comm. len

ttulinsky gravatar imagettulinsky ( 2017-02-14 13:08:35 -0600 )edit

finishing previous comment which exceeded maximum length--

$   yum whatprovides avformat.h
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.sonic.net
 * epel: mirror.n5tech.com
 * extras: mirror.keystealth.org
 * nux-dextop: mirror.li.nux.ro
 * updates: mirror.hmc.edu
No matches found
ttulinsky gravatar imagettulinsky ( 2017-02-14 13:10:29 -0600 )edit

I cannot help you more I'm not at all a linux expert. If you want to use opencv you can disable ffmpeg : WITH_FFMPEG=OFF and try to solve later ffmpeg problem

LBerger gravatar imageLBerger ( 2017-02-14 15:31:51 -0600 )edit