vcpkg icon indicating copy to clipboard operation
vcpkg copied to clipboard

[crashpad] Build error on x64-linux

Open willco007 opened this issue 8 months ago • 2 comments

Package: crashpad:x64-linux@2024-04-11#7

Host Environment

  • Host: x64-linux
  • Compiler: GNU 15.1.1
  • vcpkg-tool version: 2025-01-29-a75ad067f470c19f030361064e32a2585392bee2 vcpkg-scripts version: 5a874b05fb 2025-04-30 (2 hours ago)

To Reproduce

vcpkg install crashpad

Failure logs

-- Using cached /home/will/Projects/Playdate/raven/vcpkg/downloads/crashpad-7e0af1d4d45b526f01677e74a56f4a951b70517d.tar.gz
-- Cleaning sources at /home/will/Projects/Playdate/raven/vcpkg/buildtrees/crashpad/src/951b70517d-d5821ac542.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source /home/will/Projects/Playdate/raven/vcpkg/downloads/crashpad-7e0af1d4d45b526f01677e74a56f4a951b70517d.tar.gz
-- Applying patch fix-linux.patch
-- Applying patch fix-lib-name-conflict.patch
-- Using source at /home/will/Projects/Playdate/raven/vcpkg/buildtrees/crashpad/src/951b70517d-d5821ac542.clean
-- Setting up python virtual environment...
-- Installing python packages: setuptools
-- Setting up python virtual environment... finished.
-- Using cached /home/will/Projects/Playdate/raven/vcpkg/downloads/crashpad-dce72d97d1c2e9beb5e206c6a05a702269794ca3.tar.gz
-- Extracting source /home/will/Projects/Playdate/raven/vcpkg/downloads/crashpad-dce72d97d1c2e9beb5e206c6a05a702269794ca3.tar.gz
-- Applying patch fix-std-20.patch
-- Applying patch ndk-toolchain.diff
-- Applying patch fix-lib-name-conflict-1.patch
-- Using source at /home/will/Projects/Playdate/raven/vcpkg/buildtrees/crashpad/src/2269794ca3-41bab2e83c.clean
-- Using cached /home/will/Projects/Playdate/raven/vcpkg/downloads/crashpad-9719c1e1e676814c456b55f5f070eabad6709d31.tar.gz
-- Extracting source /home/will/Projects/Playdate/raven/vcpkg/downloads/crashpad-9719c1e1e676814c456b55f5f070eabad6709d31.tar.gz
-- Using source at /home/will/Projects/Playdate/raven/vcpkg/buildtrees/crashpad/src/bad6709d31-6e596bea61.clean
-- Generating build (x64-linux-dbg)...
-- Generating build (x64-linux-rel)...
-- Found external ninja('1.12.1').
-- Building (x64-linux-dbg)...
CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:134 (message):
    Command failed: /usr/bin/ninja -C /home/will/Projects/Playdate/raven/vcpkg/buildtrees/crashpad/x64-linux-dbg client client:common util third_party/mini_chromium/mini_chromium/base handler:crashpad_handler
    Working Directory: /home/will/Projects/Playdate/raven/vcpkg/buildtrees/crashpad/src/951b70517d-d5821ac542.clean
    See logs for more information:
      /home/will/Projects/Playdate/raven/vcpkg/buildtrees/crashpad/build-x64-linux-dbg-out.log

Call Stack (most recent call first):
  scripts/cmake/vcpkg_build_ninja.cmake:3 (vcpkg_execute_build_process)
  scripts/cmake/vcpkg_build_ninja.cmake:24 (z_vcpkg_build_ninja_build)
  installed/x64-linux/share/vcpkg-gn/vcpkg_gn_install.cmake:94 (vcpkg_build_ninja)
  ports/crashpad/portfile.cmake:130 (vcpkg_gn_install)
  scripts/ports.cmake:206 (include)



