Building Google Breakpad on Mac OS X

。_饼干妹妹 提交于 2019-12-03 06:45:56

There is no solution in the Breakpad source for this, unfortunately. The XCode projects simply build the Breakpad framework, as that's the more-supported client API. You can build the code with your own set of Makefiles or whatever build setup you desire the same way Firefox does by looking at the set of Mozilla makefiles:

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 gathering the set of files referenced in CSRCS/CPPSRCS/CMSRCS/CMMSRCS, and building all of those.

You might also file a bug in the Breakpad issue tracker to ask that the XCode project build this static library as well. It would not be a difficult patch.

This might not be helpful in your case, but I've found this to work for a project I'm working on that needs to work on both Linux and OSX. On Linux we use the "normal" autotools way of doing things; on OSX we invoke xcodebuild to create Breakpad.framework and then link against that.

Here's the relevant portion 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 with clang -stdlib=libc++ (which is pretty normal if you make heavy use of C++11), you should append the phrase GCC_VERSION=com.apple.compilers.llvm.clang.1_0 OTHER_CFLAGS=-stdlib=libc++ OTHER_LDFLAGS=-stdlib=libc++ to the end of the xcodebuild line. This will force xcodebuild to do the right thing.

If your application is built with GCC and GNU libstdc++, you don't need to add anything to the xcodebuild line.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!