当前位置: 首页 > article >正文

windows 编译 breadpad

原文链接:https://gist.githubusercontent.com/vnl/f317840bfa9c638a60f2c4110872056a/raw/07185c8e86fc2faf08e3410ed3950a5c4d2e8b32/Breakpad%2520on%2520Windows
##### Building Google breakpad

Building Google breakpad on Windows is a very painful experience because the process is not really well documented and, furthermore, building the project on Windows is maintained surprisingly poorly by Google. But don't lose hope, it is still possible to build this thing and here are the instructions:
```
git clone https://chromium.googlesource.com/breakpad/breakpad
cd breakpad
git checkout chrome_64
cd src
git clone https://github.com/google/googletest.git testing
cd ..\..
git clone https://chromium.googlesource.com/external/gyp
cd gyp
python setup.py install
cd ..\breakpad
md installdir
md installdir\include\breakpad\client\windows
md installdir\include\breakpad\common\windows
md installdir\lib
md installdir\bin
xcopy src installdir\include\breakpad /e
```
The last line from the above copies almost entire sources of breakpad into the installation prefix's include folder. That might be overkill but hand picking the headers which really need to be present there is too much trouble so this simple hack works.

At this point you need to patch the gyp project file to make breakpad buildable on Windows. You can either do it by hand using any text editor or using `sed` from `msys64`: within "breakpad/src/build" folder there's a file called `common.gypi`. Inside this file you need to replace all occurrences of `'WarnAsError': 'true'` with `'WarnAsError': 'false'`. This setting controls whether the compiler would treat warnings as build errors or not. Some warnings do exist when building on Windows so in the default configuration the build can't succeed. Here's how this setting can be changed with the help of sed editor:
```
C:\msys64\usr\bin\bash -lc "cd /c/dev/breakpad/src/build && sed -i -e \"s/'WarnAsError': 'true'/'WarnAsError': 'false'/g\" common.gypi"
```
Replace the path to breakpad dir with your actual one in the above command.
Now can proceed building the breakpad. Will start from the client libraries and will do two builds, in release and debug configurations:
```
..\gyp\gyp.bat src\client\windows\breakpad_client.gyp --no-circular-check -Dwin_release_RuntimeLibrary=2 -Dwin_debug_RuntimeLibrary=3
cd src\client\windows
msbuild breakpad_client.sln /p:Configuration="Release" /p:Platform="Win32"
msbuild breakpad_client.sln /p:Configuration="Debug" /p:Platform="Win32"
```
For 64 bit build set the "Platform" parameter to "x64". The built release binaries can be found within Release/lib folder and debug ones within Debug/lib one. Copy them to the installation dir while adding the `\_d` suffix for debug libraries:
```
copy Release\lib\common.lib ..\..\..\installdir\lib
copy Release\lib\crash_generation_client.lib ..\..\..\installdir\lib
copy Release\lib\crash_generation_server.lib ..\..\..\installdir\lib
copy Release\lib\exception_handler.lib ..\..\..\installdir\lib
copy Debug\lib\common.lib ..\..\..\installdir\lib\common_d.lib
copy Debug\lib\crash_generation_client.lib ..\..\..\installdir\lib\crash_generation_client_d.lib
copy Debug\lib\crash_generation_server.lib ..\..\..\installdir\lib\crash_generation_server_d.lib
copy Debug\lib\exception_handler.lib ..\..\..\installdir\lib\exception_handler_d.lib
```
Now need to build `dump_syms` utility which would then be used during the build of Quentier for the extraction of symbols from Quentier executable and libquentier library - these symbols would then be used to produce stack traces during crash handling. The end users would then be able to provide the stack traces while reporting crashes - these can be used as minimal hints to the reason of the crash. Without crash handling every single crash is like a shot in the dark - you can't say who did it or why. 
```
cd ..\..\..
..\gyp\gyp.bat src\tools\windows\tools_windows.gyp --no-circular-check -Dwin_release_RuntimeLibrary=2 -Dwin_debug_RuntimeLibrary=3
cd src\tools\windows
msbuild tools_windows.sln /p:Configuration="Release" /p:Platform="Win32"
```
After it's built copy it to the installation prefix's bin directory:
```
copy Release\dump_syms.exe ..\..\..\installdir\bin
```
The final touch: need one other executable, `minidump_stackwalk`. It is the executable which parses the minidump produced by the crashing app using the symbols created by `dump_syms`. It seems Google has never planned for this executable to be used - or even built - on Windows because currently the only way to build this tool on Windows is using Cygwin (thus depending on its dlls). Thankfully, guys from Mozilla have already done that so this tool can just be downloaded from Mozilla servers:
```
curl -fsSL http://hg.mozilla.org/build/tools/raw-file/755e58ebc9d4/breakpad/win32/minidump_stackwalk.exe -o minidump_stackwalk.exe
curl -fsSL http://hg.mozilla.org/build/tools/raw-file/755e58ebc9d4/breakpad/win32/cygwin1.dll -o cygwin1.dll
curl -fsSL http://hg.mozilla.org/build/tools/raw-file/755e58ebc9d4/breakpad/win32/cygstdc++-6.dll -o cygstdc++-6.dll
curl -fsSL http://hg.mozilla.org/build/tools/raw-file/755e58ebc9d4/breakpad/win32/cyggcc_s-1.dll -o cyggcc_s-1.dll
```
If you feel inclined, in [this thread](https://groups.google.com/forum/#!topic/google-breakpad-discuss/B4xza0jGdlY) some guy describes what to change in breakpad sources to make `minidump_stackwalk` utility buildable on Windows with Visual C++. You can follow this description to try and build `minidump_stackwalk` on Windows with Visual C++. 

That was the last dependency so the guide for building Quentier and/or libquentier dependencies on Windows using Visual Studio is finished now!

http://www.kler.cn/a/370125.html

相关文章:

  • 将UI界面交给第三方库
  • 【Oracle数据库】创建表的同义词示例
  • 【数据分享】1929-2024年全球站点的逐年最低气温数据(Shp\Excel\免费获取)
  • Linux系统的第一个进程是什么?
  • Apache Tomcat文件包含漏洞复现(详细教程)
  • Java 的初认识(一)
  • 深度学习-学习率调整策略
  • 15分钟学 Go 第 22 天:包的使用
  • gymnasium代码运行
  • vue3使用vuedraggable 实现页面div拖拽和缓存
  • 算法4之链表
  • 纯血鸿蒙:国产操作系统的崛起与安卓的本质区别
  • IMX6ULL裸机-ARM内部寄存器
  • 【vue】树的初始化展开
  • 前端部署遇到的坑,记录步骤;阿里云服务器端口无法访问
  • 如何处理视频里的背景噪音?去除噪音步骤
  • [论文精读]Pisces: Efficient Federated Learning via GuidedAsynchronous Training
  • IDEA->EasyCode(mapper.xml) 字段无逗号分隔和修改全局变量问题
  • Linux驱动开发 中断上下文机制详解 中断上下文API使用详解
  • ubuntu-开机黑屏问题快速解决方法
  • taro微信小程序assets静态图片不被编译成base64
  • 2024年10款好用的图纸加密软件推荐|企业CAD图纸加密指南!
  • 《近似线性可分支持向量机的原理推导》 拉格朗日函数 公式解析
  • linux命令之mv
  • 力扣每日一题 685. 冗余连接 II
  • 新能源汽车爆炸频发?FLIR TG275助你提前检测,规避风险!