cc1plus.exe crash when using large precompiled hea

2020-08-13 07:16发布

I'm having an issue using precompiled header files with MinGW. The compiler seems to find the precompiled header file but cc1plus.exe crashes immediately after (cc1plus.exe has stopped working).

I've understood that this might be in connection with cc1plus.exe's low stack size, so I did the following to increase it:

editbin cc1plus.exe /STACK 33554432

and I also tried to no avail:

editbin cc1plus.exe /STACK 32768k

This however did not solve it as it still keeps crashing whenever I try to compile my application.

By the way I'm using the latest MinGw (gcc v 4.6.2) and the latest Eclipse CDT if that matters.

Am I increasing the stack size of cc1plus.exe correctly? Does anyone has any clue how to proceed, as I read through countless articles and topics but I'm kind of out of ideas for the moment.

g++ seems to find and accept my precompiled header file:

Building file: ../src/AdvancedOgreFramework.cpp
Invoking: GCC C++ Compiler
g++ -DHAVE_W32API_H -DNO_GCC_PRAGMA -I"C:\DevelopmentTools\workspaces\workspace_cpp
\MyGame\inc" -I"C:\docs\ogre3d\CEGUI\CEGUI-0.7.6\cegui\include\falagard" -I"C:\docs 
\ogre3d\CEGUI\CEGUI-0.7.6\cegui\include\RendererModules\Ogre" -I"C:\docs\ogre3d\CEGUI
\CEGUI-0.7.6\cegui\include" -I"C:\docs\ogre3d\ogre1.8.0_mingw_sdk\OgreSDK_MinGW_v1-8-0
\include" -O0 -g3 -H -Wall -c -Winvalid-pch -MMD -MP -MF"src/AdvancedOgreFramework.d" 
-MT"src/AdvancedOgreFramework.d" -o "src/AdvancedOgreFramework.o" "../src 
/AdvancedOgreFramework.cpp"
! C:\DevelopmentTools\workspaces\workspace_cpp\MyGame\inc/Precompiled.h.gch

And here is the makefile that I run as a pre-build make to generate my .gch:

C_FLAGS = -O0 -g3 -Wall -c -MMD -MP
INC_PATH = -IC:/docs/ogre3d/ogre1.8.0_mingw_sdk/OgreSDK_MinGW_v1-8-0/include -IC:/docs
/ogre3d/CEGUI/CEGUI-0.7.6-mingw/cegui/include -IC:/docs/ogre3d/CEGUI/CEGUI-0.7.6-
mingw/cegui/include/RendererModules/Ogre -IC:/docs/ogre3d/CEGUI/CEGUI-0.7.6-mingw/cegui
/include/falagard


all: Precompiled.h.gch

@echo 'Finished precompiling headers....'

Precompiled.h.gch: Precompiled.h    
    @echo 'Building target: $@'
g++.exe Precompiled.h $(INC_PATH) $(C_FLAGS)     

clean:
rm Precompiled.h.gch

The .gch is over 169 MB in size as I am trying to precompile most of the Ogre3D and CEGUI headers.

Thank you, Adam.

2条回答
Melony?
2楼-- · 2020-08-13 07:51

I had a similar issue and resolved it by updating mingw:

  1. Run shell (cmd or sh)
  2. Update package list:

    mingw-get update

  3. After this run upgrade

    mingw-get upgrade

After this your mingw packages should be upgraded to latest versions and you should be able to get pased the error.

查看更多
叼着烟拽天下
3楼-- · 2020-08-13 08:10

There is a bug report of GCC about your issue, see: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56926, it looks like big pch file(usually larger than 150M) can cause this issue.

Edit: 2015-05-31. I recently found a hard limit value for the pch file in GCC source for mingw or mingw-w64 toolchain, which is 128M. I would like to suggest some one to build a recent GCC to see whether it solve this crash issue. See my post in mingw-w64 forum: [Mingw-w64-public] Set a larger pch file size limit? was : can anyone supply a debug version of cc1plus.exe?

Edit:2015-06-02. I can totally fix this issue by enlarge the hard limit value of the pch file, see my Comment 17 in gcc bugzilla.

查看更多
登录 后发表回答