/home/will/Projects/Playdate/raven/vcpkg/buildtrees/crashpad/build-x64-linux-dbg-out.log
ninja: Entering directory `/home/will/Projects/Playdate/raven/vcpkg/buildtrees/crashpad/x64-linux-dbg'
[1/81] CXX obj/third_party/mini_chromium/mini_chromium/base/threading/base.thread_local_storage.o
[2/81] CXX obj/util/misc/util.uuid.o
[3/81] AR obj/third_party/mini_chromium/mini_chromium/base/libvcpkg_crashpad_base.a
[4/81] CXX obj/util/linux/util.thread_info.o
FAILED: obj/util/linux/util.thread_info.o 
clang++ -MMD -MF obj/util/linux/util.thread_info.o.d -DZLIB_CONST -D_FILE_OFFSET_BITS=64 -DCRASHPAD_FLOCK_ALWAYS_SUPPORTED=true -DCRASHPAD_ZLIB_SOURCE_EXTERNAL -DCRASHPAD_LSS_SOURCE_EMBEDDED -Igen/third_party/crashpad/crashpad -I../src/951b70517d-d5821ac542.clean -Igen -I../src/951b70517d-d5821ac542.clean/third_party/mini_chromium/mini_chromium -I../src/951b70517d-d5821ac542.clean/compat/linux -I../src/951b70517d-d5821ac542.clean/compat/non_win -I/home/will/Projects/Playdate/raven/vcpkg/installed/x64-linux/include  -Wall -Wendif-labels -Werror -Wextra -Wextra-semi -Wheader-hygiene -Wnewline-eof -Wno-missing-field-initializers -Wno-unused-parameter -Wsign-compare -Wstring-conversion -Wvla -fno-exceptions -fno-rtti -fno-strict-aliasing -fobjc-call-cxx-cdtors -fstack-protector-all -fvisibility-inlines-hidden -fvisibility=hidden -fPIC -pthread -m64 -g -Wexit-time-destructors -Wimplicit-fallthrough -std=c++20 -c ../src/951b70517d-d5821ac542.clean/util/linux/thread_info.cc -o obj/util/linux/util.thread_info.o
../src/951b70517d-d5821ac542.clean/util/linux/thread_info.cc:22:10: error: first argument in call to 'memset' is a pointer to non-trivially copyable type 'crashpad::ThreadContext' [-Werror,-Wnontrivial-memcall]
   22 |   memset(this, 0, sizeof(*this));
      |          ^
../src/951b70517d-d5821ac542.clean/util/linux/thread_info.cc:22:10: note: explicitly cast the pointer to silence this warning
   22 |   memset(this, 0, sizeof(*this));
      |          ^
      |          (void*)
../src/951b70517d-d5821ac542.clean/util/linux/thread_info.cc:28:10: error: first argument in call to 'memset' is a pointer to non-trivially copyable type 'crashpad::FloatContext' [-Werror,-Wnontrivial-memcall]
   28 |   memset(this, 0, sizeof(*this));
      |          ^
../src/951b70517d-d5821ac542.clean/util/linux/thread_info.cc:28:10: note: explicitly cast the pointer to silence this warning
   28 |   memset(this, 0, sizeof(*this));
      |          ^
      |          (void*)
2 errors generated.
[5/81] CXX obj/snapshot/posix/snapshot.timezone.o
[6/81] CXX obj/snapshot/linux/snapshot.cpu_context_linux.o
[7/81] CXX obj/snapshot/sanitized/snapshot.memory_snapshot_sanitized.o
[8/81] CXX obj/snapshot/linux/snapshot.debug_rendezvous.o
[9/81] CXX obj/snapshot/linux/snapshot.system_snapshot_linux.o
[10/81] CXX obj/snapshot/sanitized/snapshot.process_snapshot_sanitized.o
[11/81] CXX obj/snapshot/sanitized/snapshot.module_snapshot_sanitized.o
[12/81] CXX obj/snapshot/linux/snapshot.capture_memory_delegate_linux.o
[13/81] CXX obj/snapshot/sanitized/snapshot.sanitization_information.o
[14/81] CXX obj/snapshot/linux/snapshot.process_reader_linux.o
[15/81] CXX obj/snapshot/linux/snapshot.exception_snapshot_linux.o
[16/81] CXX obj/snapshot/linux/snapshot.thread_snapshot_linux.o
[17/81] CXX obj/snapshot/linux/snapshot.process_snapshot_linux.o
ninja: build stopped: subcommand failed.

willco007 avatar Apr 30 '25 20:04 willco007

Also reported upstream at https://issues.chromium.org/issues/408265979

omartijn avatar May 16 '25 08:05 omartijn

@omartijn , I've hit the same issue over here, did you find a temporary workaround on your end?

nirvn avatar Jun 14 '25 11:06 nirvn

I've just set my compiler version back to clang 19 in the hopes that it would be fixed upstream at some point. Sadly it's not, so far. I've looked around a bit at the code (which you'll find here BTW: https://chromium.googlesource.com/crashpad/crashpad).

The reason for the error is of course the memset on a type that's not trivially copyable. The reason it's not is that it has a custom constructor (for the memset). Ideally you'd just put field-initializers on all fields and remove the constructor (and thus the memset), but they've used bit-fields. They can't be constructed like that, unless you're on c++20 (at the least). I don't really understand the way they build their projects and find it hard to evaluate if that would work.

Another thing is to just cast the type to void* when calling memset - but that's just silencing the error (that's there for a reason). Not quite sure what the best way is. I certainly have no idea how I would even propose a change to google.

omartijn avatar Aug 05 '25 07:08 omartijn