Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add breakpad recipe #5639

Merged
merged 8 commits into from
Jun 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions recipes/breakpad/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
sources:
"cci.20210521":
url: "https://github.com/google/breakpad/archive/f7428bc.tar.gz"
sha256: "55a688a49ffc476d94d92c3fd73f9264c974c25af8d6371c3901bd3451081e47"
patches:
"cci.20210521":
- patch_file: "patches/0001-Use_conans_lss.patch"
base_path: "source_subfolder"
- patch_file: "patches/0002-Remove-hardcoded-fpic.patch"
base_path: "source_subfolder"
77 changes: 77 additions & 0 deletions recipes/breakpad/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
from conans import ConanFile, AutoToolsBuildEnvironment, tools
from conans.errors import ConanInvalidConfiguration
import os
import textwrap

required_conan_version = ">=1.33.0"

class BreakpadConan(ConanFile):
name = "breakpad"
description = "A set of client and server components which implement a crash-reporting system"
topics = ["crash", "report", "breakpad"]
license = "BSD-3-Clause"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://chromium.googlesource.com/breakpad/breakpad/"
settings = "os", "compiler", "build_type", "arch"
provides = "breakpad"
exports_sources = "patches/**"
options = {
"fPIC": [True, False]
}
default_options = {
"fPIC": True
}
_env_build = None

@property
def _source_subfolder(self):
return "source_subfolder"

def validate(self):
if self.settings.os != "Linux":
raise ConanInvalidConfiguration("Breakpad can only be built on Linux. For other OSs check sentry-breakpad")

def requirements(self):
self.requires("linux-syscall-support/cci.20200813")

def _configure_autotools(self):
if not self._env_build:
self._env_build = AutoToolsBuildEnvironment(self)
self._env_build.configure(configure_dir=self._source_subfolder)
return self._env_build

def source(self):
tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True)

def build(self):
for patch in self.conan_data.get("patches", {}).get(self.version, []):
tools.patch(**patch)
env_build = self._configure_autotools()
env_build.make()

def package(self):
self.copy("LICENSE", src=self._source_subfolder, dst="licenses")
env_build = self._configure_autotools()
env_build.install()
tools.rmdir(os.path.join(self.package_folder, "share"))
tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))

