extra/mariadb: fixes

This commit is contained in:
Kevin Mihelich 2021-05-28 17:38:50 +00:00
parent 476a7060c7
commit 3831b9b198
4 changed files with 103 additions and 79 deletions

View file

@ -1,75 +0,0 @@
From 90660213eee7b871ab3c3aa3561376fcac4b6b48 Mon Sep 17 00:00:00 2001
From: Kevin Mihelich <kevin@archlinuxarm.org>
Date: Fri, 2 Aug 2019 12:00:41 -0600
Subject: [PATCH] libatomic
---
configure.cmake | 3 +++
libmysqld/CMakeLists.txt | 1 +
sql/CMakeLists.txt | 3 ++-
storage/rocksdb/build_rocksdb.cmake | 2 +-
4 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/configure.cmake b/configure.cmake
index 8533b8ee0b2..0d7ced1a695 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -855,6 +855,8 @@ SET(SIGNAL_WITH_VIO_CLOSE 1)
MARK_AS_ADVANCED(NO_ALARM)
+SET(SAVE_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
+SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} atomic)
CHECK_CXX_SOURCE_COMPILES("
int main()
{
@@ -863,6 +865,7 @@ int main()
return (int)__atomic_load_n(ptr, __ATOMIC_SEQ_CST);
}"
HAVE_GCC_C11_ATOMICS)
+SET(CMAKE_REQUIRED_LIBRARIES ${SAVE_CMAKE_REQUIRED_LIBRARIES})
IF(WITH_VALGRIND)
SET(HAVE_valgrind 1)
diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt
index 9dddc8a8990..9cf0b328bab 100644
--- a/libmysqld/CMakeLists.txt
+++ b/libmysqld/CMakeLists.txt
@@ -162,6 +162,7 @@ SET(LIBS
${LIBWRAP} ${LIBCRYPT} ${LIBDL}
${EMBEDDED_PLUGIN_LIBS}
sql_embedded
+ atomic
)
# Some storage engine were compiled for embedded specifically
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index d2180297907..3258b931324 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -196,7 +196,8 @@ TARGET_LINK_LIBRARIES(sql
tpool
${LIBWRAP} ${LIBCRYPT} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT}
${SSL_LIBRARIES}
- ${LIBSYSTEMD})
+ ${LIBSYSTEMD}
+ atomic)
IF(TARGET pcre2)
ADD_DEPENDENCIES(sql pcre2)
diff --git a/storage/rocksdb/build_rocksdb.cmake b/storage/rocksdb/build_rocksdb.cmake
index 2b4649b1fbe..688986c4deb 100644
--- a/storage/rocksdb/build_rocksdb.cmake
+++ b/storage/rocksdb/build_rocksdb.cmake
@@ -497,7 +497,7 @@ INCLUDE_DIRECTORIES(${ROCKSDB_SOURCE_DIR}/util)
list(APPEND SOURCES ${CMAKE_CURRENT_BINARY_DIR}/build_version.cc)
ADD_CONVENIENCE_LIBRARY(rocksdblib ${SOURCES})
-target_link_libraries(rocksdblib ${THIRDPARTY_LIBS} ${SYSTEM_LIBS})
+target_link_libraries(rocksdblib ${THIRDPARTY_LIBS} ${SYSTEM_LIBS} atomic)
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set_target_properties(rocksdblib PROPERTIES COMPILE_FLAGS "-fPIC -fno-builtin-memcmp -Wno-error")
endif()
--
2.27.0

View file

