diff mbox series

[oe,meta-oe] mongodb: Fix build on musl/aarch64

Message ID 20190924013332.2305173-1-raj.khem@gmail.com
State New
Headers show
Series [oe,meta-oe] mongodb: Fix build on musl/aarch64 | expand

Commit Message

Khem Raj Sept. 24, 2019, 1:33 a.m. UTC
one impl of strerror_r is glibc specific, therefore check for __GLIBC__
also before using it

Signed-off-by: Khem Raj <raj.khem@gmail.com>

---
 ...rror_r-implementation-glibc-specific.patch | 31 +++++++++++++++++++
 .../mongodb/0003-fix-musl-strerror_r.patch    | 30 ------------------
 meta-oe/recipes-dbs/mongodb/mongodb_git.bb    |  2 +-
 3 files changed, 32 insertions(+), 31 deletions(-)
 create mode 100644 meta-oe/recipes-dbs/mongodb/mongodb/0001-Mark-one-of-strerror_r-implementation-glibc-specific.patch
 delete mode 100644 meta-oe/recipes-dbs/mongodb/mongodb/0003-fix-musl-strerror_r.patch

-- 
2.23.0

-- 
_______________________________________________
Openembedded-devel mailing list
Openembedded-devel@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
diff mbox series

Patch

diff --git a/meta-oe/recipes-dbs/mongodb/mongodb/0001-Mark-one-of-strerror_r-implementation-glibc-specific.patch b/meta-oe/recipes-dbs/mongodb/mongodb/0001-Mark-one-of-strerror_r-implementation-glibc-specific.patch
new file mode 100644
index 0000000000..5337fcdbfd
--- /dev/null
+++ b/meta-oe/recipes-dbs/mongodb/mongodb/0001-Mark-one-of-strerror_r-implementation-glibc-specific.patch
@@ -0,0 +1,31 @@ 
+From ca004968b8d2149f72d4edcfe029489a8c5e10ca Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 23 Sep 2019 12:31:31 -0700
+Subject: [PATCH] Mark one of strerror_r implementation glibc specific
+
+glibc has two incompatible strerror_r definitions, one of them is
+specific to glibc, mark this one so
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/mongo/util/errno_util.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/mongo/util/errno_util.cpp b/src/mongo/util/errno_util.cpp
+index 564c0071ea..4f7e1d3a38 100644
+--- a/src/mongo/util/errno_util.cpp
++++ b/src/mongo/util/errno_util.cpp
+@@ -61,7 +61,7 @@ std::string errnoWithDescription(int errNumber) {
+     char buf[kBuflen];
+     char* msg{nullptr};
+ 
+-#if defined(__GNUC__) && defined(_GNU_SOURCE) && \
++#if defined(__GNUC__) && defined(_GNU_SOURCE) && defined(__GLIBC__) && \
+     (!defined(__ANDROID_API__) || !(__ANDROID_API__ <= 22)) && !defined(EMSCRIPTEN)
+     msg = strerror_r(errNumber, buf, kBuflen);
+ #elif defined(_WIN32)
+-- 
+2.23.0
+
diff --git a/meta-oe/recipes-dbs/mongodb/mongodb/0003-fix-musl-strerror_r.patch b/meta-oe/recipes-dbs/mongodb/mongodb/0003-fix-musl-strerror_r.patch
deleted file mode 100644
index c6035894ed..0000000000
--- a/meta-oe/recipes-dbs/mongodb/mongodb/0003-fix-musl-strerror_r.patch
+++ /dev/null
@@ -1,30 +0,0 @@ 
-Index: git/src/mongo/util/errno_util.cpp
-===================================================================
---- git.orig/src/mongo/util/errno_util.cpp
-+++ git/src/mongo/util/errno_util.cpp
-@@ -49,6 +49,16 @@ const char kUnknownMsg[] = "Unknown erro
- const int kBuflen = 256;  // strerror strings in non-English locales can be large.
- }  // namespace
- 
-+inline char const * strerror_r_helper( char const * r, char const * )
-+{
-+    return r;
-+}
-+
-+inline char const * strerror_r_helper( int r, char const * buffer )
-+{
-+    return r == 0? buffer: "Unknown error";
-+}
-+
- std::string errnoWithDescription(int errNumber) {
- #if defined(_WIN32)
-     if (errNumber == -1)
-@@ -63,7 +73,7 @@ std::string errnoWithDescription(int err
- 
- #if defined(__GNUC__) && defined(_GNU_SOURCE) && \
-     (!defined(__ANDROID_API__) || !(__ANDROID_API__ <= 22)) && !defined(EMSCRIPTEN)
--    msg = strerror_r(errNumber, buf, kBuflen);
-+    msg = strerror_r_helper(strerror_r(errNumber, buf, kBuflen));
- #elif defined(_WIN32)
- 
-     LPWSTR errorText = nullptr;
diff --git a/meta-oe/recipes-dbs/mongodb/mongodb_git.bb b/meta-oe/recipes-dbs/mongodb/mongodb_git.bb
index d3c19d6c4c..3e77ac32f3 100644
--- a/meta-oe/recipes-dbs/mongodb/mongodb_git.bb
+++ b/meta-oe/recipes-dbs/mongodb/mongodb_git.bb
@@ -25,8 +25,8 @@  SRC_URI = "git://github.com/mongodb/mongo.git;branch=v4.2 \
            file://0003-Fix-unknown-prefix-env.patch \
            "
 SRC_URI_append_libc-musl ="\
+           file://0001-Mark-one-of-strerror_r-implementation-glibc-specific.patch \
            file://0002-Fix-default-stack-size-to-256K.patch \
-           file://0003-fix-musl-strerror_r.patch \
            file://0004-wiredtiger-Disable-strtouq-on-musl.patch \
            "