Skip to contentSkip to conversation

spdlog: Do not use LFS64 functions with musl

PATCH New Khem Raj 1 participant 2 messages Dec 31, 2022

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/2 spdlog: Do not use LFS64 functions with musl

---
 ...ot-use-LFS64-functions-on-linux-musl.patch | 30 +++++++++++++++++++
 .../recipes-support/spdlog/spdlog_1.11.0.bb   |  4 ++-
 2 files changed, 33 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-support/spdlog/spdlog/0001-Do-not-use-LFS64-functions-on-linux-musl.patch
meta-oe/recipes-support/spdlog/spdlog/0001-Do-not-use-LFS64-functions-on-linux-musl.patch new file +30 -0
new file mode 100644
index 0000000000..b997389aa2
@@ -0,0 +1,30 @@
+From ce7a593e74c8e0c2ece15c73e7614d4f13a19a53 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Fri, 30 Dec 2022 13:04:08 -0800
+Subject: [PATCH] Do not use LFS64 functions on linux/musl
+
+On musl, off_t is 64bit always ( even on 32bit platforms ), therefore using
+LFS64 funcitons is not needed on such platforms. Moreover, musl has stopped
+providing aliases for these functions [1] which means it wont compile on
+newer musl systems. Therefore only use it on 32bit glibc/linux platforms
+and exclude musl like cygwin or OSX
+
+[1] https://git.musl-libc.org/cgit/musl/commit/?id=246f1c811448f37a44b41cd8df8d0ef9736d95f4
+
+Upstream-Status: Submitted [https://github.com/gabime/spdlog/pull/2589]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ include/spdlog/details/os.h | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/include/spdlog/details/os-inl.h
++++ b/include/spdlog/details/os-inl.h
+@@ -237,7 +237,7 @@ SPDLOG_INLINE size_t filesize(FILE *f)
+     int fd = ::fileno(f);
+ #    endif
+ // 64 bits(but not in osx or cygwin, where fstat64 is deprecated)
+-#    if (defined(__linux__) || defined(__sun) || defined(_AIX)) && (defined(__LP64__) || defined(_LP64))
++#    if ((defined(__linux__) && defined(__GLIBC__)) || defined(__sun) || defined(_AIX)) && (defined(__LP64__) || defined(_LP64))
+     struct stat64 st;
+     if (::fstat64(fd, &st) == 0)
+     {
meta-oe/recipes-support/spdlog/spdlog_1.11.0.bb +3 -1
index 2c71331ffa..ec985fb039 100644
@@ -4,7 +4,9 @@ LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
 
 SRCREV = "ad0e89cbfb4d0c1ce4d097e134eb7be67baebb36"
-SRC_URI = "git://github.com/gabime/spdlog.git;protocol=https;branch=v1.x"
+SRC_URI = "git://github.com/gabime/spdlog.git;protocol=https;branch=v1.x \
+           file://0001-Do-not-use-LFS64-functions-on-linux-musl.patch \
+           "
 
 DEPENDS += "fmt"
 
Signature · 1 line
2.39.0
author
#1 lore raw

PATCH 2/2 mongodb: Do not use off64_t on musl

Its not available on musl since off_t is 64bit by default

---
 .../0001-wiredtiger-Avoid-using-off64_t.patch | 30 +++++++++++++++++++
 .../recipes-dbs/mongodb/mongodb_git.bb        |  1 +
 2 files changed, 31 insertions(+)
 create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-wiredtiger-Avoid-using-off64_t.patch
meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-wiredtiger-Avoid-using-off64_t.patch new file +30 -0
new file mode 100644
index 0000000000..abe6898554
@@ -0,0 +1,30 @@
+From 0508c1518c2e7c586a231d344e9f93b08507885b Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sat, 31 Dec 2022 14:23:40 -0800
+Subject: [PATCH] wiredtiger: Avoid using off64_t
+
+off64_t is not available on musl since off_t is already 64bit by
+default. Therefore replace using off64_t with off_t
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/third_party/wiredtiger/src/os_posix/os_fs.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/third_party/wiredtiger/src/os_posix/os_fs.c b/src/third_party/wiredtiger/src/os_posix/os_fs.c
+index 3898eb74343..9ce2d5edb38 100644
+--- a/src/third_party/wiredtiger/src/os_posix/os_fs.c
++++ b/src/third_party/wiredtiger/src/os_posix/os_fs.c
+@@ -533,7 +533,7 @@ __posix_file_sync_nowait(WT_FILE_HANDLE *file_handle, WT_SESSION *wt_session)
+     pfh = (WT_FILE_HANDLE_POSIX *)file_handle;
+ 
+     /* See comment in __posix_sync(): sync cannot be retried or fail. */
+-    WT_SYSCALL(sync_file_range(pfh->fd, (off64_t)0, (off64_t)0, SYNC_FILE_RANGE_WRITE), ret);
++    WT_SYSCALL(sync_file_range(pfh->fd, 0, 0, SYNC_FILE_RANGE_WRITE), ret);
+     if (ret == 0)
+         return (0);
+ 
+-- 
+2.39.0
+
meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb +1 -0
index d040ab160b..6e93ec9b0c 100644
@@ -38,6 +38,7 @@ 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://0004-wiredtiger-Disable-strtouq-on-musl.patch \
+           file://0001-wiredtiger-Avoid-using-off64_t.patch \
            "
 
 SRC_URI:append:toolchain-clang = "\
Signature · 1 line
2.39.0