mongodb: Disable for armv7 and fix build on musl
PATCH v2 2/2 mongodb: Disable for armv7 and fix build on musl
32bit arm is not supported
Add patches to compile with musl
Signed-off-by Khem Raj <[email protected]>
---
Changes from v1->v2:
- Add patches to fix build on x86_64/musl
...__-to-control-use-of-gnu_get_libc_version.patch | 50 ++++++++++++++++ .../0001-Use-long-long-instead-of-int64_t.patch | 67 ++++++++++++++++++++++ ...0001-Use-strerror_r-only-on-glibc-systems.patch | 26 +++++++++ ...finition-for-the-macro-__ELF_NATIVE_CLASS.patch | 35 +++++++++++ ...-Conditionalize-glibc-specific-strerror_r.patch | 39 +++++++++++++ .../0004-wiredtiger-Disable-strtouq-on-musl.patch | 26 +++++++++ meta-oe/recipes-support/mongodb/mongodb_git.bb | 16 +++++- 7 files changed, 258 insertions(+), 1 deletion(-) 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 create mode 100644 meta-oe/recipes-support/mongodb/mongodb/0001-Use-strerror_r-only-on-glibc-systems.patch create mode 100644 meta-oe/recipes-support/mongodb/mongodb/0002-Add-a-definition-for-the-macro-__ELF_NATIVE_CLASS.patch create mode 100644 meta-oe/recipes-support/mongodb/mongodb/0003-Conditionalize-glibc-specific-strerror_r.patch create mode 100644 meta-oe/recipes-support/mongodb/mongodb/0004-wiredtiger-Disable-strtouq-on-musl.patch
meta-oe/recipes-support/mongodb/mongodb/0001-Use-__GLIBC__-to-control-use-of-gnu_get_libc_version.patch new file +50 -0
@@ -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/0001-Use-strerror_r-only-on-glibc-systems.patch new file +26 -0
@@ -0,0 +1,26 @@ +From a4dfc92ff342e59596ab64267a8d4f22f173c23b Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Sat, 2 Sep 2017 12:40:41 -0700 +Subject: [PATCH 1/4] Use strerror_r only on glibc systems + +Signed-off-by: Khem Raj <[email protected]> +--- + src/mongo/util/log.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/mongo/util/log.cpp b/src/mongo/util/log.cpp +index 1957eb4791..ddf3908818 100644 +--- a/src/mongo/util/log.cpp ++++ b/src/mongo/util/log.cpp +@@ -101,7 +101,7 @@ string errnoWithDescription(int errNumber) { + char buf[kBuflen]; + char* msg{nullptr}; + +-#if defined(__GNUC__) && defined(_GNU_SOURCE) ++#if defined(__GNUC__) && defined(_GNU_SOURCE) && defined(__GLIBC__) + msg = strerror_r(errNumber, buf, kBuflen); + #elif defined(_WIN32) + +-- +2.14.1 +
meta-oe/recipes-support/mongodb/mongodb/0002-Add-a-definition-for-the-macro-__ELF_NATIVE_CLASS.patch new file +35 -0
@@ -0,0 +1,35 @@ +From df7ef16afcc6ab55daa686e4f15c16e3d1280337 Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Sat, 2 Sep 2017 12:42:30 -0700 +Subject: [PATCH 2/4] Add a definition for the macro __ELF_NATIVE_CLASS + +It depends on the native arch's word size. + +Signed-off-by: Khem Raj <[email protected]> +--- + src/mongo/util/stacktrace_posix.cpp | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/src/mongo/util/stacktrace_posix.cpp b/src/mongo/util/stacktrace_posix.cpp +index 53ab85f56f..7c458e7ef2 100644 +--- a/src/mongo/util/stacktrace_posix.cpp ++++ b/src/mongo/util/stacktrace_posix.cpp +@@ -37,6 +37,15 @@ + #include <string> + #include <sys/utsname.h> + ++#if !defined(__GLIBC__) ++#if defined __x86_64__ && !defined __ILP32__ ++# define __WORDSIZE 64 ++#else ++# define __WORDSIZE 32 ++#endif ++#define __ELF_NATIVE_CLASS __WORDSIZE ++#endif ++ + #include "mongo/base/init.h" + #include "mongo/config.h" + #include "mongo/db/jsobj.h" +-- +2.14.1 +
meta-oe/recipes-support/mongodb/mongodb/0003-Conditionalize-glibc-specific-strerror_r.patch new file +39 -0
@@ -0,0 +1,39 @@ +From 458f80f482a201b427a1c92235804d0c3f98fd51 Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Sat, 2 Sep 2017 13:01:11 -0700 +Subject: [PATCH 3/4] Conditionalize glibc specific strerror_r + +Signed-off-by: Khem Raj <[email protected]> +--- + .../asio-asio-1-11-0/asio/include/asio/impl/error_code.ipp | 11 ++++------- + 1 file changed, 4 insertions(+), 7 deletions(-) + +diff --git a/src/third_party/asio-asio-1-11-0/asio/include/asio/impl/error_code.ipp b/src/third_party/asio-asio-1-11-0/asio/include/asio/impl/error_code.ipp +index 4e7badb14a..0eeae884e2 100644 +--- a/src/third_party/asio-asio-1-11-0/asio/include/asio/impl/error_code.ipp ++++ b/src/third_party/asio-asio-1-11-0/asio/include/asio/impl/error_code.ipp +@@ -97,17 +97,14 @@ public: + #if defined(__sun) || defined(__QNX__) || defined(__SYMBIAN32__) + using namespace std; + return strerror(value); +-#elif defined(__MACH__) && defined(__APPLE__) \ +- || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) \ +- || defined(_AIX) || defined(__hpux) || defined(__osf__) \ +- || defined(__ANDROID__) ++#elif defined(__GLIBC__) && defined(_GNU_SOURCE) ++ char buf[256] = ""; ++ return strerror_r(value, buf, sizeof(buf)); ++#else + char buf[256] = ""; + using namespace std; + strerror_r(value, buf, sizeof(buf)); + return buf; +-#else +- char buf[256] = ""; +- return strerror_r(value, buf, sizeof(buf)); + #endif + #endif // defined(ASIO_WINDOWS) + } +-- +2.14.1 +
meta-oe/recipes-support/mongodb/mongodb/0004-wiredtiger-Disable-strtouq-on-musl.patch new file +26 -0
@@ -0,0 +1,26 @@ +From a1c77702926eb8546ff96b00b5b994f7478dabae Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Sat, 2 Sep 2017 13:13:15 -0700 +Subject: [PATCH 4/4] wiredtiger: Disable strtouq on musl + +Signed-off-by: Khem Raj <[email protected]> +--- + src/third_party/wiredtiger/build_linux/wiredtiger_config.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/third_party/wiredtiger/build_linux/wiredtiger_config.h b/src/third_party/wiredtiger/build_linux/wiredtiger_config.h +index 1122e1e319..fdfd48687b 100644 +--- a/src/third_party/wiredtiger/build_linux/wiredtiger_config.h ++++ b/src/third_party/wiredtiger/build_linux/wiredtiger_config.h +@@ -101,7 +101,7 @@ + #define HAVE_STRING_H 1 + + /* Define to 1 if you have the `strtouq' function. */ +-#define HAVE_STRTOUQ 1 ++/* #undef HAVE_STRTOUQ 1 */ + + /* Define to 1 if you have the `sync_file_range' function. */ + /* #undef HAVE_SYNC_FILE_RANGE */ +-- +2.14.1 +
meta-oe/recipes-support/mongodb/mongodb_git.bb +15 -1
@@ -13,8 +13,15 @@ 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 \ + file://0001-Use-strerror_r-only-on-glibc-systems.patch \ + file://0002-Add-a-definition-for-the-macro-__ELF_NATIVE_CLASS.patch \ + file://0003-Conditionalize-glibc-specific-strerror_r.patch \ + " +SRC_URI_append_libc-musl ="\ + file://0004-wiredtiger-Disable-strtouq-on-musl.patch \ " - S = "${WORKDIR}/git" # Wiredtiger supports only 64-bit platforms
@@ -24,10 +31,13 @@ PACKAGECONFIG ??= "tcmalloc" # gperftools compilation fails for arm below v7 because of missing support of # dmb operation. So we use system-allocator instead of tcmalloc PACKAGECONFIG_remove_armv6 = "tcmalloc" +PACKAGECONFIG_remove_libc-musl = "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 +58,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