diff options
| author | Khem Raj <raj.khem@gmail.com> | 2017-09-02 13:29:49 -0700 |
|---|---|---|
| committer | Martin Jansa <Martin.Jansa@gmail.com> | 2017-09-07 10:57:37 +0200 |
| commit | ca31d48634990a525d038107797820c1eaef3c44 (patch) | |
| tree | 0bb41c6c9a924cf088a41272bd997df310ec78e2 | |
| parent | e70416c59b4c66eed558578f00cd22a3437888d6 (diff) | |
| download | meta-openembedded-ca31d48634990a525d038107797820c1eaef3c44.tar.gz | |
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 <raj.khem@gmail.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
7 files changed, 258 insertions, 1 deletions
diff --git a/meta-oe/recipes-support/mongodb/mongodb/0001-Use-__GLIBC__-to-control-use-of-gnu_get_libc_version.patch b/meta-oe/recipes-support/mongodb/mongodb/0001-Use-__GLIBC__-to-control-use-of-gnu_get_libc_version.patch new file mode 100644 index 0000000000..f8c419d8a3 --- /dev/null +++ b/meta-oe/recipes-support/mongodb/mongodb/0001-Use-__GLIBC__-to-control-use-of-gnu_get_libc_version.patch | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | From 3eed8388b49d5d3cbc2db74fee1b017eb4b40d0a Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Sat, 2 Sep 2017 10:06:24 -0700 | ||
| 4 | Subject: [PATCH] Use __GLIBC__ to control use of gnu_get_libc_version | ||
| 5 | |||
| 6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 7 | --- | ||
| 8 | Upstream-Status: Pending | ||
| 9 | src/mongo/util/processinfo_linux.cpp | 6 ++++-- | ||
| 10 | 1 file changed, 4 insertions(+), 2 deletions(-) | ||
| 11 | |||
| 12 | diff --git a/src/mongo/util/processinfo_linux.cpp b/src/mongo/util/processinfo_linux.cpp | ||
| 13 | index 910015215e..bf8c1ffd15 100644 | ||
| 14 | --- a/src/mongo/util/processinfo_linux.cpp | ||
| 15 | +++ b/src/mongo/util/processinfo_linux.cpp | ||
| 16 | @@ -40,7 +40,7 @@ | ||
| 17 | #include <sys/mman.h> | ||
| 18 | #include <sys/utsname.h> | ||
| 19 | #include <unistd.h> | ||
| 20 | -#ifdef __UCLIBC__ | ||
| 21 | +#ifndef __GLIBC__ | ||
| 22 | #include <features.h> | ||
| 23 | #else | ||
| 24 | #include <gnu/libc-version.h> | ||
| 25 | @@ -451,11 +451,13 @@ double ProcessInfo::getSystemMemoryPressurePercentage() { | ||
| 26 | } | ||
| 27 | |||
| 28 | void ProcessInfo::getExtraInfo(BSONObjBuilder& info) { | ||
| 29 | +#if defined(__GLIBC__) | ||
| 30 | LinuxProc p(_pid); | ||
| 31 | if (p._maj_flt <= std::numeric_limits<long long>::max()) | ||
| 32 | info.appendNumber("page_faults", static_cast<long long>(p._maj_flt)); | ||
| 33 | else | ||
| 34 | info.appendNumber("page_faults", static_cast<double>(p._maj_flt)); | ||
| 35 | +#endif | ||
| 36 | } | ||
| 37 | |||
| 38 | /** | ||
| 39 | @@ -491,7 +493,7 @@ void ProcessInfo::SystemInfo::collectSystemInfo() { | ||
| 40 | stringstream ss; | ||
| 41 | ss << "uClibc-" << __UCLIBC_MAJOR__ << "." << __UCLIBC_MINOR__ << "." << __UCLIBC_SUBLEVEL__; | ||
| 42 | bExtra.append("libcVersion", ss.str()); | ||
| 43 | -#else | ||
| 44 | +#elif defined(__GLIBC__) | ||
| 45 | bExtra.append("libcVersion", gnu_get_libc_version()); | ||
| 46 | #endif | ||
| 47 | if (!verSig.empty()) | ||
| 48 | -- | ||
| 49 | 2.14.1 | ||
| 50 | |||
diff --git a/meta-oe/recipes-support/mongodb/mongodb/0001-Use-long-long-instead-of-int64_t.patch b/meta-oe/recipes-support/mongodb/mongodb/0001-Use-long-long-instead-of-int64_t.patch new file mode 100644 index 0000000000..c43beb4c12 --- /dev/null +++ b/meta-oe/recipes-support/mongodb/mongodb/0001-Use-long-long-instead-of-int64_t.patch | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | From a4951489d649c2b609cbb80f6cfb49fdcad8bd43 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Sat, 2 Sep 2017 10:03:37 -0700 | ||
| 4 | Subject: [PATCH] Use long long instead of int64_t | ||
| 5 | |||
| 6 | Fixes | ||
| 7 | error: call to member function 'appendNumber' is ambiguous | ||
| 8 | since this function expects long long as parameter and not int64_t | ||
| 9 | |||
| 10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 11 | --- | ||
| 12 | Upstream-Status: Pending | ||
| 13 | src/mongo/util/procparser.cpp | 10 +++++----- | ||
| 14 | 1 file changed, 5 insertions(+), 5 deletions(-) | ||
| 15 | |||
| 16 | diff --git a/src/mongo/util/procparser.cpp b/src/mongo/util/procparser.cpp | ||
| 17 | index 36f2ae0254..2c164bcbf3 100644 | ||
| 18 | --- a/src/mongo/util/procparser.cpp | ||
| 19 | +++ b/src/mongo/util/procparser.cpp | ||
| 20 | @@ -260,7 +260,7 @@ Status parseProcStat(const std::vector<StringData>& keys, | ||
| 21 | |||
| 22 | StringData stringValue((*partIt).begin(), (*partIt).end() - (*partIt).begin()); | ||
| 23 | |||
| 24 | - uint64_t value; | ||
| 25 | + long long value; | ||
| 26 | |||
| 27 | if (!parseNumberFromString(stringValue, &value).isOK()) { | ||
| 28 | value = 0; | ||
| 29 | @@ -272,7 +272,7 @@ Status parseProcStat(const std::vector<StringData>& keys, | ||
| 30 | } else { | ||
| 31 | StringData stringValue((*partIt).begin(), (*partIt).end() - (*partIt).begin()); | ||
| 32 | |||
| 33 | - uint64_t value; | ||
| 34 | + long long value; | ||
| 35 | |||
| 36 | if (!parseNumberFromString(stringValue, &value).isOK()) { | ||
| 37 | value = 0; | ||
| 38 | @@ -365,7 +365,7 @@ Status parseProcMemInfo(const std::vector<StringData>& keys, | ||
| 39 | |||
| 40 | StringData stringValue((*partIt).begin(), (*partIt).end()); | ||
| 41 | |||
| 42 | - uint64_t value; | ||
| 43 | + long long value; | ||
| 44 | |||
| 45 | if (!parseNumberFromString(stringValue, &value).isOK()) { | ||
| 46 | value = 0; | ||
| 47 | @@ -426,7 +426,7 @@ Status parseProcDiskStats(const std::vector<StringData>& disks, | ||
| 48 | StringData data, | ||
| 49 | BSONObjBuilder* builder) { | ||
| 50 | bool foundKeys = false; | ||
| 51 | - std::vector<uint64_t> stats; | ||
| 52 | + std::vector<long long> stats; | ||
| 53 | stats.reserve(kDiskFieldCount); | ||
| 54 | |||
| 55 | using string_split_iterator = boost::split_iterator<StringData::const_iterator>; | ||
| 56 | @@ -501,7 +501,7 @@ Status parseProcDiskStats(const std::vector<StringData>& disks, | ||
| 57 | |||
| 58 | StringData stringValue((*partIt).begin(), (*partIt).end()); | ||
| 59 | |||
| 60 | - uint64_t value; | ||
| 61 | + long long value; | ||
| 62 | |||
| 63 | if (!parseNumberFromString(stringValue, &value).isOK()) { | ||
| 64 | value = 0; | ||
| 65 | -- | ||
| 66 | 2.14.1 | ||
| 67 | |||
diff --git a/meta-oe/recipes-support/mongodb/mongodb/0001-Use-strerror_r-only-on-glibc-systems.patch b/meta-oe/recipes-support/mongodb/mongodb/0001-Use-strerror_r-only-on-glibc-systems.patch new file mode 100644 index 0000000000..0334d994e4 --- /dev/null +++ b/meta-oe/recipes-support/mongodb/mongodb/0001-Use-strerror_r-only-on-glibc-systems.patch | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | From a4dfc92ff342e59596ab64267a8d4f22f173c23b Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Sat, 2 Sep 2017 12:40:41 -0700 | ||
| 4 | Subject: [PATCH 1/4] Use strerror_r only on glibc systems | ||
| 5 | |||
| 6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 7 | --- | ||
| 8 | src/mongo/util/log.cpp | 2 +- | ||
| 9 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 10 | |||
| 11 | diff --git a/src/mongo/util/log.cpp b/src/mongo/util/log.cpp | ||
| 12 | index 1957eb4791..ddf3908818 100644 | ||
| 13 | --- a/src/mongo/util/log.cpp | ||
| 14 | +++ b/src/mongo/util/log.cpp | ||
| 15 | @@ -101,7 +101,7 @@ string errnoWithDescription(int errNumber) { | ||
| 16 | char buf[kBuflen]; | ||
| 17 | char* msg{nullptr}; | ||
| 18 | |||
| 19 | -#if defined(__GNUC__) && defined(_GNU_SOURCE) | ||
| 20 | +#if defined(__GNUC__) && defined(_GNU_SOURCE) && defined(__GLIBC__) | ||
| 21 | msg = strerror_r(errNumber, buf, kBuflen); | ||
| 22 | #elif defined(_WIN32) | ||
| 23 | |||
| 24 | -- | ||
| 25 | 2.14.1 | ||
| 26 | |||
diff --git a/meta-oe/recipes-support/mongodb/mongodb/0002-Add-a-definition-for-the-macro-__ELF_NATIVE_CLASS.patch b/meta-oe/recipes-support/mongodb/mongodb/0002-Add-a-definition-for-the-macro-__ELF_NATIVE_CLASS.patch new file mode 100644 index 0000000000..098306f500 --- /dev/null +++ b/meta-oe/recipes-support/mongodb/mongodb/0002-Add-a-definition-for-the-macro-__ELF_NATIVE_CLASS.patch | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | From df7ef16afcc6ab55daa686e4f15c16e3d1280337 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Sat, 2 Sep 2017 12:42:30 -0700 | ||
| 4 | Subject: [PATCH 2/4] Add a definition for the macro __ELF_NATIVE_CLASS | ||
| 5 | |||
| 6 | It depends on the native arch's word size. | ||
| 7 | |||
| 8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 9 | --- | ||
| 10 | src/mongo/util/stacktrace_posix.cpp | 9 +++++++++ | ||
| 11 | 1 file changed, 9 insertions(+) | ||
| 12 | |||
| 13 | diff --git a/src/mongo/util/stacktrace_posix.cpp b/src/mongo/util/stacktrace_posix.cpp | ||
| 14 | index 53ab85f56f..7c458e7ef2 100644 | ||
| 15 | --- a/src/mongo/util/stacktrace_posix.cpp | ||
| 16 | +++ b/src/mongo/util/stacktrace_posix.cpp | ||
| 17 | @@ -37,6 +37,15 @@ | ||
| 18 | #include <string> | ||
| 19 | #include <sys/utsname.h> | ||
| 20 | |||
| 21 | +#if !defined(__GLIBC__) | ||
| 22 | +#if defined __x86_64__ && !defined __ILP32__ | ||
| 23 | +# define __WORDSIZE 64 | ||
| 24 | +#else | ||
| 25 | +# define __WORDSIZE 32 | ||
| 26 | +#endif | ||
| 27 | +#define __ELF_NATIVE_CLASS __WORDSIZE | ||
| 28 | +#endif | ||
| 29 | + | ||
| 30 | #include "mongo/base/init.h" | ||
| 31 | #include "mongo/config.h" | ||
| 32 | #include "mongo/db/jsobj.h" | ||
| 33 | -- | ||
| 34 | 2.14.1 | ||
| 35 | |||
diff --git a/meta-oe/recipes-support/mongodb/mongodb/0003-Conditionalize-glibc-specific-strerror_r.patch b/meta-oe/recipes-support/mongodb/mongodb/0003-Conditionalize-glibc-specific-strerror_r.patch new file mode 100644 index 0000000000..1591f94c96 --- /dev/null +++ b/meta-oe/recipes-support/mongodb/mongodb/0003-Conditionalize-glibc-specific-strerror_r.patch | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | From 458f80f482a201b427a1c92235804d0c3f98fd51 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Sat, 2 Sep 2017 13:01:11 -0700 | ||
| 4 | Subject: [PATCH 3/4] Conditionalize glibc specific strerror_r | ||
| 5 | |||
| 6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 7 | --- | ||
| 8 | .../asio-asio-1-11-0/asio/include/asio/impl/error_code.ipp | 11 ++++------- | ||
| 9 | 1 file changed, 4 insertions(+), 7 deletions(-) | ||
| 10 | |||
| 11 | 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 | ||
| 12 | index 4e7badb14a..0eeae884e2 100644 | ||
| 13 | --- a/src/third_party/asio-asio-1-11-0/asio/include/asio/impl/error_code.ipp | ||
| 14 | +++ b/src/third_party/asio-asio-1-11-0/asio/include/asio/impl/error_code.ipp | ||
| 15 | @@ -97,17 +97,14 @@ public: | ||
| 16 | #if defined(__sun) || defined(__QNX__) || defined(__SYMBIAN32__) | ||
| 17 | using namespace std; | ||
| 18 | return strerror(value); | ||
| 19 | -#elif defined(__MACH__) && defined(__APPLE__) \ | ||
| 20 | - || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) \ | ||
| 21 | - || defined(_AIX) || defined(__hpux) || defined(__osf__) \ | ||
| 22 | - || defined(__ANDROID__) | ||
| 23 | +#elif defined(__GLIBC__) && defined(_GNU_SOURCE) | ||
| 24 | + char buf[256] = ""; | ||
| 25 | + return strerror_r(value, buf, sizeof(buf)); | ||
| 26 | +#else | ||
| 27 | char buf[256] = ""; | ||
| 28 | using namespace std; | ||
| 29 | strerror_r(value, buf, sizeof(buf)); | ||
| 30 | return buf; | ||
| 31 | -#else | ||
| 32 | - char buf[256] = ""; | ||
| 33 | - return strerror_r(value, buf, sizeof(buf)); | ||
| 34 | #endif | ||
| 35 | #endif // defined(ASIO_WINDOWS) | ||
| 36 | } | ||
| 37 | -- | ||
| 38 | 2.14.1 | ||
| 39 | |||
diff --git a/meta-oe/recipes-support/mongodb/mongodb/0004-wiredtiger-Disable-strtouq-on-musl.patch b/meta-oe/recipes-support/mongodb/mongodb/0004-wiredtiger-Disable-strtouq-on-musl.patch new file mode 100644 index 0000000000..e871f2ba90 --- /dev/null +++ b/meta-oe/recipes-support/mongodb/mongodb/0004-wiredtiger-Disable-strtouq-on-musl.patch | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | From a1c77702926eb8546ff96b00b5b994f7478dabae Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Sat, 2 Sep 2017 13:13:15 -0700 | ||
| 4 | Subject: [PATCH 4/4] wiredtiger: Disable strtouq on musl | ||
| 5 | |||
| 6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 7 | --- | ||
| 8 | src/third_party/wiredtiger/build_linux/wiredtiger_config.h | 2 +- | ||
| 9 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 10 | |||
| 11 | diff --git a/src/third_party/wiredtiger/build_linux/wiredtiger_config.h b/src/third_party/wiredtiger/build_linux/wiredtiger_config.h | ||
| 12 | index 1122e1e319..fdfd48687b 100644 | ||
| 13 | --- a/src/third_party/wiredtiger/build_linux/wiredtiger_config.h | ||
| 14 | +++ b/src/third_party/wiredtiger/build_linux/wiredtiger_config.h | ||
| 15 | @@ -101,7 +101,7 @@ | ||
| 16 | #define HAVE_STRING_H 1 | ||
| 17 | |||
| 18 | /* Define to 1 if you have the `strtouq' function. */ | ||
| 19 | -#define HAVE_STRTOUQ 1 | ||
| 20 | +/* #undef HAVE_STRTOUQ 1 */ | ||
| 21 | |||
| 22 | /* Define to 1 if you have the `sync_file_range' function. */ | ||
| 23 | /* #undef HAVE_SYNC_FILE_RANGE */ | ||
| 24 | -- | ||
| 25 | 2.14.1 | ||
| 26 | |||
diff --git a/meta-oe/recipes-support/mongodb/mongodb_git.bb b/meta-oe/recipes-support/mongodb/mongodb_git.bb index b38641cff0..547f608509 100644 --- a/meta-oe/recipes-support/mongodb/mongodb_git.bb +++ b/meta-oe/recipes-support/mongodb/mongodb_git.bb | |||
| @@ -13,8 +13,15 @@ SRC_URI = "git://github.com/mongodb/mongo.git;branch=v3.4 \ | |||
| 13 | file://0001-Tell-scons-to-use-build-settings-from-environment-va.patch \ | 13 | file://0001-Tell-scons-to-use-build-settings-from-environment-va.patch \ |
| 14 | file://0001-mongo-Add-using-std-string.patch \ | 14 | file://0001-mongo-Add-using-std-string.patch \ |
| 15 | file://0002-d_state.cpp-Add-missing-dependenncy-on-local_shardin.patch \ | 15 | file://0002-d_state.cpp-Add-missing-dependenncy-on-local_shardin.patch \ |
| 16 | file://0001-Use-long-long-instead-of-int64_t.patch \ | ||
| 17 | file://0001-Use-__GLIBC__-to-control-use-of-gnu_get_libc_version.patch \ | ||
| 18 | file://0001-Use-strerror_r-only-on-glibc-systems.patch \ | ||
| 19 | file://0002-Add-a-definition-for-the-macro-__ELF_NATIVE_CLASS.patch \ | ||
| 20 | file://0003-Conditionalize-glibc-specific-strerror_r.patch \ | ||
| 21 | " | ||
| 22 | SRC_URI_append_libc-musl ="\ | ||
| 23 | file://0004-wiredtiger-Disable-strtouq-on-musl.patch \ | ||
| 16 | " | 24 | " |
| 17 | |||
| 18 | S = "${WORKDIR}/git" | 25 | S = "${WORKDIR}/git" |
| 19 | 26 | ||
| 20 | # Wiredtiger supports only 64-bit platforms | 27 | # Wiredtiger supports only 64-bit platforms |
| @@ -24,10 +31,13 @@ PACKAGECONFIG ??= "tcmalloc" | |||
| 24 | # gperftools compilation fails for arm below v7 because of missing support of | 31 | # gperftools compilation fails for arm below v7 because of missing support of |
| 25 | # dmb operation. So we use system-allocator instead of tcmalloc | 32 | # dmb operation. So we use system-allocator instead of tcmalloc |
| 26 | PACKAGECONFIG_remove_armv6 = "tcmalloc" | 33 | PACKAGECONFIG_remove_armv6 = "tcmalloc" |
| 34 | PACKAGECONFIG_remove_libc-musl = "tcmalloc" | ||
| 27 | 35 | ||
| 28 | #std::current_exception is undefined for arm < v6 | 36 | #std::current_exception is undefined for arm < v6 |
| 29 | COMPATIBLE_MACHINE_armv4 = "(!.*armv4).*" | 37 | COMPATIBLE_MACHINE_armv4 = "(!.*armv4).*" |
| 30 | COMPATIBLE_MACHINE_armv5 = "(!.*armv5).*" | 38 | COMPATIBLE_MACHINE_armv5 = "(!.*armv5).*" |
| 39 | COMPATIBLE_MACHINE_armv7a = "(!.*armv7a).*" | ||
| 40 | COMPATIBLE_MACHINE_armv7ve = "(!.*armv7ve).*" | ||
| 31 | COMPATIBLE_MACHINE_mips64 = "(!.*mips64).*" | 41 | COMPATIBLE_MACHINE_mips64 = "(!.*mips64).*" |
| 32 | COMPATIBLE_MACHINE_powerpc = "(!.*ppc).*" | 42 | COMPATIBLE_MACHINE_powerpc = "(!.*ppc).*" |
| 33 | 43 | ||
| @@ -48,6 +58,10 @@ EXTRA_OESCONS = "--prefix=${D}${prefix} \ | |||
| 48 | ${PACKAGECONFIG_CONFARGS} \ | 58 | ${PACKAGECONFIG_CONFARGS} \ |
| 49 | mongod mongos" | 59 | mongod mongos" |
| 50 | 60 | ||
| 61 | do_configure_prepend() { | ||
| 62 | # tests use hex floats, not supported in plain C++ | ||
| 63 | sed -e 's|-std=c++11|-std=gnu++11|g' -i ${S}/SConstruct | ||
| 64 | } | ||
| 51 | scons_do_compile() { | 65 | scons_do_compile() { |
| 52 | ${STAGING_BINDIR_NATIVE}/scons ${PARALLEL_MAKE} ${EXTRA_OESCONS} || \ | 66 | ${STAGING_BINDIR_NATIVE}/scons ${PARALLEL_MAKE} ${EXTRA_OESCONS} || \ |
| 53 | die "scons build execution failed." | 67 | die "scons build execution failed." |
