Skip to content

backtrace-labs/crashpad

Repository files navigation

Backtrace fork of Crashpad

This is a fork of the Crashpad project with changes provided by Backtrace I/O, a Sauce Labs Company.

The major differences:

  • addition of CMake build files, making it possible to use Crashpad as a simple CMake dependency.
  • support for native Mac OS on M1 ARM builds.

Build instructions

Please see examples for usage examples.

Windows

Initial checkout

# Clone the repository
git clone git@github.com:backtrace-labs/crashpad.git
cd crashpad
# use the `backtrace` branch:
git checkout backtrace
# initialize submodules
git submodule update --init --recursive

Ensure that Visual Studio 2019 and CMake are in the path. You can do that by running terminal from the shortcut provided by the Visual Studio Installer.

Build:

# make a build directory (note: build is already used by Crashpad)
mkdir -p cbuild && cd cbuild
# run CMake (additional options like -DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE are possible)
# it is recommended to specify the compiler version used for the build
cmake -G "Visual Studio 16 2019" ..
cmake --build .

Linux

Initial checkout

# Clone the repository
git clone git@github.com:backtrace-labs/crashpad.git
cd crashpad
# use the `backtrace` branch:
git checkout backtrace
# initialize submodules
git submodule update --init --recursive

Build:

# make a build directory (note: build is already used by Crashpad)
mkdir -p cbuild && cd cbuild
# run CMake (additional options like -DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE are possible)
cmake ..
# alternatively: cmake --build .
make -j

Mac OS

Initial checkout

# Clone the repository
git clone git@github.com:backtrace-labs/crashpad.git
cd crashpad
# use the `backtrace` branch:
git checkout backtrace
# initialize submodules
git submodule update --init --recursive

Choose the architecture. Available options: arm64, x86_64.

Build:

# make a build directory (note: build is already used by Crashpad)
mkdir -p cbuild && cd cbuild
# run CMake (additional options like -DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE are possible)
cmake -DCMAKE_OSX_ARCHITECTURES=arm64 ..
# alternatively: cmake --build .
make -j

Android

Initial checkout

# Clone the repository
git clone git@github.com:backtrace-labs/crashpad.git
cd crashpad
# use the `backtrace` branch:
git checkout backtrace
# initialize submodules
git submodule update --init --recursive

Ensure that paths are set up for the Android SDK and NDK:

# note that you will have to adjust those paths to your installation
export SDK_HOME=/home/backtrace/code/android/sdk
export PATH=${SDK_HOME}/cmake/3.18.1/bin/:$PATH
export CMAKE=${SDK_HOME}/cmake/3.18.1/bin/cmake
export ANDROID_HOME=${SDK_HOME}
export NDK_VERSION=21.4.7075529
export NDK=${ANDROID_HOME}/ndk/${NDK_VERSION}
export TOOLCHAIN=${SDK_HOME}/ndk/${NDK_VERSION}/build/cmake/android.toolchain.cmake
export GTEST=${NDK}/sources/third_party/googletest
export API_VERSION=21
# other supported are: armeabi-v7a, x86_64. x86 (32-bit) is NOT supported
export ABI=arm64-v8a
# use OPENSSL or NONE
export HTTPS_TRANSPORT=OPENSSL

Build:

# make a build directory (note: build is already used by Crashpad)
mkdir -p cbuild && cd cbuild
# run CMake (additional options like -DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE are possible)
${CMAKE} \
        -DANDROID_ABI=${ABI} \
        -DANDROID_PLATFORM=${API_VERSION} \
        -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN} \
        -DANDROID_NATIVE_API_LEVEL=${API_VERSION} \
        -DANDROID_TOOLCHAIN=clang \
        ..
# build
make -j

Crashpad

Crashpad is a crash-reporting system.

Documentation

Source Code

Crashpad’s source code is hosted in a Git repository at https://chromium.googlesource.com/crashpad/crashpad.

Other Links