Create Google Breakpad on Mac OS X

I am trying to create a Google Breakpad for Mac OS X as part of a porting application based on version 782 of a trunk.

The Breakpad wiki indicates that you need to create a client /mac/Breakpad.xcodeproj that creates Breakpad.framework, including a dynamically linked lib, if I understand correctly. There is also sample code on how to use this from an Objective-C application, but it all seems very different from what seems to be the usual way to do things on other platforms, including using plists and other things that are not part of my application. I would rather do something similar on all platforms.

For example, this one looks like Firefox uses Breakpad:

// include exception_handler.h from client/<platform>/handler, // using ... here for brevity #include "... exception_handler.h" ... gExceptionHandler = new google_breakpad:: ExceptionHandler(tempPath.get(), nsnull, MinidumpCallback, nsnull, #if defined(XP_WIN32) google_breakpad::ExceptionHandler::HANDLER_ALL); #else true); #endif 

In my project, we do the same and just bind to exception_handler.lib on Windows. libbreakpad_client.a Linux, Breakpad seems to generate the corresponding libbreakpad_client.a , which can be linked in the same way, but not with Mac OS X. If I do

 ./configure make 

libbreakpad.a is created from the firewall root directory, which does not contain an exception handler, and libbreakpad_client.a, which should not be built. I could have completely misunderstood something both in the usual way to use Breakpad and in the usual procedure for creating external libraries on Mac, so any help is appreciated.

How to create libbreakpad_client.a on mac os x?

+6
c ++ macos google-breakpad
source share
2 answers

Unfortunately, the Breakpad source has no solution for this. Xcode projects simply create a Breakpad structure, as it is a more supported client API. You can create the code using your own set of Make files or any other installation you want, just like Firefox does by browsing the Mozilla fileset:

http://mxr.mozilla.org/mozilla-central/source/toolkit/crashreporter/google-breakpad/src/common/Makefile.in

http://mxr.mozilla.org/mozilla-central/source/toolkit/crashreporter/google-breakpad/src/common/mac/Makefile.in

http://mxr.mozilla.org/mozilla-central/source/toolkit/crashreporter/google-breakpad/src/client/Makefile.in

http://mxr.mozilla.org/mozilla-central/source/toolkit/crashreporter/google-breakpad/src/client/mac/handler/Makefile.in

http://mxr.mozilla.org/mozilla-central/source/toolkit/crashreporter/google-breakpad/src/client/mac/crash_generation/Makefile.in

and collect the set of files referenced in CSRCS / CPPSRCS / CMSRCS / CMMSRCS, and create all of them.

You can also specify an error in the Error Tracker on the firewall to ask that the Xcode project also create this static library. This will not be a difficult patch.

+3
source share

This may not be useful in your case, but I found that it works for the project I'm working on, for working with Linux and OSX. On Linux, we use the usual autotools way of doing things; on OSX, we call xcodebuild to create Breakpad.framework , and then reference it.

Here is the relevant part of the CMakeLists.txt file ( for CMake see here ):

 IF(LINUX) add_custom_target( GOOGLE_BREAKPAD_MAKEFILE COMMAND cd ../google-breakpad/ && ([ -e Makefile ] || (autoreconf && bash configure)) ) add_custom_target( GOOGLE_BREAKPAD COMMAND cd ../google-breakpad/ && $(MAKE) ) add_dependencies(GOOGLE_BREAKPAD GOOGLE_BREAKPAD_MAKEFILE) ENDIF() IF(APPLE) add_custom_target( GOOGLE_BREAKPAD COMMAND cd ../google-breakpad/src/client/mac/ && xcodebuild -sdk macosx ) ENDIF() 

If your application is built using clang -stdlib=libc++ (which is pretty good if you use C ++ 11 heavily), you should add the phrase GCC_VERSION=com.apple.compilers.llvm.clang.1_0 OTHER_CFLAGS=-stdlib=libc++ OTHER_LDFLAGS=-stdlib=libc++ at the end of the xcodebuild line. This will make xcodebuild do the right thing.

If your application is built using GCC and GNU libstdc ++, you do not need to add anything to the xcodebuild line.

+4
source share

All Articles