Last active
August 9, 2023 07:56
-
-
Save vnl/f317840bfa9c638a60f2c4110872056a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##### 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! |
i cant get the gyp git , can u help ?
I apologise; this is extremely old, and I am sure many better crash-reporting tools are out there. However, for Breakpad, you may get better help at: https://chromium.googlesource.com/breakpad/breakpad/ and https://chromium.googlesource.com/breakpad/breakpad/+/HEAD/docs/windows_client_integration.md
thanks. but something cofusing is that there is no build file such as sln, and i cant get the lib
The functionality of GYP is very similar to the CMake build tool. Meaning, it is used to generate a sln file for visual studio and so on.
https://gyp.gsrc.io/docs/Testing.md#Specifying-the-format-build-tool_to-use
The above link may help. It is a python project, which helps in generating a project file.
Kind Regards
Vivian Lobo
…On 9 Aug 2023 at 02:38 +0100, Vanessawws ***@***.***>, wrote:
@Vanessawws commented on this gist.
thanks. but something cofusing is that there is no build file such as sln, and i cant get the lib
—
Reply to this email directly, view it on GitHub or unsubscribe.
You are receiving this email because you authored the thread.
Triage notifications on the go with GitHub Mobile for iOS or Android.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Running "msbuild tools_windows.sln /p:Configuration="Release" /p:Platform="Win32"" command throws below error:
MSBUILD : error MSB4025: The project file could not be loaded. Root element is missing
Used MSBuild from VS2019 folder.
Tried using MSBuild from C:\Windows\Microsoft.NET\Framework64\v3.5, it throws
Could not load the Visual C++ component "VCB
uild.exe". If the component is not installed, either 1) install the Microsoft Windows SDK for Windows Server 2008 and .
NET Framework 3.5, or 2) install Microsoft Visual Studio 2008
Which MSBuild should I be using and how to get about this error?
Thanks!