Skip to contentSkip to conversation

libtorrent: Aid riscv32 build by linking with libatomic

PATCH New Khem Raj 1 participant 4 messages Nov 14, 2020

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/4 libtorrent: Aid riscv32 build by linking with libatomic

The needed atomics are not available in compiler libtorrent.so: undefined reference to `__atomic_exchange_8'

---
 meta-oe/recipes-connectivity/libtorrent/libtorrent_git.bb | 2 ++
 1 file changed, 2 insertions(+)
meta-oe/recipes-connectivity/libtorrent/libtorrent_git.bb +2 -0
index 3ee69554b6..fa5e829c9f 100644
@@ -26,6 +26,8 @@ inherit autotools pkgconfig
 
 EXTRA_OECONF = "--with-zlib=${STAGING_EXECPREFIXDIR}"
 
+LDFLAGS_append_riscv32 = " -latomic"
+
 do_configure_prepend() {
     (cd ${S}; ./autogen.sh; cd -)
 }
Signature · 1 line
2.29.2
author
#1 lore raw

PATCH 2/4 botan: Mark incompatible with riscv32

CPU is not supported _yet_

---
 meta-oe/recipes-crypto/botan/botan_2.14.0.bb | 2 ++
 1 file changed, 2 insertions(+)
meta-oe/recipes-crypto/botan/botan_2.14.0.bb +2 -0
index 42e89f639c..13b2c6649b 100644
@@ -49,3 +49,5 @@ PACKAGES += "${PN}-python3"
 FILES_${PN}-python3 = "${libdir}/python3"
 
 RDEPENDS_${PN}-python3 += "python3"
+
+COMPATIBLE_HOST_riscv32 = "null"
Signature · 1 line
2.29.2
author
#2 lore raw

PATCH 3/4 projucer: Link with libatomic on rv32

In reply to Khem Raj

Fixes
include/c++/10.2.0/bits/atomic_base.h:374: undefined reference to `__atomic_fetch_xor_8'

---
 meta-multimedia/recipes-multimedia/juce/projucer.inc | 1 +
 1 file changed, 1 insertion(+)
meta-multimedia/recipes-multimedia/juce/projucer.inc +1 -0
index fc8baa45b4..ab0f23879f 100644
@@ -34,6 +34,7 @@ EXTRA_OEMAKE = "V=1 JUCE_ARCH_LABEL=${TARGET_ARCH} TARGET_ARCH='-g'"
 LDFLAGS_append_mipsarcho32 = " -latomic"
 LDFLAGS_append_powerpc = " -latomic"
 LDFLAGS_append_riscv64 = " -latomic"
+LDFLAGS_append_riscv32 = " -latomic"
 LDFLAGS_append_armv5 = " -latomic"
 
 do_configure() {
Signature · 1 line
2.29.2
author
#3 lore raw

PATCH 4/4 mariadb: Fix build on 32bit arches with 64bit time_t

In reply to Khem Raj
---
 meta-oe/recipes-dbs/mysql/mariadb.inc         |  1 +
 ...fine-__NR_futex-if-it-does-not-exist.patch | 37 +++++++++++++++++++
 2 files changed, 38 insertions(+)
 create mode 100644 meta-oe/recipes-dbs/mysql/mariadb/0001-innobase-Define-__NR_futex-if-it-does-not-exist.patch
meta-oe/recipes-dbs/mysql/mariadb.inc +1 -0
index 7c92bbaad6..e3ce297618 100644
@@ -19,6 +19,7 @@ SRC_URI = "https://downloads.mariadb.org/interstitial/${BP}/source/${BP}.tar.gz
            file://clang_version_header_conflict.patch \
            file://fix-arm-atomic.patch \
            file://0001-Fix-library-LZ4-lookup.patch \
+           file://0001-innobase-Define-__NR_futex-if-it-does-not-exist.patch \
           "
 SRC_URI[sha256sum] = "ff05dd69e9f6992caf1053242db704f04eda6f9accbcc98b74edfaf6013c45c4"
 
meta-oe/recipes-dbs/mysql/mariadb/0001-innobase-Define-__NR_futex-if-it-does-not-exist.patch new file +37 -0
new file mode 100644
index 0000000000..0a2eed44f4
@@ -0,0 +1,37 @@
+From d611f78198dee64bb6a05933d200b544e2510b76 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sat, 14 Nov 2020 14:37:13 -0800
+Subject: [PATCH] innobase: Define __NR_futex if it does not exist
+
+__NR_futex is not defines by newer architectures e.g. arc, riscv32 as
+they only have 64bit variant of time_t. Glibc defines SYS_futex interface based
+on
+__NR_futex, since this is used in applications, such applications start
+to fail to build for these newer architectures. This patch defines a
+fallback to alias __NR_futex to __NR_futex_tim64 so SYS_futex keeps
+working
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+ storage/innobase/log/log0sync.cc | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/storage/innobase/log/log0sync.cc b/storage/innobase/log/log0sync.cc
+index 7799e605..4fab8f74 100644
+--- a/storage/innobase/log/log0sync.cc
++++ b/storage/innobase/log/log0sync.cc
+@@ -66,6 +66,9 @@ Note that if write operation is very fast, a) or b) can be fine as alternative.
+ #ifdef __linux__
+ #include <linux/futex.h>
+ #include <sys/syscall.h>
++#if !defined(SYS_futex) && defined(SYS_futex_time64)
++# define SYS_futex SYS_futex_time64
++#endif
+ #endif
+ 
+ #include <atomic>
+-- 
+2.29.2
+
Signature · 1 line
2.29.2