opencv / opencv_contrib

Repository for OpenCV's extra modules
Apache License 2.0
9.34k stars 5.75k forks source link

cv2.cpp compiler error #1087

Closed tofaa closed 6 years ago

tofaa commented 7 years ago

## while compiling opencv 3.2.0 with visual studio 11 and cmake there only one error as shown please help fast what should i do ?

1>------ Build started: Project: opencv_python2, Configuration: Release Win32 ------ 1> cv2.cpp 1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xmemory0(605): error C2129: static function 'PyObject *pyopencv_from(const T &)' declared but not defined 1> with 1> [ 1> T=cv::Matx44d 1> ] 1> C:\Users\tofaa\Downloads\Compressed\opencv\sources\opencv-3.2.0\opencv-3.2.0\modules\python\src2\cv2.cpp(207) : see declaration of 'pyopencv_from' ========== Build: 0 succeeded, 1 failed, 101 up-to-date, 0 skipped ==========

alalek commented 7 years ago

More details are required:

jwarchol commented 7 years ago

I'm seeing the same issue. Here's my cmake output. Very new to the project, so if there some other output you mean please point me in the right direction and I'll provide whatever I can. Thanks!

cmake_output.txt

adelpit commented 7 years ago

Yup, same exact issue for me too. Any assistance would be greatly appreciated

1>------ Build started: Project: opencv_python2, Configuration: Release x64 ------
1>  cv2.cpp
1>D:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xmemory0(605): error C2129: static function 'PyObject *pyopencv_from<cv::Matx44d>(const T &)' declared but not defined
1>          with
1>          [
1>              T=cv::Matx44d
1>          ]
1>          D:\opencv\opencv_master\modules\python\src2\cv2.cpp(207) : see declaration of 'pyopencv_from'
========== Build: 0 succeeded, 1 failed, 49 up-to-date, 0 skipped ==========

and cmake output:

FP16: Compiler support is available
found IPP (ICV version): 9.0.1 [9.0.1]
at: D:/opencv/opencv_master/build_3.2_dev_noocl/3rdparty/ippicv/ippicv_win
Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
A library with BLAS API not found. Please specify library location.
LAPACK requires BLAS
A library with LAPACK API not found. Please specify library location.
Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
Could NOT find PythonInterp: Found unsuitable version "2.7.12", but required is at least "3.4" (found C:/Program Files/Anaconda2/python.exe)
Could NOT find PythonInterp: Found unsuitable version "2.7.12", but required is at least "3.2" (found C:/Program Files/Anaconda2/python.exe)
Could NOT find JNI (missing:  JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) 
Found VTK ver. 6.2.0 (usefile: F:/ta/repo/fletch/build/install/lib/cmake/vtk-6.2/UseVTK.cmake)
Caffe:   NO
Protobuf:   NO
Glog:   NO
Failed to download tiny-dnn sources
Looking for tiny_dnn.h
Looking for tiny_dnn.h - not found
Module opencv_dnn_modern disabled because tiny-dnn was not found
freetype2:   NO
harfbuzz:    NO
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: F:/ta/repo/fletch/build/install/CMake
Detected broken gflags install in: F:/ta/repo/fletch/build/install/CMake, version: 2.1.2 <= 2.1.2 which defines gflags_LIBRARIES = gflags which is not an imported CMake target, see: https://github.com/gflags/gflags/issues/110.  Attempting to fix by detecting correct gflags target.
Found valid gflags target: gflags-shared, updating gflags_LIBRARIES.
Detected gflags version: 2.1.2
Found required Ceres dependency: Eigen version 3.2.8 in F:/ta/repo/fletch/build/install/include/eigen3
-- Found Ceres installation compiled with miniglog substitute for glog, beware this will likely cause problems if glog is later linked.
Found Ceres version: 1.10.0 installed in: F:/ta/repo/fletch/build/install
Module opencv_sfm disabled because the following dependencies are not found: Glog/Gflags
Tesseract:   NO

