Qt, Google BreakPad and MacOs

2019-05-31 23:40发布

问题:

Is here anyone who successfully build Google Breakpad on MacOS using standard Qt tool chain without xcode?

I'm trying to get work this library for two days now and still without success. I already successfully compiled it and ran it on Windows and Linux. (from original Google-git repository).

But MacOS version of library has missing makefile for libbreakpad_client.a and generated libbreakpad.a does not contain the exception handler.

http://screencast.com/t/V0mNiM3kZ

I found few topic about this issue on here on a stackoverflow but advice with updated makefiles didn't work for me (or I didn't copy makefiles correctly).

I also tried to download updated version directly from Mozilla repository (version 10 and 11beta). But when I tried to compile Mozilla version, there was another errors with undefined symbols (on Mac and also on Linux).

I also found AlekSi - breakpad-qt but this version also works correctly only under Win and Linux. Under Mac there is some errors about "Unknown architecture -- are you on a PDP-11?"

I will be gratitude to anyone who can point me how to compile it and get it work under Mac or who can send me a packed version of breakpad which can be compiled under MacOS using standard make and used in Qt application.

Thank you Ludek

回答1:

AlekSi's breakpad-qt is three years old, and the breakpad source in it doesn't support 64 bits on OSX.

Failing to detect your processor type is what makes it complain about "Unknown architecture -- are you on a PDP-11?".

You definitely need a more recent breakpad version, either from their svn, or from my breakpad-qt fork at: https://github.com/webitup/qt-breakpad

Now, if you intend on supporting 10.6 (MACOSX_DEPLOYMENT_TARGET=10.6) as well, you need to patch breakpad source using this https://github.com/webitup/qt-breakpad/commit/71a9fdedd827e5939ba66bfcc0cd6c1c9fbbc87b (-> I don't think 10.6 has PPC support)

Then:

You apparently managed to compile directly from source, so, good for that way.

Now, if you want to build a framework from breakpad instead, and link to that from your qt app/lib, then Dave Mateer suggestion is the way to go (and he deserves the credit). The following worked for me:

cd $BREAKPAD_SOURCE_TREE
xcodebuild -sdk macosx10.7 -project src/client/mac/Breakpad.xcodeproj -configuration Release -target Breakpad ARCHS=x86_64 ONLY_ACTIVE_ARCH=YES MACOSX_DEPLOYMENT_TARGET=10.6 GCC_VERSION=com.apple.compilers.llvmgcc42 

Note that I'm only building target Breakpad instead of All (it seems you only need that - and a test is failing for me using All, though it does produce a usable framework either way).

And note that you don't require XCode per-se - just the command line builds tools.

In order to use that framework in your QT project:

mac {
        QMAKE_LFLAGS += -F$$BREAKPAD_PATH/client/mac/build/Release/
        LIBS += -framework Breakpad
}

And you should be set.

Finally: I also pushed a number of changes in my breakpad-qt fork source itself to have it at least compile (on OSX!) against the updated breakpad version, but I have no idea yet if it does work properly.

I'm just starting with that fork - if you want to share experience and/or commit some stuff in there, just ask.