From 613f4708abe45d65276597fd7024f4ea19773335 Mon Sep 17 00:00:00 2001 From: "R. Savchenko" Date: Tue, 12 Dec 2023 18:22:41 +0100 Subject: [PATCH 1/6] Remove options memory leak during consent setting (#922) --- CHANGELOG.md | 1 + src/sentry_core.c | 40 +++++++++++++++++++-------------------- tests/unit/test_consent.c | 4 ++++ 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0550d4724..88daef74d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Updated `crashpad` to 2023-11-24. ([#912](https://github.com/getsentry/sentry-native/pull/912), [crashpad#91](https://github.com/getsentry/crashpad/pull/91)) - Fixing `crashpad` build for Windows on ARM64. ([#919](https://github.com/getsentry/sentry-native/pull/919), [crashpad#90](https://github.com/getsentry/crashpad/pull/90), [crashpad#92](https://github.com/getsentry/crashpad/pull/92), [crashpad#93](https://github.com/getsentry/crashpad/pull/93), [crashpad#94](https://github.com/getsentry/crashpad/pull/94)) +- Remove options memory leak during consent setting. ([#922](https://github.com/getsentry/sentry-native/pull/922)) **Thank you**: diff --git a/src/sentry_core.c b/src/sentry_core.c index 43309b67f..24cf52539 100644 --- a/src/sentry_core.c +++ b/src/sentry_core.c @@ -292,29 +292,27 @@ set_user_consent(sentry_user_consent_t new_val) { SENTRY_WITH_OPTIONS (options) { if (sentry__atomic_store((long *)&options->user_consent, new_val) - == new_val) { - // nothing was changed - break; // SENTRY_WITH_OPTIONS - } - - if (options->backend && options->backend->user_consent_changed_func) { - options->backend->user_consent_changed_func(options->backend); - } + != new_val) { + if (options->backend + && options->backend->user_consent_changed_func) { + options->backend->user_consent_changed_func(options->backend); + } - sentry_path_t *consent_path - = sentry__path_join_str(options->database_path, "user-consent"); - switch (new_val) { - case SENTRY_USER_CONSENT_GIVEN: - sentry__path_write_buffer(consent_path, "1\n", 2); - break; - case SENTRY_USER_CONSENT_REVOKED: - sentry__path_write_buffer(consent_path, "0\n", 2); - break; - case SENTRY_USER_CONSENT_UNKNOWN: - sentry__path_remove(consent_path); - break; + sentry_path_t *consent_path + = sentry__path_join_str(options->database_path, "user-consent"); + switch (new_val) { + case SENTRY_USER_CONSENT_GIVEN: + sentry__path_write_buffer(consent_path, "1\n", 2); + break; + case SENTRY_USER_CONSENT_REVOKED: + sentry__path_write_buffer(consent_path, "0\n", 2); + break; + case SENTRY_USER_CONSENT_UNKNOWN: + sentry__path_remove(consent_path); + break; + } + sentry__path_free(consent_path); } - sentry__path_free(consent_path); } } diff --git a/tests/unit/test_consent.c b/tests/unit/test_consent.c index f26af345b..d81476c27 100644 --- a/tests/unit/test_consent.c +++ b/tests/unit/test_consent.c @@ -28,6 +28,10 @@ SENTRY_TEST(basic_consent_tracking) init_consenting_sentry(); sentry_user_consent_give(); + // testing correct options ref/decref during double + // `sentry_user_consent_give` call see + // https://github.com/getsentry/sentry-native/pull/922 + sentry_user_consent_give(); TEST_CHECK_INT_EQUAL(sentry_user_consent_get(), SENTRY_USER_CONSENT_GIVEN); sentry_close(); init_consenting_sentry(); From 00061be4a25c0ce019aa35e8abc70782861cfa2a Mon Sep 17 00:00:00 2001 From: Mischan Toosarani-Hausberger Date: Tue, 19 Dec 2023 17:52:03 +0100 Subject: [PATCH 2/6] fix: specify correct dependencies for CMake client projects... (#926) ...which use a system-provided breakpad (instead of our vendored fork). The problem [here](https://github.com/getsentry/sentry-native/issues/877) was that people who introduce sentry-native via CMake `find_package()` will get insufficient dependencies, which leads to configuration errors in the client CMake project. There are two aspects to this problem: * if the user builds sentry as a shared library, it shouldn't be necessary to specify the dependencies. This can be fixed by defining `breakpad` as a `PRIVATE` dependency. This should also fix the Gentoo issue because it uses sentry as a shared library afaict. * if the user builds sentry as a static library, then we must stay with the `PUBLIC` dependency, but we also need to correctly search for `breakpad`, `libcurl`, and `pthread` in the context of the client project. --- CHANGELOG.md | 2 ++ CMakeLists.txt | 6 +++++- sentry-config.cmake.in | 19 +++++++++++++++++-- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88daef74d..eaade5f1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ **Fixes**: - Maintain crashpad client instance during Native SDK lifecycle. ([#910](https://github.com/getsentry/sentry-native/pull/910)) +- Specify correct dependencies for CMake client projects using a system-provided breakpad. ([#926](https://github.com/getsentry/sentry-native/pull/926)) **Internal**: @@ -17,6 +18,7 @@ Features, fixes and improvements in this release have been contributed by: - [@compnerd](https://github.com/compnerd) +- [@stima](https://github.com/stima) ## 0.6.7 diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ec677899..8c7a8ba55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -496,7 +496,11 @@ elseif(SENTRY_BACKEND_BREAKPAD) # system breakpad is using pkg-config, see `external/breakpad/breakpad-client.pc.in` find_package(PkgConfig REQUIRED) pkg_check_modules(BREAKPAD REQUIRED IMPORTED_TARGET breakpad-client) - target_link_libraries(sentry PUBLIC PkgConfig::BREAKPAD) + if(SENTRY_BUILD_SHARED_LIBS) + target_link_libraries(sentry PRIVATE PkgConfig::BREAKPAD) + else() + target_link_libraries(sentry PUBLIC PkgConfig::BREAKPAD) + endif() else() add_subdirectory(external) target_include_directories(sentry PRIVATE diff --git a/sentry-config.cmake.in b/sentry-config.cmake.in index 89ea34511..483d92c0a 100644 --- a/sentry-config.cmake.in +++ b/sentry-config.cmake.in @@ -2,19 +2,34 @@ set(SENTRY_BACKEND @SENTRY_BACKEND@) set(SENTRY_TRANSPORT @SENTRY_TRANSPORT@) +set(SENTRY_BUILD_SHARED_LIBS @SENTRY_BUILD_SHARED_LIBS@) +set(SENTRY_LINK_PTHREAD @SENTRY_LINK_PTHREAD@) if(SENTRY_BACKEND STREQUAL "crashpad") - if(@SENTRY_CRASHPAD_SYSTEM@) + set(SENTRY_CRASHPAD_SYSTEM @SENTRY_CRASHPAD_SYSTEM@) + if(SENTRY_CRASHPAD_SYSTEM) find_package(crashpad REQUIRED) else() include("${CMAKE_CURRENT_LIST_DIR}/sentry_crashpad-targets.cmake") endif() endif() +if(SENTRY_BACKEND STREQUAL "breakpad" AND NOT SENTRY_BUILD_SHARED_LIBS) + set(SENTRY_BREAKPAD_SYSTEM @SENTRY_BREAKPAD_SYSTEM@) + if(SENTRY_BREAKPAD_SYSTEM) + find_package(PkgConfig REQUIRED) + pkg_check_modules(BREAKPAD REQUIRED IMPORTED_TARGET breakpad-client) + endif() +endif() + include("${CMAKE_CURRENT_LIST_DIR}/sentry-targets.cmake") -if(SENTRY_TRANSPORT STREQUAL "curl" AND NOT @BUILD_SHARED_LIBS@) +if(SENTRY_TRANSPORT STREQUAL "curl" AND (NOT @BUILD_SHARED_LIBS@ OR NOT SENTRY_BUILD_SHARED_LIBS)) find_package(CURL REQUIRED) set_property(TARGET sentry::sentry APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${CURL_LIBRARIES}) endif() + +if(SENTRY_LINK_PTHREAD AND NOT SENTRY_BUILD_SHARED_LIBS) + find_package(Threads REQUIRED) +endif() From 164da7919172b0df9c7b75efbc36e6e897124415 Mon Sep 17 00:00:00 2001 From: Mischan Toosarani-Hausberger Date: Wed, 20 Dec 2023 10:09:44 +0100 Subject: [PATCH 3/6] build: make crashpad the default backend on Linux (#927) --- CHANGELOG.md | 4 ++++ CMakeLists.txt | 20 +++++++++----------- README.md | 4 ++-- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eaade5f1c..80d99df68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +**Breaking changes**: + +- Make `crashpad` the default backend for Linux. ([#927](https://github.com/getsentry/sentry-native/pull/927)) + **Fixes**: - Maintain crashpad client instance during Native SDK lifecycle. ([#910](https://github.com/getsentry/sentry-native/pull/910)) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c7a8ba55..eb9d54a9b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,11 +26,11 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) endif() if(NOT CMAKE_C_STANDARD) - set(CMAKE_C_STANDARD 11) + set(CMAKE_C_STANDARD 11) endif() if(NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD 17) endif() include(GNUInstallDirs) @@ -96,7 +96,7 @@ else() endif() set(SENTRY_TRANSPORT ${SENTRY_DEFAULT_TRANSPORT} CACHE STRING - "The HTTP transport that sentry uses to submit events to the sentry server, can be either 'none', 'curl' or 'winhttp' on windows.") + "The HTTP transport that sentry uses to submit events to the sentry server, can be either 'none', 'curl' or 'winhttp' on windows.") if(SENTRY_TRANSPORT STREQUAL "winhttp") set(SENTRY_TRANSPORT_WINHTTP TRUE) @@ -125,10 +125,8 @@ option(SENTRY_ENABLE_INSTALL "Enable sentry installation" "${SENTRY_MAIN_PROJECT if(MSVC AND CMAKE_GENERATOR_TOOLSET MATCHES "_xp$") message(WARNING "Crashpad is not supported for MSVC with XP toolset. Default backend was switched to 'breakpad'") set(SENTRY_DEFAULT_BACKEND "breakpad") -elseif((APPLE AND NOT IOS) OR WIN32) +elseif((APPLE AND NOT IOS) OR WIN32 OR LINUX) set(SENTRY_DEFAULT_BACKEND "crashpad") -elseif(LINUX) - set(SENTRY_DEFAULT_BACKEND "breakpad") else() set(SENTRY_DEFAULT_BACKEND "inproc") endif() @@ -367,11 +365,11 @@ endif() # handle platform libraries if(ANDROID) - set(_SENTRY_PLATFORM_LIBS "dl" "log") + set(_SENTRY_PLATFORM_LIBS "dl" "log") elseif(LINUX) - set(_SENTRY_PLATFORM_LIBS "dl" "rt") + set(_SENTRY_PLATFORM_LIBS "dl" "rt") elseif(WIN32) - set(_SENTRY_PLATFORM_LIBS "dbghelp" "shlwapi" "version") + set(_SENTRY_PLATFORM_LIBS "dbghelp" "shlwapi" "version") endif() if(SENTRY_TRANSPORT_WINHTTP) @@ -385,9 +383,9 @@ endif() # apply platform libraries to sentry library if(SENTRY_LIBRARY_TYPE STREQUAL "STATIC") - target_link_libraries(sentry PUBLIC ${_SENTRY_PLATFORM_LIBS}) + target_link_libraries(sentry PUBLIC ${_SENTRY_PLATFORM_LIBS}) else() - target_link_libraries(sentry PRIVATE ${_SENTRY_PLATFORM_LIBS}) + target_link_libraries(sentry PRIVATE ${_SENTRY_PLATFORM_LIBS}) endif() # suppress some errors and warnings for MinGW target diff --git a/README.md b/README.md index 6cc4b1454..8d4994538 100644 --- a/README.md +++ b/README.md @@ -227,9 +227,9 @@ using `cmake -D BUILD_SHARED_LIBS=OFF ..`. Sentry can use different backends depending on platform. - **crashpad**: This uses the out-of-process crashpad handler. It is currently - only supported on Desktop OSs, and used as the default on Windows and macOS. + only supported on Desktop OSs, and used as the default on Windows, Linux and macOS. - **breakpad**: This uses the in-process breakpad handler. It is currently - only supported on Desktop OSs, and used as the default on Linux. + only supported on Desktop OSs. - **inproc**: A small in-process handler which is supported on all platforms, and is used as default on Android. - **none**: This builds `sentry-native` without a backend, so it does not handle From 8c748b43a0d1e2bffa2ccb343f34a541625055cf Mon Sep 17 00:00:00 2001 From: Mischan Toosarani-Hausberger Date: Mon, 8 Jan 2024 10:23:17 +0100 Subject: [PATCH 4/6] fix: remove the SENTRY_CRASHPAD_SYSTEM build option (#928) --- CHANGELOG.md | 3 +- CMakeLists.txt | 114 +++++++++++++++++++---------------------- README.md | 8 +-- sentry-config.cmake.in | 10 ++-- 4 files changed, 62 insertions(+), 73 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80d99df68..756bcbc67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,10 +5,11 @@ **Breaking changes**: - Make `crashpad` the default backend for Linux. ([#927](https://github.com/getsentry/sentry-native/pull/927)) +- Remove build option `SENTRY_CRASHPAD_SYSTEM`. ([#928](https://github.com/getsentry/sentry-native/pull/928)) **Fixes**: -- Maintain crashpad client instance during Native SDK lifecycle. ([#910](https://github.com/getsentry/sentry-native/pull/910)) +- Maintain `crashpad` client instance during Native SDK lifecycle. ([#910](https://github.com/getsentry/sentry-native/pull/910)) - Specify correct dependencies for CMake client projects using a system-provided breakpad. ([#926](https://github.com/getsentry/sentry-native/pull/926)) **Internal**: diff --git a/CMakeLists.txt b/CMakeLists.txt index eb9d54a9b..8e460cded 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -413,74 +413,68 @@ if(SENTRY_WITH_LIBUNWINDSTACK) endif() if(SENTRY_BACKEND_CRASHPAD) - option(SENTRY_CRASHPAD_SYSTEM "Use system crashpad" OFF) - if(SENTRY_CRASHPAD_SYSTEM) - find_package(crashpad REQUIRED) - target_link_libraries(sentry PUBLIC crashpad::client) + # FIXME: required for cmake 3.12 and lower: + # - NEW behavior lets normal variable override option + cmake_policy(SET CMP0077 NEW) + if(SENTRY_BUILD_SHARED_LIBS) + set(CRASHPAD_ENABLE_INSTALL OFF CACHE BOOL "Enable crashpad installation" FORCE) else() - # FIXME: required for cmake 3.12 and lower: - # - NEW behavior lets normal variable override option - cmake_policy(SET CMP0077 NEW) - if(SENTRY_BUILD_SHARED_LIBS) - set(CRASHPAD_ENABLE_INSTALL OFF CACHE BOOL "Enable crashpad installation" FORCE) - else() - set(CRASHPAD_ENABLE_INSTALL ON CACHE BOOL "Enable crashpad installation" FORCE) - endif() - add_subdirectory(external/crashpad crashpad_build) + set(CRASHPAD_ENABLE_INSTALL ON CACHE BOOL "Enable crashpad installation" FORCE) + endif() + add_subdirectory(external/crashpad crashpad_build) - if(CRASHPAD_WER_ENABLED) - add_dependencies(sentry crashpad::wer) - endif() + if(CRASHPAD_WER_ENABLED) + add_dependencies(sentry crashpad::wer) + endif() - # set static runtime if enabled - if(SENTRY_BUILD_RUNTIMESTATIC AND MSVC) - set_property(TARGET crashpad_client PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - set_property(TARGET crashpad_compat PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - set_property(TARGET crashpad_getopt PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - set_property(TARGET crashpad_handler PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - set_property(TARGET crashpad_handler_lib PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - set_property(TARGET crashpad_minidump PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - set_property(TARGET crashpad_snapshot PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - set_property(TARGET crashpad_tools PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - set_property(TARGET crashpad_util PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - if(CRASHPAD_WER_ENABLED) - set_property(TARGET crashpad_wer PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - endif() - set_property(TARGET crashpad_zlib PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - set_property(TARGET mini_chromium PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + # set static runtime if enabled + if(SENTRY_BUILD_RUNTIMESTATIC AND MSVC) + set_property(TARGET crashpad_client PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + set_property(TARGET crashpad_compat PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + set_property(TARGET crashpad_getopt PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + set_property(TARGET crashpad_handler PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + set_property(TARGET crashpad_handler_lib PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + set_property(TARGET crashpad_minidump PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + set_property(TARGET crashpad_snapshot PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + set_property(TARGET crashpad_tools PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + set_property(TARGET crashpad_util PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + if(CRASHPAD_WER_ENABLED) + set_property(TARGET crashpad_wer PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") endif() + set_property(TARGET crashpad_zlib PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + set_property(TARGET mini_chromium PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + endif() - if(DEFINED SENTRY_FOLDER) - set_target_properties(crashpad_client PROPERTIES FOLDER ${SENTRY_FOLDER}) - set_target_properties(crashpad_compat PROPERTIES FOLDER ${SENTRY_FOLDER}) - set_target_properties(crashpad_getopt PROPERTIES FOLDER ${SENTRY_FOLDER}) - set_target_properties(crashpad_handler PROPERTIES FOLDER ${SENTRY_FOLDER}) - set_target_properties(crashpad_handler_lib PROPERTIES FOLDER ${SENTRY_FOLDER}) - set_target_properties(crashpad_minidump PROPERTIES FOLDER ${SENTRY_FOLDER}) - set_target_properties(crashpad_snapshot PROPERTIES FOLDER ${SENTRY_FOLDER}) - set_target_properties(crashpad_tools PROPERTIES FOLDER ${SENTRY_FOLDER}) - set_target_properties(crashpad_util PROPERTIES FOLDER ${SENTRY_FOLDER}) - set_target_properties(crashpad_zlib PROPERTIES FOLDER ${SENTRY_FOLDER}) - set_target_properties(mini_chromium PROPERTIES FOLDER ${SENTRY_FOLDER}) - if(CRASHPAD_WER_ENABLED) - set_target_properties(crashpad_wer PROPERTIES FOLDER ${SENTRY_FOLDER}) - endif() + if(DEFINED SENTRY_FOLDER) + set_target_properties(crashpad_client PROPERTIES FOLDER ${SENTRY_FOLDER}) + set_target_properties(crashpad_compat PROPERTIES FOLDER ${SENTRY_FOLDER}) + set_target_properties(crashpad_getopt PROPERTIES FOLDER ${SENTRY_FOLDER}) + set_target_properties(crashpad_handler PROPERTIES FOLDER ${SENTRY_FOLDER}) + set_target_properties(crashpad_handler_lib PROPERTIES FOLDER ${SENTRY_FOLDER}) + set_target_properties(crashpad_minidump PROPERTIES FOLDER ${SENTRY_FOLDER}) + set_target_properties(crashpad_snapshot PROPERTIES FOLDER ${SENTRY_FOLDER}) + set_target_properties(crashpad_tools PROPERTIES FOLDER ${SENTRY_FOLDER}) + set_target_properties(crashpad_util PROPERTIES FOLDER ${SENTRY_FOLDER}) + set_target_properties(crashpad_zlib PROPERTIES FOLDER ${SENTRY_FOLDER}) + set_target_properties(mini_chromium PROPERTIES FOLDER ${SENTRY_FOLDER}) + if(CRASHPAD_WER_ENABLED) + set_target_properties(crashpad_wer PROPERTIES FOLDER ${SENTRY_FOLDER}) endif() + endif() - target_link_libraries(sentry PRIVATE - $ - $ - ) - install(EXPORT crashpad_export NAMESPACE sentry_crashpad:: FILE sentry_crashpad-targets.cmake - DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" - ) - if(WIN32 AND MSVC) - sentry_install(FILES $ + target_link_libraries(sentry PRIVATE + $ + $ + ) + install(EXPORT crashpad_export NAMESPACE sentry_crashpad:: FILE sentry_crashpad-targets.cmake + DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" + ) + if(WIN32 AND MSVC) + sentry_install(FILES $ + DESTINATION "${CMAKE_INSTALL_BINDIR}" OPTIONAL) + if (CRASHPAD_WER_ENABLED) + sentry_install(FILES $ DESTINATION "${CMAKE_INSTALL_BINDIR}" OPTIONAL) - if (CRASHPAD_WER_ENABLED) - sentry_install(FILES $ - DESTINATION "${CMAKE_INSTALL_BINDIR}" OPTIONAL) - endif() endif() endif() add_dependencies(sentry crashpad::handler) diff --git a/README.md b/README.md index 8d4994538..3c809b50c 100644 --- a/README.md +++ b/README.md @@ -238,12 +238,8 @@ using `cmake -D BUILD_SHARED_LIBS=OFF ..`. - `SENTRY_INTEGRATION_QT` (Default: OFF): Builds the Qt integration, which turns Qt log messages into breadcrumbs. -- `SENTRY_BREAKPAD_SYSTEM` / `SENTRY_CRASHPAD_SYSTEM` (Default: OFF): - This instructs the build system to use system-installed breakpad or crashpad - libraries instead of using the in-tree version. This is generally not recommended - for crashpad, as sentry uses a patched version that has attachment support. - This is being worked on upstream as well, and a future version might work with - an unmodified crashpad version as well. +- `SENTRY_BREAKPAD_SYSTEM` (Default: OFF): + This instructs the build system to use system-installed breakpad libraries instead of using the in-tree version. | Feature | Windows | macOS | Linux | Android | iOS | | ---------- | ------- | ----- | ----- | ------- | --- | diff --git a/sentry-config.cmake.in b/sentry-config.cmake.in index 483d92c0a..70ce7d3c5 100644 --- a/sentry-config.cmake.in +++ b/sentry-config.cmake.in @@ -5,12 +5,10 @@ set(SENTRY_TRANSPORT @SENTRY_TRANSPORT@) set(SENTRY_BUILD_SHARED_LIBS @SENTRY_BUILD_SHARED_LIBS@) set(SENTRY_LINK_PTHREAD @SENTRY_LINK_PTHREAD@) -if(SENTRY_BACKEND STREQUAL "crashpad") - set(SENTRY_CRASHPAD_SYSTEM @SENTRY_CRASHPAD_SYSTEM@) - if(SENTRY_CRASHPAD_SYSTEM) - find_package(crashpad REQUIRED) - else() - include("${CMAKE_CURRENT_LIST_DIR}/sentry_crashpad-targets.cmake") +if(SENTRY_BACKEND STREQUAL "crashpad" AND NOT SENTRY_BUILD_SHARED_LIBS) + include("${CMAKE_CURRENT_LIST_DIR}/sentry_crashpad-targets.cmake") + if(NOT MSVC AND NOT SENTRY_BUILD_SHARED_LIBS) + find_package(ZLIB REQUIRED) endif() endif() From b8fadf90dd1b8c36941125f8706529f77832195a Mon Sep 17 00:00:00 2001 From: Alex Lorenz Date: Tue, 9 Jan 2024 01:48:55 -0800 Subject: [PATCH 5/6] include to ensure that sentry.h is modularized correctly (#935) --- CHANGELOG.md | 3 ++- include/sentry.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 756bcbc67..fe2a44b61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,13 +11,14 @@ - Maintain `crashpad` client instance during Native SDK lifecycle. ([#910](https://github.com/getsentry/sentry-native/pull/910)) - Specify correct dependencies for CMake client projects using a system-provided breakpad. ([#926](https://github.com/getsentry/sentry-native/pull/926)) +- Correct the Windows header include used by `sentry.h`, which fixes the build of [Swift bindings](https://github.com/thebrowsercompany/swift-sentry). ([#935](https://github.com/getsentry/sentry-native/pull/935)) **Internal**: - Updated `crashpad` to 2023-11-24. ([#912](https://github.com/getsentry/sentry-native/pull/912), [crashpad#91](https://github.com/getsentry/crashpad/pull/91)) - Fixing `crashpad` build for Windows on ARM64. ([#919](https://github.com/getsentry/sentry-native/pull/919), [crashpad#90](https://github.com/getsentry/crashpad/pull/90), [crashpad#92](https://github.com/getsentry/crashpad/pull/92), [crashpad#93](https://github.com/getsentry/crashpad/pull/93), [crashpad#94](https://github.com/getsentry/crashpad/pull/94)) - Remove options memory leak during consent setting. ([#922](https://github.com/getsentry/sentry-native/pull/922)) - + **Thank you**: Features, fixes and improvements in this release have been contributed by: diff --git a/include/sentry.h b/include/sentry.h index fe9918488..f52f5ae56 100644 --- a/include/sentry.h +++ b/include/sentry.h @@ -90,7 +90,7 @@ extern "C" { /* context type dependencies */ #ifdef _WIN32 -# include +# include #else # include #endif From 4ec95c0725df5f34440db8fa8d37b4c519fce74e Mon Sep 17 00:00:00 2001 From: getsentry-bot Date: Tue, 9 Jan 2024 09:49:59 +0000 Subject: [PATCH 6/6] release: 0.7.0 --- CHANGELOG.md | 2 +- include/sentry.h | 2 +- tests/assertions.py | 4 ++-- tests/test_integration_http.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe2a44b61..dcaaf1ebf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 0.7.0 **Breaking changes**: diff --git a/include/sentry.h b/include/sentry.h index f52f5ae56..bba0dd0e7 100644 --- a/include/sentry.h +++ b/include/sentry.h @@ -30,7 +30,7 @@ extern "C" { # define SENTRY_SDK_NAME "sentry.native" # endif #endif -#define SENTRY_SDK_VERSION "0.6.7" +#define SENTRY_SDK_VERSION "0.7.0" #define SENTRY_SDK_USER_AGENT SENTRY_SDK_NAME "/" SENTRY_SDK_VERSION /* common platform detection */ diff --git a/tests/assertions.py b/tests/assertions.py index 08f2936ab..f12ec9972 100644 --- a/tests/assertions.py +++ b/tests/assertions.py @@ -58,9 +58,9 @@ def assert_meta( } expected_sdk = { "name": "sentry.native", - "version": "0.6.7", + "version": "0.7.0", "packages": [ - {"name": "github:getsentry/sentry-native", "version": "0.6.7"}, + {"name": "github:getsentry/sentry-native", "version": "0.7.0"}, ], } if is_android: diff --git a/tests/test_integration_http.py b/tests/test_integration_http.py index fe3740a6c..ee915f00e 100644 --- a/tests/test_integration_http.py +++ b/tests/test_integration_http.py @@ -24,7 +24,7 @@ pytestmark = pytest.mark.skipif(not has_http, reason="tests need http") auth_header = ( - "Sentry sentry_key=uiaeosnrtdy, sentry_version=7, sentry_client=sentry.native/0.6.7" + "Sentry sentry_key=uiaeosnrtdy, sentry_version=7, sentry_client=sentry.native/0.7.0" )