General configuration for OpenCV 3.2.0-dev =====================================
  Version control:               3.2.0-105-g156871d

  Extra modules:
    Location (extra):            D:/opencv/opencv_contrib_master/modules
    Version control (extra):     3.2.0-275-g2abf45d-dirty

  Platform:
    Timestamp:                   2017-05-30T18:24:03Z
    Host:                        Windows 10.0.14393 AMD64
    CMake:                       3.8.0-rc2
    CMake generator:             Visual Studio 11 2012 Win64
    CMake build tool:            C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe
    MSVC:                        1700

  C/C++:
    Built as dynamic libs?:      YES
    C++ Compiler:                D:/Program Files (x86)/Microsoft Visual Studio 11.0/VC/bin/x86_amd64/cl.exe  (ver 17.0.61030.0)
    C++ flags (Release):         /DWIN32 /D_WINDOWS /W4 /GR /EHa  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /wd4127 /wd4251 /wd4324 /wd4275 /wd4589 /MP12  /MD /O2 /Ob2 /DNDEBUG  /Zi
    C++ flags (Debug):           /DWIN32 /D_WINDOWS /W4 /GR /EHa  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /wd4127 /wd4251 /wd4324 /wd4275 /wd4589 /MP12  /MDd /Zi /Ob0 /Od /RTC1 
    C Compiler:                  D:/Program Files (x86)/Microsoft Visual Studio 11.0/VC/bin/x86_amd64/cl.exe
    C flags (Release):           /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi    /MP12  /MD /O2 /Ob2 /DNDEBUG  /Zi
    C flags (Debug):             /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi    /MP12  /MDd /Zi /Ob0 /Od /RTC1 
    Linker flags (Release):      /machine:x64  /INCREMENTAL:NO  /debug
    Linker flags (Debug):        /machine:x64  /debug /INCREMENTAL 
    ccache:                      NO
    Precompiled headers:         YES
    Extra dependencies:          comctl32 gdi32 ole32 setupapi ws2_32 vfw32 vtkRenderingOpenGL vtkImagingHybrid vtkIOImage vtkCommonDataModel vtkCommonMath vtkCommonCore vtksys vtkCommonMisc vtkCommonSystem vtkCommonTransforms vtkCommonExecutionModel vtkDICOMParser vtkIOCore vtkzlib vtkmetaio F:/ta/repo/fletch/build/install/lib/jpeg.lib F:/ta/repo/fletch/build/install/lib/libpng.lib F:/ta/repo/fletch/build/install/lib/zlib.lib F:/ta/repo/fletch/build/install/lib/tiff.lib vtkImagingCore vtkRenderingCore vtkCommonColor vtkFiltersExtraction vtkFiltersCore vtkFiltersGeneral vtkCommonComputationalGeometry vtkFiltersStatistics vtkImagingFourier vtkalglib vtkFiltersGeometry vtkFiltersSources vtkInteractionStyle vtkRenderingLOD vtkFiltersModeling vtkIOPLY vtkIOGeometry vtkjsoncpp vtkFiltersTexture vtkRenderingFreeType vtkfreetype vtkftgl vtkIOExport vtkRenderingAnnotation vtkImagingColor vtkRenderingContext2D vtkRenderingGL2PS vtkRenderingContextOpenGL vtkgl2ps vtkRenderingLabel C:/Program Files/Anaconda2/Library/lib/hdf5.lib
    3rdparty dependencies:       zlib libjpeg libwebp libpng libtiff libjasper IlmImf

  OpenCV modules:
    To be built:                 core flann hdf imgproc ml phase_unwrapping photo plot reg surface_matching video viz xphoto bgsegm fuzzy imgcodecs shape videoio highgui objdetect superres ts xobjdetect bioinspired dpm face features2d line_descriptor saliency text calib3d ccalib datasets rgbd stereo structured_light tracking videostab xfeatures2d ximgproc aruco optflow stitching python2
    Disabled:                    world contrib_world
    Disabled by dependency:      -
    Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python3 cnn_3dobj cvv dnn dnn_modern freetype matlab sfm xfeatures2d

  Windows RT support:            NO

  GUI: 
    QT:                          NO
    Win32 UI:                    YES
    OpenGL support:              NO
    VTK support:                 YES (ver 6.2.0)

  Media I/O: 
    ZLib:                        build (ver 1.2.8)
    JPEG:                        build (ver 90)
    WEBP:                        build (ver 0.3.1)
    PNG:                         build (ver 1.6.24)
    TIFF:                        build (ver 42 - 4.0.2)
    JPEG 2000:                   build (ver 1.900.1)
    OpenEXR:                     build (ver 1.7.1)
    GDAL:                        NO
    GDCM:                        NO

  Video I/O:
    Video for Windows:           YES
    DC1394 1.x:                  NO
    DC1394 2.x:                  NO
    FFMPEG:                      YES (prebuilt binaries)
      avcodec:                   YES (ver 57.64.101)
      avformat:                  YES (ver 57.56.100)
      avutil:                    YES (ver 55.34.100)
      swscale:                   YES (ver 4.2.100)
      avresample:                YES (ver 3.1.0)
    GStreamer:                   NO
    OpenNI:                      NO
    OpenNI PrimeSensor Modules:  NO
    OpenNI2:                     NO
    PvAPI:                       NO
    GigEVisionSDK:               NO
    DirectShow:                  YES
    Media Foundation:            NO
    XIMEA:                       NO
    Intel PerC:                  NO

  Parallel framework:            Concurrency

  Other third-party libraries:
    Use IPP:                     9.0.1 [9.0.1]
         at:                     D:/opencv/opencv_master/build_3.2_dev_noocl/3rdparty/ippicv/ippicv_win
    Use IPP Async:               NO
    Use Lapack:                  NO
    Use Eigen:                   YES (ver 3.2.8)
    Use Cuda:                    NO
    Use OpenCL:                  NO
    Use OpenVX:                  NO
    Use custom HAL:              NO

  Python 2:
    Interpreter:                 C:/Program Files/Anaconda2/python.exe (ver 2.7.12)
    Libraries:                   C:/Program Files/Anaconda2/libs/python27.lib (ver 2.7.12)
    numpy:                       C:/Program Files/Anaconda2/lib/site-packages/numpy/core/include (ver 1.11.1)
    packages path:               C:/Program Files/Anaconda2/Lib/site-packages

  Python 3:
    Interpreter:                 NO

  Python (for build):            C:/Program Files/Anaconda2/python.exe

  Java:
    ant:                         NO
    JNI:                         NO
    Java wrappers:               NO
    Java tests:                  NO

  Matlab:                        NO

  Documentation:
    Doxygen:                     NO

  Tests and samples:
    Tests:                       NO
    Performance tests:           NO
    C/C++ Examples:              NO

  Install path:                  D:/opencv/opencv_master/build_3.2_dev_noocl/install

  cvconfig.h is in:              D:/opencv/opencv_master/build_3.2_dev_noocl
-----------------------------------------------------------------

Configuring done
Generating done
adelpit commented 7 years ago

FYI I found the following info which helped resolve the issue for me.

An excerpt from Vadik's solution:

This is because pyopencv_cv_ppf_match_3d_ppf_match_3d_ICP_registerModelToScene does not know what to do with 4x4 matrix when it calls pyopencv_from func. You need to add s stub(!) to modules/python/src2/cv2.cpp something like "code" below, until developer add real function.

//your do_not_forget comment here
template<>
PyObject* pyopencv_from(const Matx44d& m) 
{

    Mat temp, *p = (Mat*)&m;
    if(!p->u || p->allocator != &g_numpyAllocator)
    {
        temp.allocator = &g_numpyAllocator;
    }
    PyObject* o = (PyObject*)p->u->userdata;
    Py_INCREF(o);
    return o;
}