Skip to content

linux build using native SDK fails #92

@MouhK

Description

@MouhK

Hi,

The linux native SDK doesn't seem to build crashpad on some Linux distribution. I'm not sure if
I should report it directly to crashpad but here is the thing.

My environment

  • Docker image ubuntu:bionic (also on debian stable)
  • clang++-6

Step to reproduce

  • Fetch latest ubuntu:bionic Docker image (or on debian stable)
  • make config=release sentry-crashpad
./crashpad/build/crashpad/snapshot/elf/elf_image_reader.cc:270:51: error: invalid use of non-static
      data member 'n_namesz'
  static_assert(sizeof(*type) >= sizeof(NhdrType::n_namesz),

This patch seems ok:

From 74e43a9d6bdf9a0ed55fd762bb688f153c33e149 Mon Sep 17 00:00:00 2001
From: Mouhamad Kebe <mouhamad.kebe@blade-group.com>
Date: Fri, 15 Nov 2019 11:56:31 +0100
Subject: [PATCH] linux: fix build

---
 crashpad/build/crashpad/snapshot/elf/elf_image_reader.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/crashpad/build/crashpad/snapshot/elf/elf_image_reader.cc b/crashpad/build/crashpad/snapshot/elf/elf_image_reader.cc
index 7f6d7c7..1609c0e 100644
--- a/crashpad/build/crashpad/snapshot/elf/elf_image_reader.cc
+++ b/crashpad/build/crashpad/snapshot/elf/elf_image_reader.cc
@@ -267,11 +267,11 @@ ElfImageReader::NoteReader::Result ElfImageReader::NoteReader::ReadNote(
     NoteType* type,
     std::string* desc,
     VMAddress* desc_address) {
-  static_assert(sizeof(*type) >= sizeof(NhdrType::n_namesz),
+  NhdrType note_info;
+  static_assert(sizeof(*type) >= sizeof(note_info.n_namesz),
                 "Note field size mismatch");
   DCHECK_LT(current_address_, segment_end_address_);
 
-  NhdrType note_info;
   if (!segment_range_->Read(current_address_, sizeof(note_info), &note_info)) {
     return Result::kError;
   }
-- 
2.11.0

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions