Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: libfontconfig.so.1: undefined symbol: FT_Done_MM_Var #12625

Closed
PoissonChasseur opened this issue Sep 23, 2018 · 11 comments
Closed
Labels
category: build/install category: python bindings incomplete question (invalid tracker) ask questions and other "no action" items here: https://forum.opencv.org

Comments

@PoissonChasseur
Copy link

PoissonChasseur commented Sep 23, 2018

System information (version)
  • OpenCV & OpenCV-contrib => 3.4.3
  • Operating System / Platform => Ubuntu 18.04 LTS, 64 bit
  • Compiler => gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0
  • Python version => Python 2.7.15 :: Anaconda, Inc.
  • CUDA version => NVCC 9.0, cuDNN 7.2.1
Detailed description

After I install OpenCV with OpenCV-contrib from source, I got the following error when I try to import OpenCV:
image
I just finish the compilation without error using:
cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D INSTALL_PYTHON_EXAMPLES=ON \ -D INSTALL_C_EXAMPLES=ON \ -D WITH_CUDA=OFF \ -D ENABLE_FAST_MATH=1 \ -D CUDA_FAST_MATH=1 \ -D WITH_CUBLAS=1 \ -D BUILD_EXAMPLES=ON \ -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.4.3/modules ..
I first tried with CUDA, but because of errors in connection with the version of gcc (NVCC needs version <5, but OpenCV needs version> 7 because of the error "-Wimplicit-fallthrough = 3 "unrecognized at 2% compilation). I finally did the compilation without CUDA and I had no compilation error.

I find that other people who have errors like this have had it with Mathematica or Draftsight (for example). However, I do not know how to fix this in the case of OpenCV.

Note that I successfully compiled OpenCV (without CUDA and OpenCV_contrib) yesterday with the same compilation options.

For information, that was the information I get from cmake before compiling. We can see than "freetype2" was correctly identified (even if it seem that it could be the cause of the problem according to some forum of similar trouble on Mathematica)


> cmake -D CMAKE_BUILD_TYPE=RELEASE \  -D CMAKE_INSTALL_PREFIX=/usr/local \  -D INSTALL_PYTHON_EXAMPLES=ON \  -D INSTALL_C_EXAMPLES=ON \  -D WITH_CUDA=OFF \  -D ENABLE_FAST_MATH=1 \  -D CUDA_FAST_MATH=1 \  -D WITH_CUBLAS=1 \  -D BUILD_EXAMPLES=ON \  -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.4.3/modules .. 
> -- Looking for ccache - not found
> -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.11", minimum required is "1.2.3") 
> -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") 
> -- Looking for linux/videodev.h
> -- 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 'libavresample'
> --   No package 'libavresample' found
> -- found Intel IPP (ICV version): 2017.0.3 [2017.0.3]
> -- at: /home/vincent/opencv-3.4.3/build/3rdparty/ippicv/ippicv_lnx
> -- found Intel IPP IW sources: 2017.0.3
> -- at: /home/vincent/opencv-3.4.3/build/3rdparty/ippicv/ippiw_lnx
> -- LAPACK(Atlas): LAPACK_LIBRARIES: /usr/lib/x86_64-linux-gnu/liblapack.so;/usr/lib/x86_64-linux-gnu/libcblas.so;/usr/lib/x86_64-linux-gnu/libatlas.so
> -- LAPACK(Atlas): Support is enabled.
> -- Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) 
> -- The imported target "vtkRenderingPythonTkWidgets" references the file
>    "/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so"
> but this file does not exist.  Possible reasons include:
> * The file was deleted, renamed, or moved to another location.
> * An install or uninstall procedure did not complete successfully.
> * The installation package was faulty and contained
>    "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
> but not all the files it references.
> 
> -- The imported target "vtk" references the file
>    "/usr/bin/vtk"
> but this file does not exist.  Possible reasons include:
> * The file was deleted, renamed, or moved to another location.
> * An install or uninstall procedure did not complete successfully.
> * The installation package was faulty and contained
>    "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
> but not all the files it references.
> 
> -- Found VTK 7.1.1 (/usr/lib/cmake/vtk-7.1/UseVTK.cmake)
> -- Caffe:   NO
> -- Protobuf:   NO
> -- Glog:   NO
> -- freetype2:   YES
> -- harfbuzz:    YES
> -- HDF5: Using hdf5 compiler wrapper to determine C configuration
> -- Module opencv_ovis disabled because OGRE3D was not found
> -- No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
> -- Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake.
> -- Failed to find gflags - Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components.
> -- Failed to find gflags - Could not find gflags include directory, set GFLAGS_INCLUDE_DIR to directory containing gflags/gflags.h
> -- Failed to find glog - Could not find glog include directory, set GLOG_INCLUDE_DIR to directory containing glog/logging.h
> -- Module opencv_sfm disabled because the following dependencies are not found: Glog/Gflags
> -- HDF5: Using hdf5 compiler wrapper to determine C configuration
> -- freetype2:   YES
> -- harfbuzz:    YES
> -- Checking for modules 'tesseract;lept'
> --   No package 'tesseract' found
> --   No package 'lept' found
> -- Tesseract:   NO
> -- OpenCL samples are skipped: OpenCL SDK is required
> -- 
> -- General configuration for OpenCV 3.4.3 =====================================
> --   Version control:               unknown
> -- 
> --   Extra modules:
> --     Location (extra):            /home/vincent/opencv_contrib-3.4.3/modules
> --     Version control (extra):     unknown
> -- 
> --   Platform:
> --     Timestamp:                   2018-09-22T22:13:51Z
> --     Host:                        Linux 4.15.0-34-generic x86_64
> --     CMake:                       3.10.2
> --     CMake generator:             Unix Makefiles
> --     CMake build tool:            /usr/bin/make
> --     Configuration:               RELEASE
> -- 
> --   CPU/HW features:
> --     Baseline:                    SSE SSE2 SSE3
> --       requested:                 SSE3
> --     Dispatched code generation:  SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
> --       requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
> --       SSE4_1 (5 files):          + SSSE3 SSE4_1
> --       SSE4_2 (2 files):          + SSSE3 SSE4_1 POPCNT SSE4_2
> --       FP16 (2 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
> --       AVX (6 files):             + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
> --       AVX2 (11 files):           + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
> --       AVX512_SKX (1 files):      + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_SKX
> -- 
> --   C/C++:
> --     Built as dynamic libs?:      YES
> --     C++11:                       YES
> --     C++ Compiler:                /usr/bin/c++  (ver 7.3.0)
> --     C++ flags (Release):         -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
> --     C++ flags (Debug):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
> --     C Compiler:                  /usr/bin/cc
> --     C flags (Release):           -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 -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -Wimplicit-fallthrough=3 -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG
> --     C flags (Debug):             -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 -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -Wimplicit-fallthrough=3 -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
> --     Linker flags (Release):      
> --     Linker flags (Debug):        
> --     ccache:                      NO
> --     Precompiled headers:         YES
> --     Extra dependencies:          dl m pthread rt
> --     3rdparty dependencies:
> -- 
> --   OpenCV modules:
> --     To be built:                 aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dpm face features2d flann freetype fuzzy hdf hfs highgui img_hash imgcodecs imgproc java_bindings_generator line_descriptor ml objdetect optflow phase_unwrapping photo plot python2 python_bindings_generator reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab viz xfeatures2d ximgproc xobjdetect xphoto
> --     Disabled:                    js matlab world
> --     Disabled by dependency:      -
> --     Unavailable:                 cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv java ovis python3 sfm
> --     Applications:                tests perf_tests examples apps
> --     Documentation:               NO
> --     Non-free algorithms:         YES
> -- 
> --   GUI: 
> --     GTK+:                        YES (ver 3.22.30)
> --       GThread :                  YES (ver 2.56.2)
> --       GtkGlExt:                  NO
> --     VTK support:                 YES (ver 7.1.1)
> -- 
> --   Media I/O: 
> --     ZLib:                        /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
> --     JPEG:                        /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
> --     WEBP:                        /usr/lib/x86_64-linux-gnu/libwebp.so (ver encoder: 0x020e)
> --     PNG:                         /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.34)
> --     TIFF:                        /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.0.9)
> --     JPEG 2000:                   /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1)
> --     OpenEXR:                     build (ver 1.7.1)
> --     HDR:                         YES
> --     SUNRASTER:                   YES
> --     PXM:                         YES
> -- 
> --   Video I/O:
> --     DC1394:                      YES (ver 2.2.5)
> --     FFMPEG:                      YES
> --       avcodec:                   YES (ver 57.107.100)
> --       avformat:                  YES (ver 57.83.100)
> --       avutil:                    YES (ver 55.78.100)
> --       swscale:                   YES (ver 4.8.100)
> --       avresample:                NO
> --     GStreamer:                   
> --       base:                      YES (ver 1.14.1)
> --       video:                     YES (ver 1.14.1)
> --       app:                       YES (ver 1.14.1)
> --       riff:                      YES (ver 1.14.1)
> --       pbutils:                   YES (ver 1.14.1)
> --     libv4l/libv4l2:              NO
> --     v4l/v4l2:                    linux/videodev2.h
> -- 
> --   Parallel framework:            pthreads
> -- 
> --   Trace:                         YES (with Intel ITT)
> -- 
> --   Other third-party libraries:
> --     Intel IPP:                   2017.0.3 [2017.0.3]
> --            at:                   /home/vincent/opencv-3.4.3/build/3rdparty/ippicv/ippicv_lnx
> --     Intel IPP IW:                sources (2017.0.3)
> --               at:                /home/vincent/opencv-3.4.3/build/3rdparty/ippicv/ippiw_lnx
> --     Lapack:                      YES (/usr/lib/x86_64-linux-gnu/liblapack.so /usr/lib/x86_64-linux-gnu/libcblas.so /usr/lib/x86_64-linux-gnu/libatlas.so)
> --     Eigen:                       YES (ver 3.3.4)
> --     Custom HAL:                  NO
> --     Protobuf:                    build (3.5.1)
> -- 
> --   OpenCL:                        YES (no extra features)
> --     Include path:                /home/vincent/opencv-3.4.3/3rdparty/include/opencl/1.2
> --     Link libraries:              Dynamic load
> -- 
> --   Python 2:
> --     Interpreter:                 /home/vincent/miniconda2/bin/python2.7 (ver 2.7.15)
> --     Libraries:                   /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.15rc1)
> --     numpy:                       /home/vincent/miniconda2/lib/python2.7/site-packages/numpy/core/include (ver 1.15.1)
> --     packages path:               lib/python2.7/site-packages
> -- 
> --   Python (for build):            /home/vincent/miniconda2/bin/python2.7
> -- 
> --   Java:                          
> --     ant:                         NO
> --     JNI:                         NO
> --     Java wrappers:               NO
> --     Java tests:                  NO
> -- 
> --   Matlab:                        YES
> --     mex:                         /usr/local/MATLAB/R2018b/bin/mex
> --     Compiler/generator:          Not working (bindings will not be generated)
> -- 
> --   Install to:                    /usr/local
> -- -----------------------------------------------------------------
> -- 
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /home/vincent/opencv-3.4.3/build
> 

