Building Google Breakpad on Mac OS X

前端 未结 2 1682
挽巷
挽巷 2021-02-09 02:16

I am attempting to build Google Breakpad for Mac OS X as a part of porting an application, based on the trunk revision 782.

The Breakpad wiki specifies that one should b

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-09 02:53

    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.

提交回复
热议问题