PCH (Precomiled Headers) with MinGW-w64

Asked by reg on 2014-02-04

Hi guys,

Do you use a precompiled headers in your project ?!

I get a appcrash (cc1plus.exe) in any variants when compiled of file using PCH with your project!
e.g.:

g++ -o build\debug-mingw\win32\stdafx.h.gch -x c++-header -c -pipe -march=i686 -mthreads -mwindows -g -Wall -Wextra -Wno-unused-local-typedefs -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers -Wno-address -Wno-unknown-pragmas -Wno-format -fexceptions -Og -std=gnu++11 -D_WIN32_WINNT=0x502 -DWINVER=0x502 -D_WIN32_IE=0x600 -DNOMINMAX -DSTRICT -DWIN32_LEAN_AND_MEAN -DUNICODE -D_UNICODE -DBOOST_ALL_NO_LIB -DBOOST_USE_WINDOWS_H -DCASESENSITIVITYDEFAULT_YES -DZLIB_WINAPI -DHAS_PCH -D_DEBUG -D_REENTRANT -DNO_VIZ -I. -Imingw\preload -Imingw\include -Iboost -Idwarf -Ibzip2 -Igeoip -Izlib -Iintl -Iopenssl\include -Idwt\include win32\stdafx.h

crash:
g++ -o build\debug-mingw\win32\AboutDlg.o -c -std=gnu++11 -pipe -march=i686 -mthreads -mwindows -g -Wall -Wextra -Wno-unused-local-typedefs -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers -Wno-address -Wno-unknown-pragmas -Wno-format -fexceptions -Og -D_WIN32_WINNT=0x502 -DWINVER=0x502 -D_WIN32_IE=0x600 -DNOMINMAX -DSTRICT -DWIN32_LEAN_AND_MEAN -DUNICODE -D_UNICODE -DBOOST_ALL_NO_LIB -DBOOST_USE_WINDOWS_H -DCASESENSITIVITYDEFAULT_YES -DZLIB_WINAPI -DHAS_PCH -D_DEBUG -D_REENTRANT -DNO_VIZ -I. -Imingw\preload -Imingw\include -Iboost -Idwarf -Ibzip2 -Igeoip -Izlib -Iintl -Iopenssl\include -Idwt\include win32\AboutDlg.cpp -include build\debug-mingw\win32/stdafx.h

I also tried on other gcc releases - x32 & x64: MinGW, MinGW-w64, MinGW TDM and from your dev-folder on sf

Also i have a ported DC++ on the Netbeans IDE for my additional fork..
but the development is very difficult because is very long build without PCH!

This is a problem only for me о_О

Question information

Language:
English Edit question
Status:
Answered
For:
DC++ Edit question
Assignee:
No assignee Edit question
Last query:
2014-02-13
Last reply:
2014-02-27
reg (entry-reg) said : #1

is anyone here -_-

please, yes or not ? for my question

or I should create a new ticket as a bug-report ?

eMTee (realprogger) said : #2

There's no bug here, compiling works fine for everyone with the officially recommended compiler on all supported OSes, if it's correctly set up using the guidelines from compile.txt included with the project.
Using other tools you're on your own, but you can log on to the official DC dev hub where you probably get some answers for your problem.
adcs://hub.dcbase.org:16591

reg (entry-reg) said : #3

Thanks for reply!
However, my problem isn't in the build! and how to build...

The appcrash only occurs with using a precompiled headers in your project! also by default using SCons
cc1plus.exe will crash if you just turn on the following option in your SConstruct:

  BoolVariable('pch', 'Use precompiled headers', 'yes')
  http://bazaar.launchpad.net/~twpol/dcplusplus/trunk/view/head:/SConstruct#L76

no problems if not use pch

i also found a similar problem:
http://stackoverflow.com/questions/10841306/cc1plus-exe-crash-when-using-large-precompiled-header-file

~ crash when using large PCH (your stdafx.h.gch is over 220Mib)

How fix it on your project if that problem only for me ? with a standard build using SCons! (can forget about Netbeans, this is for our project and it works fine :))

reg (entry-reg) said : #4

yes, problem with size of created pch from DC++ project

tested on your original project (I removed a some headers from stdafx.h):
PCH = 136 554 756 b - and less - is ok!
PCH = 137 526 404 b - and over - crash

I'm sad :(
needed pch..

poy (poy) said : #5

the crash is known; that is why precompiled headers are disabled by default. it used to work a few years ago but hasn't for a while; especially since we switched to mingw-w64.

to ease development, you have a few other options:
- use the -j setting to launch multiple build tasks in parallel.
- use Visual Studio; precompiled headers work fine there.

reg (entry-reg) said : #6

"especially since we switched to mingw-w64"
..so., i'm talking about of your default tools :) Or would you like to say ~"from mingw-w64" ?

also looked:
  http://sourceforge.net/projects/dcplusplus/files/Dev/MinGW/
  "The "Dev" directory contains tools to help developers compile DC++"

Here is another interesting!
Later I checked on a different platform. All works fine! no crash using pch (269 438 116 b)
I did not writing here, because here is not too friendly to the discussions about "my" problem :)

So, I created tciket http://sourceforge.net/p/mingw-w64/bugs/382/
because the identical tool on various platforms, gives different results..

Visual Studio:
yep, I know :)

reg (entry-reg) said : #7

So., I think problem resolved, because it all works by individual solution
..and seems this is a problem with mingw

if you have this problem too, please also report here: http://sourceforge.net/p/mingw-w64/bugs/382/

Can you help with this problem?

Provide an answer of your own, or ask reg for more information if necessary.

To post a message you must log in.