@PoissonChasseur
Copy link
Author

PoissonChasseur commented Sep 29, 2018

I tried again by destroying the "build" folder created for compilation, create the "build" folder again and do all the steps for compilation again. As before, I did not have an error while compiling, but I still have this error when trying to import cv2. The only difference was the fact that the flag "Non-free algorithms" remains "NO" this time even if some module of opencv-contrib where there in the section "To be built" (like xfeature2d, ximgproc, xphoto). I also installed other libraries that was missing to try to have all the opencv-contrib modules, but that did not change anything.

My last compillation give me this:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D MAKE_INSTALL_PREFIX=/usr/local -D INSTALL_PYTHON_EXAMPLES=ON -D INSTALL_C_EXAMPLES=ON -D WITH_CUDA=OFF -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D WITH_CUBLAS=1 -D BUILD_EXAMPLES=ON -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.4.3/modules -D Tesseract_INCLUDE_DIR=/usr/lib/x86_64-linux-gnu/libtesseract.so -D OGR_INCLUDE_DIR=/usr/lib/x86_64-linux-gnu/ ..

-- Looking for ccache - not found
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.11", minimum required is "1.2.3") 
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") 
-- Looking for linux/videodev.h
-- 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 'libavresample'
--   Found libavresample, version 3.7.0
-- found Intel IPP (ICV version): 2017.0.3 [2017.0.3]
-- at: /home/vincent/opencv-3.4.3/build/3rdparty/ippicv/ippicv_lnx
-- found Intel IPP IW sources: 2017.0.3
-- at: /home/vincent/opencv-3.4.3/build/3rdparty/ippicv/ippiw_lnx
-- LAPACK(Atlas): LAPACK_LIBRARIES: /usr/lib/x86_64-linux-gnu/liblapack.so;/usr/lib/x86_64-linux-gnu/libcblas.so;/usr/lib/x86_64-linux-gnu/libatlas.so
-- LAPACK(Atlas): Support is enabled.
-- Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) 
-- Could NOT find Flake8 (missing: FLAKE8_EXECUTABLE) 
-- The imported target "vtkRenderingPythonTkWidgets" references the file
   "/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
