构建 opencv 时出错:内部编译器错误:在 gt_pch_note_object 中

Val*_*ria 1 c++ opencv cmake

我需要构建一个较旧的 OpenCV 版本,并且我已经坚持使用它好几天了。任何帮助表示赞赏。

我从 CMake 获得的配置:

General configuration for OpenCV 2.4.11 =====================================
  Version control:               unknown

  Platform:
    Host:                        Windows 10.0.19044 AMD64
    CMake:                       3.24.3
    CMake generator:             MinGW Makefiles
    CMake build tool:            C:/Tools/mingw64/bin/mingw32-make.exe
    Configuration:               Release

  C/C++:
    Built as dynamic libs?:      YES
    C++ Compiler:                C:/Tools/mingw64/bin/c++.exe  (ver 8.1.0)
    C++ flags (Release):         -fsigned-char -mstackrealign -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -fomit-frame-pointer -msse -msse2 -ffunction-sections -O2 -DNDEBUG  -DNDEBUG
    C++ flags (Debug):           -fsigned-char -mstackrealign -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -fomit-frame-pointer -msse -msse2 -ffunction-sections -g  -O0 -DDEBUG -D_DEBUG
    C Compiler:                  C:/Tool/mingw64/bin/gcc.exe
    C flags (Release):           -fsigned-char -mstackrealign -W -Wall -Werror=return-type -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 -fomit-frame-pointer -msse -msse2 -ffunction-sections -O2 -DNDEBUG  -DNDEBUG
    C flags (Debug):             -fsigned-char -mstackrealign -W -Wall -Werror=return-type -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 -fomit-frame-pointer -msse -msse2 -ffunction-sections -g  -O0 -DDEBUG -D_DEBUG
    Linker flags (Release):      
    Linker flags (Debug):        
    Precompiled headers:         YES

  OpenCV modules:
    To be built:                 core flann imgproc highgui features2d calib3d ml video legacy objdetect photo gpu ocl nonfree contrib stitching superres ts videostab
    Disabled:                    world
    Disabled by dependency:      -
    Unavailable:                 androidcamera dynamicuda java python viz

  Windows RT support:            NO

  GUI: 
    QT:                          NO
    Win32 UI:                    YES
    OpenGL support:              NO
    VTK support:                 NO

  Media I/O: 
    ZLib:                        build (ver 1.2.7)
    JPEG:                        build (ver 62)
    PNG:                         build (ver 1.5.12)
    TIFF:                        build (ver 42 - 4.0.2)
    JPEG 2000:                   build (ver 1.900.1)
    OpenEXR:                     build (ver 1.7.1)

  Video I/O:
    Video for Windows:           YES
    DC1394 1.x:                  NO
    DC1394 2.x:                  NO
    FFMPEG:                      YES (prebuilt binaries)
      codec:                     YES (ver 55.18.102)
      format:                    YES (ver 55.12.100)
      util:                      YES (ver 52.38.100)
      swscale:                   YES (ver 2.3.100)
      gentoo-style:              YES
    OpenNI:                      NO
    OpenNI PrimeSensor Modules:  NO
    PvAPI:                       NO
    GigEVisionSDK:               NO
    DirectShow:                  YES
    Media Foundation:            NO
    XIMEA:                       NO
    Intel PerC:                  NO

  Other third-party libraries:
    Use IPP:                     NO
    Use Eigen:                   NO
    Use TBB:                     NO
    Use OpenMP:                  NO
    Use GCD                      NO
    Use Concurrency              NO
    Use C=:                      NO
    Use Cuda:                    NO
    Use OpenCL:                  YES

  OpenCL:
    Version:                     dynamic
    Include path:                C:/opencv-2.4.11/3rdparty/include/opencl/1.2
    Use AMD FFT:                 NO
    Use AMD BLAS:                NO

  Python:
    Interpreter:                 C:/Tools/Python27/python.exe (ver 2.7.15)

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

  Documentation:
    Build Documentation:         NO
    Sphinx:                      NO
    PdfLaTeX compiler:           NO
    Doxygen:                     NO

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

  Install path:                  C:/opencv/install

  cvconfig.h is in:              C:/opencv
Run Code Online (Sandbox Code Playgroud)

在我使用 CMake(对于 MinGW Makefile)配置和生成之后,我尝试mingw32-make --debug在构建文件夹中进行构建。我使用的是 Windows 10 & GNU Make 4.2.1 & CMake 3.24.3 & OpenCV 2.4.11 是从https://opencv.org/releases/page/7/下载的。

我收到的错误:

[ 19%] Generating precomp.hpp.gch/opencv_core_Release.gch
D:/opencv_mingw32/modules/core/precomp.hpp:202:1: internal compiler error: in gt_pch_note_object, at ggc-common.c:276
 }
 ^
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://sourceforge.net/projects/mingw-w64> for instructions.
mingw32-make[2]: *** [modules\core\CMakeFiles\pch_Generate_opencv_core.dir\build.make:75: modules/core/precomp.hpp.gch/opencv_core_Release.gch] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:1693: modules/core/CMakeFiles/pch_Generate_opencv_core.dir/all] Error 2
mingw32-make: *** [Makefile:165: all] Error 2
Run Code Online (Sandbox Code Playgroud)

老实说,这个错误并没有告诉我任何信息,我也无法在网上找到信息。构建旧版 OpenCV 的指南也很难找到。因此,正如我在开头所写的,任何帮助都非常有价值。我必须继续使用这个版本的 OpenCV。

Sam*_*hik 5

这是您的编译器告诉您您设法遇到了内部编译器错误。“内部编译器错误”的意思正是它所说的。恭喜,我想...没有解决方法,除了手动编辑代码,猜测是什么触发了错误,并编辑 C++ 源代码以产生不同的东西,但逻辑上是等效的,并且它不会触发内部编译器错误,无论如何这是。

显示的 gcc 版本(版本 8)非常旧。尝试看看是否可以将工具链更新到更新版本的 gcc。gcc 当前版本是 13。