compiling and using breakpad on Windows w/ Qt and MinGW

780 views
Skip to first unread message

Will Stokes

unread,
Jul 14, 2010, 9:27:26 AM7/14/10
to google-breakpad-discuss
I previously wrote the below message to Petr Štetiar directly whose
asked me to post it here so he can respond for all to see:

"Hi there, I came across your post:

http://groups.google.com/group/google-breakpad-dev/browse_thread/thread/2b49355135f488cf/c055c0e420d0df74#c055c0e420d0df74

I'm developing a Qt app that runs on Windows and Mac and would like to
get breakpad working on both. Thus far I've gotten breakpad compiled
and linked in on Mac but havn't actually started using it in my code.
On Windows I still havn't pulled off compiling it using MinGW. Then I
saw your post. I was trying to compile r609 (that's the version I got
to compile on Mac). Do you suggest I checkout r607 like you did back
in June and compile that using your patch? Are you also writing a Qt
frontend for hooking into breakpad? I'm curious how you suggest
setting up breakpad usage with main.cpp. Thanks."

Update: I've since then gotten breakpad working on the Mac. Below are
the changes I needed to add to my project and the necessary code. I
havn't gotten a socorro server setup yet but have created a pretty
crash report using a dump and symbols files so I know I'm close. On
Windows I still havn't made any progress as I remain unable to compile
breakpad using MinGW, even with extensive patching inspired by Petr
Štetiar's patch.

-compiled breakpad r609 on Mac using GCC4.0, the 10.4 SDK, using
XCode3.2.1 install (XCode 3.2.2+ won't work)
-in order to accomplish the above I had to update the xcode projects
like so:

cd google-breakpad/
open src/tools/mac/dump_syms/dump_syms.xcodeproj
Select "dump_syms" from top left
Cmd I -> Switch to Build tab
Architecutres -> 32 bit universal
Compiler Version -> C/C++ Compiler Version -> GCC 4.0
Search Paths -> Header Search Paths -> add recursive "../../../"
Project -> Set Active Build Configuration -> Release
Cmd+B
Cmd+Q

open src/tools/mac/crash_report/crash_report.xcodeproj
repeat above steps

open src/tools/mac/symupload/symupload.xcodeproj
repeat above steps

open src/client/mac/Breakpad.xcodeproj
Select "Breakpad" from browser at very top left
Cmd I -> Switch to Build tab
Architecutres -> 32 bit universal
Compiler Version -> C/C++ Compiler Version -> GCC 4.0
Project -> Set Active Target -> All
Project -> Set Active SDK -> 10.4
Project -> set Active Build Configuration -> Release
Cmd+B
Cmd+Q

-to start compiling in/linking against breakpad I added the following
lines to my qmake project:

FrameworkDir = /path/to/the/breakpad/framework

INCLUDEPATH += $${FrameworkDir}/Breakpad.framework/Headers
QMAKE_LFLAGS += -F$${FrameworkDir}
LIBS += -framework Breakpad \
-framework Carbon \
-framework Foundation

Frameworks.files = $${FrameworkDir}/Breakpad.framework
Frameworks.path = Contents/Frameworks
QMAKE_BUNDLE_DATA += Frameworks.files

-I also updated my custom plist by adding the following variables.

<key>BreakpadReportInterval</key><string>0</string>
<key>BreakpadVendor</key><string>my company</string>
<key>BreakpadRequestComments</key><string>YES</string>
<key>BreakpadRequestEmail</key><string>YES</string>
<key>BreakpadConfirmTimeout</key><string>NO</string>
<key>BreakpadURL</key><string>https://myserver.com/rc/report</string>

-in order to start listening for crashes I added a .mm and .h file to
my project like so:

mac {
OBJECTIVE_SOURCES+= crashHandler.mm
HEADERS+= crashHandler.h
}

crashHandler.mm is basically...

#import <Foundation/Foundation.h>
#import "breakpad.h"

BreakpadRef breakpad = NULL;

void SetupCrashReporter()
{
if(breakpad != NULL)
return;

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSDictionary *plist = [[NSBundle mainBundle] infoDictionary];
if(plist != NULL)
breakpad = BreakpadCreate(plist);

[pool release];
}


void ShutDownCrashReporter()
{
if(breakpad == NULL)
return;

BreakpadRelease(breakpad);
breakpad = NULL;
}

I then call SetupCrashReporter in main.cpp just after creating my
QApplication object, and call ShutDownCrashReporter just before
returning my main method.

Hopefully this will be of use to someone. Now, here's hoping someone
can help me get things playing nicely with MinGW. :-)
Reply all
Reply to author
Forward
0 new messages