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

xwbd5t1u  于 2023-04-30  发布在  其他
关注(0)|答案(2)|浏览(180)

我需要构建一个较旧的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

在我使用CMake(用于MinGW Makefile)配置和生成之后,我试图在build文件夹中使用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

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

xpcnnkqh

xpcnnkqh1#

这是你的编译器告诉你你设法击中了一个内部编译器错误。“内部编译器错误”正是它所说的意思。恭喜你,我想。..没有解决方法,除了手动编辑代码,猜测是什么触发了bug,编辑C++源代码以产生不同的东西,但逻辑上是等价的,它不会触发内部编译器bug,不管它是什么。
所示的gcc版本8非常旧。试着看看你是否可以将你的工具链更新到gcc的最新版本。gcc的当前版本是13。

0aydgbwb

0aydgbwb2#

OpenCV 2已经很老了。你不能移动到一个更新的版本(至少3)?如果可以的话,我可以用完全相同的配置编译OpenCV 3,但它并不简单。这是我的过程(从cmake-gui,从内存)。我希望它会有所帮助:
1.从git获取opencv和opencv_contrib
1.添加新条目到CMake:将条目OPENCV_ALLOCATOR_STATS_COUNTER_TYPE命名为Value(String);int64_t
1.将WITH_FFMPEG设置为关闭
1.将BUILD_TBB设置为on
1.将OPENCV_ENABLE_NONFREE设置为on(不确定此选项)
1.设置安装目录(通过CMAKE_INSTALL_PREFIX)
1.如果设置OPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules,则将Build_opencv_hdf设置为off,并将Build_opencv_python3设置为off
1.配置
1.生成
1.光盘

  1. make install(或mingw32-make install)

相关问题