def package_info( self ):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some help is needed here. sentry-native consumes this package using pkgConfig, but I'm not familiar with that system, so I don't know how to model it on Conan.
https://github.com/getsentry/sentry-native/blob/master/CMakeLists.txt#L439

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll fork this recipe and open a pr with some fixes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be interesting to create a sentry-breakpad recipe (such as I'm doing for sentry-crashpad), to see what components are needs to interface it with sentry-native.

self.cpp_info.components["libbreakpad"].libs = ["breakpad"]
self.cpp_info.components["libbreakpad"].includedirs.append(os.path.join("include", "breakpad"))
self.cpp_info.components["libbreakpad"].names["pkg_config"] = "breakpad"

self.cpp_info.components["client"].libs = ["breakpad_client"]
self.cpp_info.components["client"].includedirs.append(os.path.join("include", "breakpad"))
self.cpp_info.components["client"].names["pkg_config"] = "breakpad-client"


self.cpp_info.components["libbreakpad"].system_libs.append("pthread")
self.cpp_info.components["libbreakpad"].requires.append("linux-syscall-support::linux-syscall-support")

self.cpp_info.components["client"].system_libs.append("pthread")
self.cpp_info.components["client"].requires.append("linux-syscall-support::linux-syscall-support")

bindir = os.path.join(self.package_folder, "bin")
self.output.info("Appending PATH environment variable: {}".format(bindir))
self.env_info.PATH.append(bindir)
Comment on lines +75 to +77
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This

258 changes: 258 additions & 0 deletions recipes/breakpad/all/patches/0001-Use_conans_lss.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,258 @@
diff --color -ur Makefile.in Makefile.in
--- Makefile.in 2021-05-21 15:56:41.000000000 -0300
+++ Makefile.in 2021-05-27 18:57:23.986912433 -0300
@@ -2082,7 +2082,7 @@
HEADERS = $(includec_HEADERS) $(includecl_HEADERS) \
$(includeclc_HEADERS) $(includecldwc_HEADERS) \
$(includeclh_HEADERS) $(includeclm_HEADERS) \
- $(includegbc_HEADERS) $(includelss_HEADERS) \
+ $(includegbc_HEADERS) \
$(includep_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
@@ -9718,7 +9718,7 @@
install-includeclHEADERS install-includeclcHEADERS \
install-includecldwcHEADERS install-includeclhHEADERS \
install-includeclmHEADERS install-includegbcHEADERS \
- install-includelssHEADERS install-includepHEADERS \
+ iinstall-includepHEADERS \
install-pkgconfigDATA

install-dvi: install-dvi-am
@@ -10084,7 +10084,7 @@
install-includeclHEADERS install-includeclcHEADERS \
install-includecldwcHEADERS install-includeclhHEADERS \
install-includeclmHEADERS install-includegbcHEADERS \
- install-includelssHEADERS install-includepHEADERS install-info \
+ iinstall-includepHEADERS install-info \
install-info-am install-libLIBRARIES install-libexecPROGRAMS \
install-man install-pdf install-pdf-am install-pkgconfigDATA \
install-ps install-ps-am install-strip installcheck \
diff --color -ur src/client/linux/crash_generation/crash_generation_client.cc src/client/linux/crash_generation/crash_generation_client.cc
--- src/client/linux/crash_generation/crash_generation_client.cc 2021-05-21 15:56:41.000000000 -0300
+++ src/client/linux/crash_generation/crash_generation_client.cc 2021-05-27 18:57:23.990912414 -0300
@@ -37,7 +37,7 @@

#include "common/linux/eintr_wrapper.h"
#include "common/linux/ignore_ret.h"
-#include "third_party/lss/linux_syscall_support.h"
+#include <linux_syscall_support.h>

namespace google_breakpad {

diff --color -ur src/client/linux/handler/exception_handler.cc src/client/linux/handler/exception_handler.cc
--- src/client/linux/handler/exception_handler.cc 2021-05-21 15:56:41.000000000 -0300
+++ src/client/linux/handler/exception_handler.cc 2021-05-27 18:57:23.990912414 -0300
@@ -95,7 +95,7 @@
#include "client/linux/minidump_writer/linux_dumper.h"
#include "client/linux/minidump_writer/minidump_writer.h"
#include "common/linux/eintr_wrapper.h"
-#include "third_party/lss/linux_syscall_support.h"
+#include <linux_syscall_support.h>

#if defined(__ANDROID__)
#include "linux/sched.h"
diff --color -ur src/client/linux/handler/exception_handler_unittest.cc src/client/linux/handler/exception_handler_unittest.cc
--- src/client/linux/handler/exception_handler_unittest.cc 2021-05-21 15:56:41.000000000 -0300
+++ src/client/linux/handler/exception_handler_unittest.cc 2021-05-27 18:57:23.990912414 -0300
@@ -50,7 +50,7 @@
#include "common/linux/linux_libc_support.h"
#include "common/tests/auto_tempdir.h"
#include "common/using_std_string.h"
-#include "third_party/lss/linux_syscall_support.h"
+#include <linux_syscall_support.h>
#include "google_breakpad/processor/minidump.h"

using namespace google_breakpad;
diff --color -ur src/client/linux/log/log.cc src/client/linux/log/log.cc
--- src/client/linux/log/log.cc 2021-05-21 15:56:41.000000000 -0300
+++ src/client/linux/log/log.cc 2021-05-27 18:57:23.990912414 -0300
@@ -33,7 +33,7 @@
#include <android/log.h>
#include <dlfcn.h>
#else
-#include "third_party/lss/linux_syscall_support.h"
+#include <linux_syscall_support.h>
#endif

namespace logger {
diff --color -ur src/client/linux/minidump_writer/cpu_set.h src/client/linux/minidump_writer/cpu_set.h
--- src/client/linux/minidump_writer/cpu_set.h 2021-05-21 15:56:41.000000000 -0300
+++ src/client/linux/minidump_writer/cpu_set.h 2021-05-27 18:57:23.990912414 -0300
@@ -35,7 +35,7 @@
#include <string.h>

#include "common/linux/linux_libc_support.h"
-#include "third_party/lss/linux_syscall_support.h"
+#include <linux_syscall_support.h>

namespace google_breakpad {

diff --color -ur src/client/linux/minidump_writer/directory_reader.h src/client/linux/minidump_writer/directory_reader.h
--- src/client/linux/minidump_writer/directory_reader.h 2021-05-21 15:56:41.000000000 -0300
+++ src/client/linux/minidump_writer/directory_reader.h 2021-05-27 18:57:23.990912414 -0300
@@ -38,7 +38,7 @@
#include <string.h>

#include "common/linux/linux_libc_support.h"
-#include "third_party/lss/linux_syscall_support.h"
+#include <linux_syscall_support.h>

namespace google_breakpad {

diff --color -ur src/client/linux/minidump_writer/line_reader.h src/client/linux/minidump_writer/line_reader.h
--- src/client/linux/minidump_writer/line_reader.h 2021-05-21 15:56:41.000000000 -0300
+++ src/client/linux/minidump_writer/line_reader.h 2021-05-27 18:57:23.990912414 -0300
@@ -35,7 +35,7 @@
#include <string.h>

#include "common/linux/linux_libc_support.h"
-#include "third_party/lss/linux_syscall_support.h"
+#include <linux_syscall_support.h>

namespace google_breakpad {

diff --color -ur src/client/linux/minidump_writer/linux_dumper.cc src/client/linux/minidump_writer/linux_dumper.cc
--- src/client/linux/minidump_writer/linux_dumper.cc 2021-05-21 15:56:41.000000000 -0300
+++ src/client/linux/minidump_writer/linux_dumper.cc 2021-05-27 18:57:23.990912414 -0300
@@ -51,7 +51,7 @@
#include "common/linux/memory_mapped_file.h"
#include "common/linux/safe_readlink.h"
#include "google_breakpad/common/minidump_exception_linux.h"
-#include "third_party/lss/linux_syscall_support.h"
+#include <linux_syscall_support.h>

#if defined(__ANDROID__)

diff --color -ur src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
--- src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc 2021-05-21 15:56:41.000000000 -0300
+++ src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc 2021-05-27 18:57:23.990912414 -0300
@@ -39,7 +39,7 @@
#include <unistd.h>

#include "common/scoped_ptr.h"
-#include "third_party/lss/linux_syscall_support.h"
+#include <linux_syscall_support.h>

#if defined(__ARM_EABI__)
#define TID_PTR_REGISTER "r3"
diff --color -ur src/client/linux/minidump_writer/linux_ptrace_dumper.cc src/client/linux/minidump_writer/linux_ptrace_dumper.cc
--- src/client/linux/minidump_writer/linux_ptrace_dumper.cc 2021-05-21 15:56:41.000000000 -0300
+++ src/client/linux/minidump_writer/linux_ptrace_dumper.cc 2021-05-27 18:57:23.990912414 -0300
@@ -57,7 +57,7 @@
#include "client/linux/minidump_writer/directory_reader.h"
#include "client/linux/minidump_writer/line_reader.h"
#include "common/linux/linux_libc_support.h"
-#include "third_party/lss/linux_syscall_support.h"
+#include <linux_syscall_support.h>

// Suspends a thread by attaching to it.
static bool SuspendThread(pid_t pid) {
diff --color -ur src/client/linux/minidump_writer/minidump_writer.cc src/client/linux/minidump_writer/minidump_writer.cc
--- src/client/linux/minidump_writer/minidump_writer.cc 2021-05-21 15:56:41.000000000 -0300
+++ src/client/linux/minidump_writer/minidump_writer.cc 2021-05-27 18:57:23.990912414 -0300
@@ -77,7 +77,7 @@
#include "common/linux/linux_libc_support.h"
#include "common/minidump_type_helper.h"
#include "google_breakpad/common/minidump_format.h"
-#include "third_party/lss/linux_syscall_support.h"
+#include <linux_syscall_support.h>

namespace {

diff --color -ur src/client/linux/minidump_writer/proc_cpuinfo_reader.h src/client/linux/minidump_writer/proc_cpuinfo_reader.h
--- src/client/linux/minidump_writer/proc_cpuinfo_reader.h 2021-05-21 15:56:41.000000000 -0300
+++ src/client/linux/minidump_writer/proc_cpuinfo_reader.h 2021-05-27 18:57:23.990912414 -0300
@@ -36,7 +36,7 @@

#include "client/linux/minidump_writer/line_reader.h"
#include "common/linux/linux_libc_support.h"
-#include "third_party/lss/linux_syscall_support.h"
+#include <linux_syscall_support.h>

namespace google_breakpad {

diff --color -ur src/client/minidump_file_writer.cc src/client/minidump_file_writer.cc
--- src/client/minidump_file_writer.cc 2021-05-21 15:56:41.000000000 -0300
+++ src/client/minidump_file_writer.cc 2021-05-27 18:57:23.990912414 -0300
@@ -41,7 +41,7 @@
#include "common/linux/linux_libc_support.h"
#include "common/string_conversion.h"
#if defined(__linux__) && __linux__
-#include "third_party/lss/linux_syscall_support.h"
+#include <linux_syscall_support.h>
#endif

#if defined(__ANDROID__)
diff --color -ur src/common/linux/file_id.cc src/common/linux/file_id.cc
--- src/common/linux/file_id.cc 2021-05-21 15:56:41.000000000 -0300
+++ src/common/linux/file_id.cc 2021-05-27 18:57:23.990912414 -0300
@@ -46,7 +46,7 @@
#include "common/linux/linux_libc_support.h"
#include "common/linux/memory_mapped_file.h"
#include "common/using_std_string.h"
-#include "third_party/lss/linux_syscall_support.h"
+#include <linux_syscall_support.h>

namespace google_breakpad {

diff --color -ur src/common/linux/memory_mapped_file.cc src/common/linux/memory_mapped_file.cc
--- src/common/linux/memory_mapped_file.cc 2021-05-21 15:56:41.000000000 -0300
+++ src/common/linux/memory_mapped_file.cc 2021-05-27 18:57:23.990912414 -0300
@@ -40,7 +40,7 @@
#include <unistd.h>

#include "common/memory_range.h"
-#include "third_party/lss/linux_syscall_support.h"
+#include <linux_syscall_support.h>

namespace google_breakpad {

diff --color -ur src/common/linux/safe_readlink.cc src/common/linux/safe_readlink.cc
--- src/common/linux/safe_readlink.cc 2021-05-21 15:56:41.000000000 -0300
+++ src/common/linux/safe_readlink.cc 2021-05-27 18:57:23.990912414 -0300
@@ -32,7 +32,7 @@

#include <stddef.h>

-#include "third_party/lss/linux_syscall_support.h"
+#include <linux_syscall_support.h>

namespace google_breakpad {

diff --color -ur src/common/memory_allocator.h src/common/memory_allocator.h
--- src/common/memory_allocator.h 2021-05-21 15:56:41.000000000 -0300
+++ src/common/memory_allocator.h 2021-05-27 18:57:23.990912414 -0300
@@ -47,7 +47,7 @@
#define sys_munmap munmap
#define MAP_ANONYMOUS MAP_ANON
#else
-#include "third_party/lss/linux_syscall_support.h"
+#include <linux_syscall_support.h>
#endif

namespace google_breakpad {
diff --color -ur src/processor/testdata/linux_test_app.cc src/processor/testdata/linux_test_app.cc
--- src/processor/testdata/linux_test_app.cc 2021-05-21 15:56:41.000000000 -0300
+++ src/processor/testdata/linux_test_app.cc 2021-05-27 18:57:23.990912414 -0300
@@ -46,7 +46,7 @@
#include <string>

#include "client/linux/handler/exception_handler.h"
-#include "third_party/lss/linux_syscall_support.h"
+#include <linux_syscall_support.h>

namespace {

diff --color -ur src/tools/linux/md2core/minidump-2-core.cc src/tools/linux/md2core/minidump-2-core.cc
--- src/tools/linux/md2core/minidump-2-core.cc 2021-05-21 15:56:41.000000000 -0300
+++ src/tools/linux/md2core/minidump-2-core.cc 2021-05-27 18:57:23.990912414 -0300
@@ -52,7 +52,7 @@
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
#include "google_breakpad/common/minidump_format.h"
-#include "third_party/lss/linux_syscall_support.h"
+#include <linux_syscall_support.h>
#include "tools/linux/md2core/minidump_memory_range.h"

#if ULONG_MAX == 0xffffffffffffffff
13 changes: 13 additions & 0 deletions recipes/breakpad/all/patches/0002-Remove-hardcoded-fpic.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --color -ur a/Makefile.in b/Makefile.in
--- Makefile.in 2021-05-21 15:56:41.000000000 -0300
+++ Makefile.in 2021-05-27 19:01:06.857704652 -0300
@@ -130,8 +130,7 @@
@ANDROID_HOST_TRUE@ -I$(top_srcdir)/src/common/android/testing/include

# Build as PIC on Linux, for linux_client_unittest_shlib
-@LINUX_HOST_TRUE@am__append_2 = -fPIC
-@LINUX_HOST_TRUE@am__append_3 = -fPIC
+
libexec_PROGRAMS = $(am__EXEEXT_10)
bin_PROGRAMS = $(am__EXEEXT_2) $(am__EXEEXT_3) $(am__EXEEXT_4)
check_PROGRAMS = $(am__EXEEXT_5) $(am__EXEEXT_6) $(am__EXEEXT_7) \
9 changes: 9 additions & 0 deletions recipes/breakpad/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.1)
project(test_package CXX)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

add_executable(${PROJECT_NAME} test_package.cpp)
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
16 changes: 16 additions & 0 deletions recipes/breakpad/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from conans import ConanFile, CMake, tools
import os

class BreakpadTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if not tools.cross_building(self.settings):
bin_path = os.path.join("bin", "test_package")
Copy link
Contributor

@madebr madebr May 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one does not need to use the binaries in the bin package folder? (as the crashpad test package does?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think everything in bin are tools.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup. I was asking whether breakpad has a handler binary, such as crashpad.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nop. Breakpad is easier to use since you just link the library to your app. No need to ship an extra handler.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does not match this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prince-chrismc
breakpad ships utility executables to examine stacktraces post-crash, but no crashpad_handler-like executable that must be executed in parallel with the victim-executable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhhhhh thank you for explaining

self.run(bin_path, run_environment=True)
Loading