From 45bcef689136bc2ffbb39c0ef4fe27e2719bc4a0 Mon Sep 17 00:00:00 2001 From: jim wang <122244446+jimwang118@users.noreply.github.com> Date: Tue, 9 Jul 2024 17:34:01 +0000 Subject: [PATCH] [crashpad] Fix build errors under linux (#39671) --- ports/crashpad/fix-linux.patch | 14 ++++++++++++++ ports/crashpad/fix-std-20.patch | 18 ++++++++++++++++++ ports/crashpad/portfile.cmake | 7 +++++++ ports/crashpad/vcpkg.json | 1 + scripts/ci.baseline.txt | 2 +- versions/baseline.json | 2 +- versions/c-/crashpad.json | 5 +++++ 7 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 ports/crashpad/fix-linux.patch create mode 100644 ports/crashpad/fix-std-20.patch diff --git a/ports/crashpad/fix-linux.patch b/ports/crashpad/fix-linux.patch new file mode 100644 index 0000000000..a24968617e --- /dev/null +++ b/ports/crashpad/fix-linux.patch @@ -0,0 +1,14 @@ +diff --git a/util/misc/uuid.cc b/util/misc/uuid.cc +index 3013d7b..4cc135f 100644 +--- a/util/misc/uuid.cc ++++ b/util/misc/uuid.cc +@@ -41,7 +41,8 @@ + namespace crashpad { + + static_assert(sizeof(UUID) == 16, "UUID must be 16 bytes"); +-static_assert(std::is_pod::value, "UUID must be POD"); ++static_assert(std::is_standard_layout::value, "UUID must be a standard-layout type"); ++static_assert(std::is_trivial::value, "UUID must be a trivial type"); + + bool UUID::operator==(const UUID& that) const { + return memcmp(this, &that, sizeof(*this)) == 0; diff --git a/ports/crashpad/fix-std-20.patch b/ports/crashpad/fix-std-20.patch new file mode 100644 index 0000000000..45e29641fe --- /dev/null +++ b/ports/crashpad/fix-std-20.patch @@ -0,0 +1,18 @@ +diff --git a/base/atomicops_internals_portable.h b/base/atomicops_internals_portable.h +index 2486fb7..88e2d2d 100644 +--- a/base/atomicops_internals_portable.h ++++ b/base/atomicops_internals_portable.h +@@ -51,13 +51,7 @@ static_assert(sizeof(*(AtomicLocation32) nullptr) == sizeof(Atomic32), + "incompatible 32-bit atomic layout"); + + inline void MemoryBarrier() { +-#if defined(__GLIBCXX__) +- // Work around libstdc++ bug 51038 where atomic_thread_fence was declared but +- // not defined, leading to the linker complaining about undefined references. +- __atomic_thread_fence(std::memory_order_seq_cst); +-#else + std::atomic_thread_fence(std::memory_order_seq_cst); +-#endif + } + + inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr, diff --git a/ports/crashpad/portfile.cmake b/ports/crashpad/portfile.cmake index fbd6b97c44..f7ac1d7237 100644 --- a/ports/crashpad/portfile.cmake +++ b/ports/crashpad/portfile.cmake @@ -4,6 +4,8 @@ vcpkg_from_git( OUT_SOURCE_PATH SOURCE_PATH URL https://chromium.googlesource.com/crashpad/crashpad REF 7e0af1d4d45b526f01677e74a56f4a951b70517d + PATCHES + fix-linux.patch ) vcpkg_find_acquire_program(PYTHON3) @@ -29,6 +31,11 @@ checkout_in_path( "https://chromium.googlesource.com/chromium/mini_chromium" "dce72d97d1c2e9beb5e206c6a05a702269794ca3" ) +vcpkg_apply_patches( + SOURCE_PATH "${SOURCE_PATH}/third_party/mini_chromium/mini_chromium" + PATCHES + "fix-std-20.patch" +) if(VCPKG_TARGET_IS_LINUX) # fetch lss diff --git a/ports/crashpad/vcpkg.json b/ports/crashpad/vcpkg.json index 32d3b02432..e574520afb 100644 --- a/ports/crashpad/vcpkg.json +++ b/ports/crashpad/vcpkg.json @@ -1,6 +1,7 @@ { "name": "crashpad", "version-date": "2024-04-11", + "port-version": 1, "description": [ "Crashpad is a crash-reporting system.", "Crashpad is a library for capturing, storing and transmitting postmortem crash reports from a client to an upstream collection server. Crashpad aims to make it possible for clients to capture process state at the time of crash with the best possible fidelity and coverage, with the minimum of fuss." diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index a69b637284..f7321114ef 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -265,7 +265,7 @@ cppcoro:arm64-osx=fail cppcoro:x64-linux=fail cppcoro:x64-osx=fail cpputest:arm-neon-android=fail -crashpad:x64-linux=fail +crashpad:x64-linux=fail #Compilation failed due to the lack of Clang++ compiler. cserialport:arm-neon-android=fail cserialport:arm64-android=fail cserialport:x64-android=fail diff --git a/versions/baseline.json b/versions/baseline.json index 905aa541dc..247d5d5634 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -2010,7 +2010,7 @@ }, "crashpad": { "baseline": "2024-04-11", - "port-version": 0 + "port-version": 1 }, "crashrpt": { "baseline": "1.4.3", diff --git a/versions/c-/crashpad.json b/versions/c-/crashpad.json index d428288ab9..678f9e4c71 100644 --- a/versions/c-/crashpad.json +++ b/versions/c-/crashpad.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "43c2573b9400b543b26e7c9fbb091bdfefa51b79", + "version-date": "2024-04-11", + "port-version": 1 + }, { "git-tree": "faece66eb2a9a6f95f5a11c7f4ebd3cefd70d54f", "version-date": "2024-04-11",