but not all the files it references.

-- The imported target "vtk" references the file
   "/usr/bin/vtk"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
but not all the files it references.

-- Found VTK 7.1.1 (/usr/lib/cmake/vtk-7.1/UseVTK.cmake)
-- Caffe:   NO
-- Protobuf:   NO
-- Glog:   YES
-- freetype2:   YES
-- harfbuzz:    YES
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- Module opencv_ovis disabled because OGRE3D was not found
-- No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
-- Found installed version of gflags: /usr/lib/x86_64-linux-gnu/cmake/gflags
-- Detected gflags version: 2.2.1
-- Found installed version of Eigen: /usr/lib/cmake/eigen3
-- Found required Ceres dependency: Eigen version 3.3.4 in /usr/include/eigen3
-- Found required Ceres dependency: glog
-- Found installed version of gflags: /usr/lib/x86_64-linux-gnu/cmake/gflags
-- Detected gflags version: 2.2.1
-- Found required Ceres dependency: gflags
-- Found Ceres version: 2.0.0 installed in: /usr/local with components: [EigenSparse, SparseLinearAlgebraLibrary, LAPACK, SuiteSparse, CXSparse, SchurSpecializations]
-- Checking SFM deps... TRUE
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- freetype2:   YES
-- harfbuzz:    YES
-- Tesseract:   YES
-- No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
-- Found installed version of gflags: /usr/lib/x86_64-linux-gnu/cmake/gflags
-- Detected gflags version: 2.2.1
-- Found installed version of Eigen: /usr/lib/cmake/eigen3
-- Found required Ceres dependency: Eigen version 3.3.4 in /usr/include/eigen3
-- Found required Ceres dependency: glog
-- Found installed version of gflags: /usr/lib/x86_64-linux-gnu/cmake/gflags
-- Detected gflags version: 2.2.1
-- Found required Ceres dependency: gflags
-- Found Ceres version: 2.0.0 installed in: /usr/local with components: [EigenSparse, SparseLinearAlgebraLibrary, LAPACK, SuiteSparse, CXSparse, SchurSpecializations]
-- Checking SFM deps... TRUE
-- OpenCL samples are skipped: OpenCL SDK is required
-- Pylint: registered 159 targets. Build 'check_pylint' target to run checks ("cmake --build . --target check_pylint" or "make check_pylint")
-- 
-- General configuration for OpenCV 3.4.3 =====================================
--   Version control:               unknown
-- 
--   Extra modules:
--     Location (extra):            /home/vincent/opencv_contrib-3.4.3/modules
--     Version control (extra):     unknown
-- 
--   Platform:
--     Timestamp:                   2018-09-29T18:51:12Z
--     Host:                        Linux 4.15.0-34-generic x86_64
--     CMake:                       3.10.2
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/make
--     Configuration:               RELEASE
-- 
--   CPU/HW features:
--     Baseline:                    SSE SSE2 SSE3
--       requested:                 SSE3
--     Dispatched code generation:  SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
--       requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
--       SSE4_1 (5 files):          + SSSE3 SSE4_1
--       SSE4_2 (2 files):          + SSSE3 SSE4_1 POPCNT SSE4_2
--       FP16 (2 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
--       AVX (6 files):             + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
--       AVX2 (11 files):           + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
--       AVX512_SKX (1 files):      + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_SKX
-- 
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++11:                       YES
--     C++ Compiler:                /usr/bin/c++  (ver 7.3.0)
--     C++ flags (Release):         -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
--     C++ flags (Debug):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
--     C Compiler:                  /usr/bin/cc
--     C flags (Release):           -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 -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -Wimplicit-fallthrough=3 -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG
--     C flags (Debug):             -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 -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -Wimplicit-fallthrough=3 -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
--     Linker flags (Release):      
--     Linker flags (Debug):        
--     ccache:                      NO
--     Precompiled headers:         YES
--     Extra dependencies:          dl m pthread rt
--     3rdparty dependencies:
-- 
--   OpenCV modules:
--     To be built:                 aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dpm face features2d flann freetype fuzzy hdf hfs highgui img_hash imgcodecs imgproc java_bindings_generator line_descriptor ml objdetect optflow phase_unwrapping photo plot python2 python3 python_bindings_generator reg rgbd saliency sfm shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab viz xfeatures2d ximgproc xobjdetect xphoto
--     Disabled:                    js matlab world
--     Disabled by dependency:      -
--     Unavailable:                 cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv java ovis
--     Applications:                tests perf_tests examples apps
--     Documentation:               NO
--     Non-free algorithms:         NO
-- 
--   GUI: 
--     GTK+:                        YES (ver 3.22.30)
--       GThread :                  YES (ver 2.56.2)
--       GtkGlExt:                  NO
--     VTK support:                 YES (ver 7.1.1)
-- 
--   Media I/O: 
--     ZLib:                        /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
--     JPEG:                        /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
--     WEBP:                        /usr/lib/x86_64-linux-gnu/libwebp.so (ver encoder: 0x020e)
--     PNG:                         /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.34)
--     TIFF:                        /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.0.9)
--     JPEG 2000:                   /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1)
--     OpenEXR:                     build (ver 1.7.1)
--     HDR:                         YES
--     SUNRASTER:                   YES
--     PXM:                         YES
-- 
--   Video I/O:
--     DC1394:                      YES (ver 2.2.5)
--     FFMPEG:                      YES
--       avcodec:                   YES (ver 57.107.100)
--       avformat:                  YES (ver 57.83.100)
--       avutil:                    YES (ver 55.78.100)
--       swscale:                   YES (ver 4.8.100)
--       avresample:                YES (ver 3.7.0)
--     GStreamer:                   
--       base:                      YES (ver 1.14.1)
--       video:                     YES (ver 1.14.1)
--       app:                       YES (ver 1.14.1)
--       riff:                      YES (ver 1.14.1)
--       pbutils:                   YES (ver 1.14.1)
--     libv4l/libv4l2:              NO
--     v4l/v4l2:                    linux/videodev2.h
-- 
--   Parallel framework:            pthreads
-- 
--   Trace:                         YES (with Intel ITT)
-- 
--   Other third-party libraries:
--     Intel IPP:                   2017.0.3 [2017.0.3]
--            at:                   /home/vincent/opencv-3.4.3/build/3rdparty/ippicv/ippicv_lnx
--     Intel IPP IW:                sources (2017.0.3)
--               at:                /home/vincent/opencv-3.4.3/build/3rdparty/ippicv/ippiw_lnx
--     Lapack:                      YES (/usr/lib/x86_64-linux-gnu/liblapack.so /usr/lib/x86_64-linux-gnu/libcblas.so /usr/lib/x86_64-linux-gnu/libatlas.so)
--     Eigen:                       YES (ver 3.3.4)
--     Custom HAL:                  NO
--     Protobuf:                    build (3.5.1)
-- 
--   OpenCL:                        YES (no extra features)
--     Include path:                /home/vincent/opencv-3.4.3/3rdparty/include/opencl/1.2
--     Link libraries:              Dynamic load
-- 
--   Python 2:
--     Interpreter:                 /home/vincent/miniconda2/bin/python2.7 (ver 2.7.15)
--     Libraries:                   /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.15rc1)
--     numpy:                       /home/vincent/miniconda2/lib/python2.7/site-packages/numpy/core/include (ver 1.15.1)
--     packages path:               lib/python2.7/site-packages
-- 
--   Python 3:
--     Interpreter:                 /usr/bin/python3 (ver 3.6.6)
--     Libraries:                   /usr/lib/x86_64-linux-gnu/libpython3.6m.so (ver 3.6.6)
--     numpy:                       /usr/lib/python3/dist-packages/numpy/core/include (ver 1.13.3)
--     packages path:               lib/python3.6/dist-packages
-- 
--   Python (for build):            /home/vincent/miniconda2/bin/python2.7
--     Pylint:                      /home/vincent/miniconda2/bin/pylint (ver: 1.9.2, checks: 159)
-- 
--   Java:                          
--     ant:                         NO
--     JNI:                         NO
--     Java wrappers:               NO
--     Java tests:                  NO
-- 
--   Matlab:                        YES
--     mex:                         /usr/local/MATLAB/R2018b/bin/mex
--     Compiler/generator:          Not working (bindings will not be generated)
-- 
--   Install to:                    /usr/local
-- -----------------------------------------------------------------
-- 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/vincent/opencv-3.4.3/build

