Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Ross Burton <ross.burton@intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH] sysprof: fix build with musl
Date: Fri,  7 Sep 2018 02:00:32 +0100	[thread overview]
Message-ID: <20180907010032.18028-1-ross.burton@intel.com> (raw)

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 meta/recipes-kernel/sysprof/files/wordsize.patch | 62 ++++++++++++++++++++++++
 meta/recipes-kernel/sysprof/sysprof_3.30.0.bb    |  1 +
 2 files changed, 63 insertions(+)
 create mode 100644 meta/recipes-kernel/sysprof/files/wordsize.patch

diff --git a/meta/recipes-kernel/sysprof/files/wordsize.patch b/meta/recipes-kernel/sysprof/files/wordsize.patch
new file mode 100644
index 00000000000..4ce77777825
--- /dev/null
+++ b/meta/recipes-kernel/sysprof/files/wordsize.patch
@@ -0,0 +1,62 @@
+capture: use size of void* instead of glibc-specific __WORDSIZE
+
+__WORDSIZE is glibc-specific so sp-capture-types.h doesn't work with musl.
+
+As this code is all about the size of pointers, do sizeof(void*) at configure
+time and use that to determine what values to use.
+
+Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/sysprof/merge_requests/5]
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+diff --git a/config.h.meson b/config.h.meson
+index 2d8c8fb..d927b1b 100644
+--- a/config.h.meson
++++ b/config.h.meson
+@@ -34,3 +34,6 @@
+ 
+ /* Version number of package */
+ #mesondefine VERSION
++
++/* Size of a pointer */
++#mesondefine VOID_P_SIZE
+diff --git a/lib/capture/sp-capture-types.h b/lib/capture/sp-capture-types.h
+index 48fcfb8..bc3ab9c 100644
+--- a/lib/capture/sp-capture-types.h
++++ b/lib/capture/sp-capture-types.h
+@@ -19,6 +19,7 @@
+ #ifndef SP_CAPTURE_FORMAT_H
+ #define SP_CAPTURE_FORMAT_H
+ 
++#include <config.h>
+ #include <glib.h>
+ 
+ #ifdef SP_ENABLE_GOBJECT
+@@ -32,12 +33,14 @@ G_BEGIN_DECLS
+ #define SP_CAPTURE_MAGIC (GUINT32_TO_LE(0xFDCA975E))
+ #define SP_CAPTURE_ALIGN (sizeof(SpCaptureAddress))
+ 
+-#if __WORDSIZE == 64
++#if VOID_P_SIZE == 8
+ # define SP_CAPTURE_JITMAP_MARK    G_GUINT64_CONSTANT(0xE000000000000000)
+ # define SP_CAPTURE_ADDRESS_FORMAT "0x%016lx"
+-#else
++#elif VOID_P_SIZE == 4
+ # define SP_CAPTURE_JITMAP_MARK    G_GUINT64_CONSTANT(0xE0000000)
+ # define SP_CAPTURE_ADDRESS_FORMAT "0x%016llx"
++#else
++#error Unknown VOID_P_SIZE
+ #endif
+ 
+ #define SP_CAPTURE_CURRENT_TIME   (sp_clock_get_current_time())
+diff --git a/meson.build b/meson.build
+index ff7296b..d841c0d 100644
+--- a/meson.build
++++ b/meson.build
+@@ -35,6 +35,7 @@ has_clockid = cc.has_member('struct perf_event_attr', 'clockid', prefix: '#inclu
+ if has_use_clockid and has_clockid
+   config_h.set10('HAVE_PERF_CLOCKID', true)
+ endif
++config_h.set('VOID_P_SIZE', cc.sizeof('void*'))
+ 
+ add_global_arguments([
+   '-DHAVE_CONFIG_H',
diff --git a/meta/recipes-kernel/sysprof/sysprof_3.30.0.bb b/meta/recipes-kernel/sysprof/sysprof_3.30.0.bb
index 4f1b75017d2..7783ab27f50 100644
--- a/meta/recipes-kernel/sysprof/sysprof_3.30.0.bb
+++ b/meta/recipes-kernel/sysprof/sysprof_3.30.0.bb
@@ -14,6 +14,7 @@ SRC_URI[archive.sha256sum] = "29cd2c4be277f00698dce48259219557c4fddc2c01254b8fac
 SRC_URI += " \
            file://define-NT_GNU_BUILD_ID.patch \
            file://0001-Do-not-build-anything-in-help-as-it-requires-itstool.patch \
+           file://wordsize.patch \
            "
 RECIPE_NO_UPDATE_REASON = "Waiting for resolution of https://bugzilla.gnome.org/show_bug.cgi?id=794625"
 
-- 
2.11.0



             reply	other threads:[~2018-09-07  1:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-07  1:00 Ross Burton [this message]
2018-09-07  1:35 ` ✗ patchtest: failure for sysprof: fix build with musl Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180907010032.18028-1-ross.burton@intel.com \
    --to=ross.burton@intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox