Skip to contentSkip to conversation

gperftools: Fix build with musl

PATCH New Khem Raj 1 participant 2 messages Sep 2, 2017

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/2 gperftools: Fix build with musl

---
 ...heap-checkers-and-debug-allocator-on-musl.patch | 25 ++++++++++++++++++++++
 .../gperftools/disable_libunwind_aarch64.patch     | 23 ++++++++++++++++++++
 .../recipes-support/gperftools/gperftools_2.6.1.bb |  4 ++--
 3 files changed, 50 insertions(+), 2 deletions(-)
 create mode 100644 meta-oe/recipes-support/gperftools/gperftools/0001-disbale-heap-checkers-and-debug-allocator-on-musl.patch
 create mode 100644 meta-oe/recipes-support/gperftools/gperftools/disable_libunwind_aarch64.patch
meta-oe/recipes-support/gperftools/gperftools/0001-disbale-heap-checkers-and-debug-allocator-on-musl.patch new file +25 -0
new file mode 100644
index 000000000..99127e11a
@@ -0,0 +1,25 @@
+From b5961f17e9d7f2bc44da611b3e4b27c8a641fc72 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sat, 2 Sep 2017 08:07:17 -0700
+Subject: [PATCH] disbale heap checkers and debug allocator on musl
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+Upstream-Status: Pending
+
+ configure.ac | 2 ++
+ 1 file changed, 2 insertions(+)
+
+Index: git/configure.ac
+===================================================================
+--- git.orig/configure.ac
++++ git/configure.ac
+@@ -51,6 +51,8 @@ case "$host" in
+    *-cygwin*) default_enable_heap_checker=no; default_enable_cpu_profiler=no;;
+    *-freebsd*) default_enable_heap_checker=no;;
+    *-darwin*) default_enable_heap_checker=no;;
++   *-musl*) default_enable_heap_checker=no; default_enable_heap_profiler=no;
++            default_enable_debugalloc=no; default_enable_libunwind=no;
+ esac
+ 
+ # Currently only backtrace works on s390.
meta-oe/recipes-support/gperftools/gperftools/disable_libunwind_aarch64.patch new file +23 -0
new file mode 100644
index 000000000..f2647404b
@@ -0,0 +1,23 @@
+Disable libunwind on aarch64
+
+Fixes hangs when using libtcmalloc.so
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+
+Index: git/configure.ac
+===================================================================
+--- git.orig/configure.ac
++++ git/configure.ac
+@@ -69,6 +69,11 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [re
+                   [default_enable_libunwind=yes
+                    default_tcmalloc_pagesize=8])
+ 
++# Disable libunwind linking on aarch64 by default.
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [return __aarch64__])],
++                  [default_enable_libunwind=no],
++                  [default_enable_libunwind=yes])
++
+ AC_ARG_ENABLE([cpu-profiler],
+               [AS_HELP_STRING([--disable-cpu-profiler],
+                               [do not build the cpu profiler])],
meta-oe/recipes-support/gperftools/gperftools_2.6.1.bb +2 -2
index ece9dd9e8..23284670b 100644
@@ -10,6 +10,8 @@ SRC_URI = "git://github.com/gperftools/gperftools \
            file://0001-Use-ucontext_t-instead-of-struct-ucontext.patch \
            file://0001-fix-build-with-musl-libc.patch \
            file://0001-include-fcntl.h-for-loff_t-definition.patch \
+           file://0001-disbale-heap-checkers-and-debug-allocator-on-musl.patch \
+           file://disable_libunwind_aarch64.patch \
            "
 
 inherit autotools
@@ -20,8 +22,6 @@ S = "${WORKDIR}/git"
 #   do_page_fault(): sending SIGSEGV to ls for invalid read access from 00000008
 #   Segmentation fault (core dumped)
 COMPATIBLE_HOST = "(i.86|x86_64|powerpc|powerpc64|arm|aarch64).*-linux*"
-# On aarch64, add this option to avoid system hanging when using libtcmalloc.so.
-EXTRA_OECONF_aarch64 += "--disable-libunwind"
 # Disable thumb1
 # {standard input}: Assembler messages:
 # {standard input}:434: Error: lo register required -- `ldr pc,[sp]'
Signature · 1 line
2.14.1
author
#1 lore raw

PATCH 2/2 mongodb: Disable for armv7

32bit arm is not supported
Add patches to compile with musl

---
 ...__-to-control-use-of-gnu_get_libc_version.patch | 50 ++++++++++++++++
 .../0001-Use-long-long-instead-of-int64_t.patch    | 67 ++++++++++++++++++++++
 meta-oe/recipes-support/mongodb/mongodb_git.bb     |  8 +++
 3 files changed, 125 insertions(+)
 create mode 100644 meta-oe/recipes-support/mongodb/mongodb/0001-Use-__GLIBC__-to-control-use-of-gnu_get_libc_version.patch
 create mode 100644 meta-oe/recipes-support/mongodb/mongodb/0001-Use-long-long-instead-of-int64_t.patch
meta-oe/recipes-support/mongodb/mongodb/0001-Use-__GLIBC__-to-control-use-of-gnu_get_libc_version.patch new file +50 -0
new file mode 100644
index 000000000..f8c419d8a
@@ -0,0 +1,50 @@
+From 3eed8388b49d5d3cbc2db74fee1b017eb4b40d0a Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sat, 2 Sep 2017 10:06:24 -0700
+Subject: [PATCH] Use __GLIBC__ to control use of gnu_get_libc_version
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+Upstream-Status: Pending
+ src/mongo/util/processinfo_linux.cpp | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/src/mongo/util/processinfo_linux.cpp b/src/mongo/util/processinfo_linux.cpp
+index 910015215e..bf8c1ffd15 100644
+--- a/src/mongo/util/processinfo_linux.cpp
++++ b/src/mongo/util/processinfo_linux.cpp
+@@ -40,7 +40,7 @@
+ #include <sys/mman.h>
+ #include <sys/utsname.h>
+ #include <unistd.h>
+-#ifdef __UCLIBC__
++#ifndef __GLIBC__
+ #include <features.h>
+ #else
+ #include <gnu/libc-version.h>
+@@ -451,11 +451,13 @@ double ProcessInfo::getSystemMemoryPressurePercentage() {
+ }
+ 
+ void ProcessInfo::getExtraInfo(BSONObjBuilder& info) {
++#if defined(__GLIBC__)
+     LinuxProc p(_pid);
+     if (p._maj_flt <= std::numeric_limits<long long>::max())
+         info.appendNumber("page_faults", static_cast<long long>(p._maj_flt));
+     else
+         info.appendNumber("page_faults", static_cast<double>(p._maj_flt));
++#endif
+ }
+ 
+ /**
+@@ -491,7 +493,7 @@ void ProcessInfo::SystemInfo::collectSystemInfo() {
+     stringstream ss;
+     ss << "uClibc-" << __UCLIBC_MAJOR__ << "." << __UCLIBC_MINOR__ << "." << __UCLIBC_SUBLEVEL__;
+     bExtra.append("libcVersion", ss.str());
+-#else
++#elif defined(__GLIBC__)
+     bExtra.append("libcVersion", gnu_get_libc_version());
+ #endif
+     if (!verSig.empty())
+-- 
+2.14.1
+
meta-oe/recipes-support/mongodb/mongodb/0001-Use-long-long-instead-of-int64_t.patch new file +67 -0

67 lines not on this page · raw message

meta-oe/recipes-support/mongodb/mongodb_git.bb +8 -0
index b38641cff..1f7af2228 100644
@@ -13,6 +13,8 @@ SRC_URI = "git://github.com/mongodb/mongo.git;branch=v3.4 \
            file://0001-Tell-scons-to-use-build-settings-from-environment-va.patch \
            file://0001-mongo-Add-using-std-string.patch \
            file://0002-d_state.cpp-Add-missing-dependenncy-on-local_shardin.patch \
+           file://0001-Use-long-long-instead-of-int64_t.patch \
+           file://0001-Use-__GLIBC__-to-control-use-of-gnu_get_libc_version.patch \
            "
 
 S = "${WORKDIR}/git"
@@ -28,6 +30,8 @@ PACKAGECONFIG_remove_armv6 = "tcmalloc"
 #std::current_exception is undefined for arm < v6
 COMPATIBLE_MACHINE_armv4 = "(!.*armv4).*"
 COMPATIBLE_MACHINE_armv5 = "(!.*armv5).*"
+COMPATIBLE_MACHINE_armv7a = "(!.*armv7a).*"
+COMPATIBLE_MACHINE_armv7ve = "(!.*armv7ve).*"
 COMPATIBLE_MACHINE_mips64 = "(!.*mips64).*"
 COMPATIBLE_MACHINE_powerpc = "(!.*ppc).*"
 
@@ -48,6 +52,10 @@ EXTRA_OESCONS = "--prefix=${D}${prefix} \
                  ${PACKAGECONFIG_CONFARGS} \
                  mongod mongos"
 
+do_configure_prepend() {
+        # tests use hex floats, not supported in plain C++
+        sed -e 's|-std=c++11|-std=gnu++11|g' -i ${S}/SConstruct
+}
 scons_do_compile() {
         ${STAGING_BINDIR_NATIVE}/scons ${PARALLEL_MAKE} ${EXTRA_OESCONS} || \
         die "scons build execution failed."
Signature · 1 line
2.14.1