@PoissonChasseur
Copy link
Author

PoissonChasseur commented Sep 30, 2018

After looking for a long time on different forums, I found several things like:

  1. Install the package libselinux (libselinux1, libselinux1-dev, python-selinux):
    https://launchpad.net/ubuntu/%2Bsource/libselinux
  2. conda install -c asmeurer pango
    https://stackoverflow.com/questions/40110207/anaconda-opencv-arch-linux-libselinux-so-error
  3. Fix the bug of "libgomp.so.1" created by the last step:
    import xgboost OSError:version `GOMP_4.0' not found dmlc/xgboost#1786
  4. Delete the file "libfreetype.so.6" of "miniconda2/lib": Did not change anything, so I put it back as before:
    libfontconfig  probonopd/linuxdeployqt#259
  5. Install freetype and fontconfig (as it seems to be the cause of the problem). But nothing has changed:
    conda install -c anaconda freetype fontconfig

I end up giving up and simply use: pip install opencv-contrib-python

It only takes 30.6 MB and 5 seconds to install it and it has everything I need, but without the relationships with the libraries installed only for OpenCV (like VTK, Tesseract, etc.). At least it works, not like with CMAKE where I try to find a solution, but nothing seems to be able to correct this problem.

If anyone else has an idea to solve this problem, I'll try it to see if that fixes the problem. If no other solution can be found, this issue may be closed since another alternative has worked.

@allexlima
Copy link

allexlima commented Oct 15, 2018

Hi @PoissonChasseur, I also had the same problem. This error seems to persist even compiling OpenCv with different flags in cmake. Anyway, thanks for sharing the pip solution! It helped me a lot =)

In addition that, if someone needs opencv-contrib-python to use something like the module cv2.xfeatures2d, unfortunately, the last version of this package (~3.4.3) is throwing the error:

cv2.error: OpenCV(3.4.3) /io/opencv_contrib/modules/xfeatures2d/src/sift.cpp:1207: error: (-213:The function/feature is not implemented) This algorithm is patented and is excluded in this configuration; Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library in function 'create'

As the solution this StackOverflow post suggest to install a different version:

pip install opencv-python==3.4.2.16 opencv-contrib-python==3.4.2.16

@tyrossel
Copy link

tyrossel commented Nov 8, 2018

I also got this problem, which was maybe caused by the dev version 4.0.0 of OpenCV which I built previously (no idea actually). To solve this, I deleted the mentioned lib :

<...>/anaconda3/lib/libfontconfig.so
<...>/anaconda3/lib/libfontconfig.so.1
<...>/anaconda3/lib/libfontconfig.so.1.11.1

And I also got the same problem with :

<...>/anaconda3/lib/libpangoft2-1.0.so.0
<...>/anaconda3/lib/libpangoft2-1.0.so.0.4200.4

After removing those files and sudo make install in the openCV build directory, it seems to work well.

@fzh0917
Copy link

fzh0917 commented Jan 26, 2019

I also got this problem, which was maybe caused by the dev version 4.0.0 of OpenCV which I built previously (no idea actually). To solve this, I deleted the mentioned lib :

<...>/anaconda3/lib/libfontconfig.so
<...>/anaconda3/lib/libfontconfig.so.1
<...>/anaconda3/lib/libfontconfig.so.1.11.1

And I also got the same problem with :

<...>/anaconda3/lib/libpangoft2-1.0.so.0
<...>/anaconda3/lib/libpangoft2-1.0.so.0.4200.4

After removing those files and sudo make install in the openCV build directory, it seems to work well.

Thanks. I solved my problem after trying your method. Honestly, I don't uncertain that whether other problems will occur after deleting those files.

@Breta01
Copy link

Breta01 commented Jul 20, 2019

I just run into the same issue on Ubuntu 18.04 with default installation of anaconda3. It looks like incompatible versions of fontconfig (2.13) and pango (1.42). Removing files mentioned above won't remove the packages from anaconda completely and it seems as way to hell (broken conda base environment). I would recommend installing correct versions as follows:

conda install fontconfig=2.12 pango=1.40

In my base environment it created unresolvable conflicts, but creating new environment with these versions works. So create environment as follows (use python version which you used for compilation):

conda create -n opencv python=3.6 pango=1.40 fontconfig=2.12 numpy

Then copy cv2 folder from previous enviroment (for base environment it is located in anaconda3/lib/python3.6/site-packages/cv2) to the new environment anaconda3/envs/opencv/lib/python3.6/site-packages. This make it work for me. Then if you want to create new environment including OpenCV package, you can clone the opencv environment.

conda create -n new_opencv_env --clone opencv

This will make OpenCV work right away.

@varunagrawal
Copy link

Uninstall fontconfig conda uninstall fontconfig fixed this for me.

@LongruiDong
Copy link

This answer works for me~

@RohitDhankar
Copy link

Uninstall fontconfig conda uninstall fontconfig fixed this for me.

Hi @varunagrawal and others on this thread - same issue here , any non-hackish solutions ? Thanks

@varunagrawal
Copy link

@RohitDhankar not that I am aware of, sadly. The correct way would be to do an RCA and fix the underlying issue in OpenCV.

@legel
Copy link

legel commented Feb 26, 2021

I also got this problem, which was maybe caused by the dev version 4.0.0 of OpenCV which I built previously (no idea actually). To solve this, I deleted the mentioned lib :

<...>/anaconda3/lib/libfontconfig.so
<...>/anaconda3/lib/libfontconfig.so.1
<...>/anaconda3/lib/libfontconfig.so.1.11.1

And I also got the same problem with :

<...>/anaconda3/lib/libpangoft2-1.0.so.0
<...>/anaconda3/lib/libpangoft2-1.0.so.0.4200.4

After removing those files and sudo make install in the openCV build directory, it seems to work well.

As well, I had to remove this:

rm libgio-2.0.so.0

Then import cv2 works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: build/install category: python bindings incomplete question (invalid tracker) ask questions and other "no action" items here: https://forum.opencv.org
Projects
None yet
Development

No branches or pull requests

10 participants