在 Mac OS X 上构建 Google Breakpad
我正在尝试为 Mac OS X 构建 Google Breakpad 作为基于主干的应用程序移植的一部分修订版 782。
Breakpad wiki 指定应构建 client/mac/Breakpad.xcodeproj,其中如果我理解正确的话,会生成一个包含动态链接库的 Breakpad.framework 。还有关于如何在 Objective-C 应用程序中使用它的示例代码,但是所有这些似乎与在其他平台上执行操作的正常方式非常不同,包括使用 plist 和其他不属于其中的内容我的申请。我宁愿跨平台做尽可能相似的事情。
例如,这似乎是 Firefox 使用 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
在我的项目中,我们正在做同样的事情,只是链接到 Windows 上的 exception_handler.lib
。似乎在 Linux 上,Breakpad 生成了一个相应的 libbreakpad_client.a
,可以以相同的方式链接,但在 Mac OS X 上则不然。如果我
./configure
make
从 Breakpad 根目录生成一个 libbreakpad生成的 .a
不包含异常处理程序,并且不应该构建的 libbreakpad_client.a 。我很可能误解了 Breakpad 的正常使用方式以及在 Mac 上构建外部库的正常过程,因此非常感谢您的帮助。
如何在 Mac OS X 上构建 libbreakpad_client.a
?
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 build client/mac/Breakpad.xcodeproj, which produces a 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 all this seem very different from what seems to be the normal way of doing things on other platforms, including the use of plists and other things that are not part of my application. I would much rather do things as similar as possible across platforms.
For instance, this appears to be the way that 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 are doing the same thing and just link against exception_handler.lib
on Windows. It seems that on Linux, Breakpad generates a corresponding libbreakpad_client.a
that can be linked against in the same way, but not on Mac OS X. If I do
./configure
make
from the breakpad root directory a libbreakpad.a
is generated that does not contain the exception handler, and the libbreakpad_client.a that should is not being built. I may very well have misunderstood just about anything on both the normal way of using Breakpad as well as the normal procedure for building external libraries on the Mac, so any help is appreciated.
How do I build libbreakpad_client.a
on Mac OS X?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这可能对您的情况没有帮助,但我发现这适用于我正在开发的需要在 Linux 和 OSX 上运行的项目。在 Linux 上,我们使用“正常”自动工具的方式来做事;在 OSX 上,我们调用 xcodebuild 来创建
Breakpad.framework
,然后链接到它。以下是 CMakeLists.txt 文件的相关部分(对于 CMake,请参见此处):
如果您的应用程序是使用
clang -stdlib=libc++
(如果您大量使用 C++11,这很正常),您应该附加短语GCC_VERSION=com.apple.compilers.llvm.clang.1_0 OTHER_CFLAGS= -stdlib=libc++ OTHER_LDFLAGS=-stdlib=libc++
到xcodebuild
行的末尾。这将迫使 xcodebuild 做正确的事情。如果您的应用程序是使用 GCC 和 GNU libstdc++ 构建的,则无需向
xcodebuild
行添加任何内容。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 your application is built with
clang -stdlib=libc++
(which is pretty normal if you make heavy use of C++11), you should append the phraseGCC_VERSION=com.apple.compilers.llvm.clang.1_0 OTHER_CFLAGS=-stdlib=libc++ OTHER_LDFLAGS=-stdlib=libc++
to the end of thexcodebuild
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.不幸的是,Breakpad 源代码中没有解决这个问题的方法。 XCode 项目只是构建 Breakpad 框架,因为这是支持更多的客户端 API。您可以使用自己的 Makefile 集或任何您想要的构建设置来构建代码,就像 Firefox 那样,通过查看 Mozilla makefile 集来构建代码:
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。在
http://mxr.mozilla.org/mozilla-central/source/toolkit/crashreporter/google-breakpad/src/client/mac/crash_ Generation/Makefile.in
并收集 CSRCS 中引用的文件集/CPPSRCS/CMSRCS/CMMSRCS,并构建所有这些。
您还可以在 Breakpad 问题跟踪器中提交错误,要求XCode 项目也构建了这个静态库。这不会是一个困难的补丁。
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.
您只能为 macOS Intel64 和 macOS 构建
动态框架
Apple SiliconCheckout https://github.com/Sunbreak/cli-breakpad.trial
获取代码
设置和构建
安装库 &&工具
You could only build
dynamic framework
for macOS Intel64 & Apple SiliconCheckout https://github.com/Sunbreak/cli-breakpad.trial
Fetch code
Setting up and build
Install library && tools