@ -3,7 +3,7 @@
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - disable mroonga storage engine (doesn't build on ARM)
# - patch to link (unused) static libs against libatomic on v5/v6 to fix FTBFS
# - patches from debian and atomic fixes for v5/v6
pkgbase=mariadb
pkgname=('mariadb-libs' 'mariadb-clients' 'mariadb' 'mytop')
@ -23,11 +23,13 @@ validpgpkeys=('199369E5404BD5FC7D2FE43BCBCB082A1BB943DB') # MariaDB Package Sign
# https://mariadb.com/kb/en/library/mirror-sites-for-mariadb/
source=("https://rsync.osuosl.org/pub/mariadb/mariadb-${pkgver}/source/mariadb-${pkgver}.tar.gz"{,.asc}
'0001-arch-specific.patch'
'0001-libatomic.patch')
'c11_atomics.patch'
'revert-isb-assembly-instruction.patch')
sha256sums=('a5ff32f9fcaaf26bf5cba94accc7b246d2d5eb75710d027e40122df6bac0babb'
'SKIP'
'3289efb3452d199aec872115f35da3f1d6fd4ce774615076690e9bc8afae1460'
'59947e8154dceae50a38053ed4f659f23e5c95eb2a2fc06f60d57be5814ae1c3')
'4c595f5a5eef2774518289576310c1cb1d86637e1e8a8af04c472721f7be0cbd'
'd125bde23b5b2b9b460baf5e43b4a76faac47d47f86d43973c8ca078262a13a7')
prepare() {
cd $pkgbase-$pkgver/
@ -39,7 +41,9 @@ prepare() {
patch -Np1 < ../0001-arch-specific.patch
if [[ $CARCH == arm || $CARCH == armv6h ]]; then
patch -p1 -i ../0001-libatomic.patch
patch -p1 -i ../c11_atomics.patch
patch -p1 -i ../revert-isb-assembly-instruction.patch
echo "target_link_libraries(rocksdblib atomic)" >> storage/rocksdb/build_rocksdb.cmake
fi
}

View file

@ -0,0 +1,75 @@
Forwarded: https://github.com/MariaDB/server/pull/1716
Author: Vicențiu Ciorbaru <vicentiu@mariadb.org>
Date: Fri Dec 21 19:14:04 2018 +0200
Link with libatomic to enable C11 atomics support
Some architectures (mips) require libatomic to support proper
atomic operations. Check first if support is available without
linking, otherwise use the library.
Original commit:
Detect whether libatomic is needed rather than hard-coding for mips
Fixes FTBFS on powerpc, since it needs libatomic too for C11 atomics,
and possibly m68k.
Contributors:
James Cowgill <jcowgill@debian.org>
Jessica Clarke <jrtc27@debian.org>
--- a/configure.cmake
+++ b/configure.cmake
@@ -865,7 +865,25 @@ int main()
long long int *ptr= &var;
return (int)__atomic_load_n(ptr, __ATOMIC_SEQ_CST);
}"
-HAVE_GCC_C11_ATOMICS)
+HAVE_GCC_C11_ATOMICS_WITHOUT_LIBATOMIC)
+IF (HAVE_GCC_C11_ATOMICS_WITHOUT_LIBATOMIC)
+ SET(HAVE_GCC_C11_ATOMICS True)
+ELSE()
+ SET(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
+ LIST(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
+ CHECK_CXX_SOURCE_COMPILES("
+ int main()
+ {
+ long long int var= 1;
+ long long int *ptr= &var;
+ return (int)__atomic_load_n(ptr, __ATOMIC_SEQ_CST);
+ }"
+ HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC)
+ IF(HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC)
+ SET(HAVE_GCC_C11_ATOMICS True)
+ ENDIF()
+ SET(CMAKE_REQUIRED_LIBRARIES ${OLD_CMAKE_REQUIRED_LIBRARIES})
+ENDIF()
IF(WITH_VALGRIND)
SET(HAVE_valgrind 1)
--- a/mysys/CMakeLists.txt
+++ b/mysys/CMakeLists.txt
@@ -168,6 +168,10 @@ TARGET_LINK_LIBRARIES(mysys dbug strings
${LIBNSL} ${LIBM} ${LIBRT} ${CMAKE_DL_LIBS} ${LIBSOCKET} ${LIBEXECINFO})
DTRACE_INSTRUMENT(mysys)
+IF (HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC)
+ TARGET_LINK_LIBRARIES(mysys atomic)
+ENDIF()
+
IF(HAVE_BFD_H)
TARGET_LINK_LIBRARIES(mysys bfd)
ENDIF(HAVE_BFD_H)
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -318,6 +318,10 @@ IF(WITH_MYSQLD_LDFLAGS)
"${MYSQLD_LINK_FLAGS} ${WITH_MYSQLD_LDFLAGS}")
ENDIF()
+IF (HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC)
+ TARGET_LINK_LIBRARIES(sql atomic)
+ENDIF()
+
FIND_PACKAGE(BISON 2.0)

View file

@ -0,0 +1,20 @@
Forwarded: No, but should be
Subject: Revert upstream "MDEV-24630: MY_RELAX_CPU assembly instruction upgrade"
Description:
It was noticed that MariaDB 10.5.10 regressed and no longer built on armhf.
For details see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=988629
Reverting the upstream commit
https://github.com/MariaDB/server/commit/76d2846a71a155ee2861fd52e6635e35490a9dd1
is likely to fix it and make armhf build again.
--- a/include/my_cpu.h
+++ b/include/my_cpu.h
@@ -84,7 +84,7 @@ static inline void MY_RELAX_CPU(void)
__ppc_get_timebase();
#elif defined __GNUC__ && (defined __arm__ || defined __aarch64__)
/* Mainly, prevent the compiler from optimizing away delay loops */
- __asm__ __volatile__ ("isb":::"memory");
+ __asm__ __volatile__ ("":::"memory");
#else
int32 var, oldval = 0;
my_atomic_cas32_strong_explicit(&var, &oldval, 1, MY_MEMORY_ORDER_RELAXED,