Skip to contentSkip to conversation

mariadb: Use qemu to run cross-compiled binaries

PATCH New Zoltan Boszormenyi 1 participant 2 messages Jul 6, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 mariadb: Use qemu to run cross-compiled binaries

From: Zoltán Böszörményi <[email protected]>

This way, mariadb does not depend on mariadb-native anymore.

---
 meta-oe/recipes-dbs/mysql/mariadb.inc         | 27 ++++----
 .../mysql/mariadb/cross-compiling.patch       | 25 -------
 ...Lists.txt-fix-gen_lex_hash-not-found.patch | 67 -------------------
 meta-oe/recipes-dbs/mysql/mariadb_10.5.10.bb  |  4 +-
 4 files changed, 15 insertions(+), 108 deletions(-)
 delete mode 100644 meta-oe/recipes-dbs/mysql/mariadb/cross-compiling.patch
 delete mode 100644 meta-oe/recipes-dbs/mysql/mariadb/sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch
meta-oe/recipes-dbs/mysql/mariadb.inc +13 -14
index 18b025070..7b1f537fb 100644
@@ -12,7 +12,6 @@ SRC_URI = "https://downloads.mariadb.org/interstitial/${BP}/source/${BP}.tar.gz
            file://mysql-systemd-start \
            file://configure.cmake-fix-valgrind.patch \
            file://support-files-CMakeLists.txt-fix-do_populate_sysroot.patch \
-           file://sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch \
            file://0001-disable-ucontext-on-musl.patch \
            file://c11_atomics.patch \
            file://clang_version_header_conflict.patch \
@@ -21,7 +20,6 @@ SRC_URI = "https://downloads.mariadb.org/interstitial/${BP}/source/${BP}.tar.gz
            file://0001-innobase-Define-__NR_futex-if-it-does-not-exist.patch \
            file://0001-aio_linux-Check-if-syscall-exists-before-using-it.patch \
            file://sys_futex.patch \
-           file://cross-compiling.patch \
            file://ssize_t.patch \
            file://mm_malloc.patch \
           "
@@ -60,8 +58,6 @@ SYSTEMD_AUTO_ENABLE_${PN}-setupdb ?= "enable"
 ALLOW_EMPTY_${PN}-setupdb ?= "1"
 FILES_${PN}-setupdb = "${sysconfdir}/init.d/install_db"
 
-EXTRA_OEMAKE = "'GEN_LEX_HASH=${STAGING_BINDIR_NATIVE}/gen_lex_hash'"
-
 PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)} setupdb"
 PACKAGECONFIG_class-native = ""
 PACKAGECONFIG[pam] = ",-DWITHOUT_AUTH_PAM=TRUE,libpam"
@@ -95,6 +91,8 @@ EXTRA_OECMAKE = "-DWITH_EMBEDDED_SERVER=ON \
                  -DCAT_EXECUTABLE=`which cat` \
                  -DCMAKE_AR:FILEPATH=${AR}"
 
+EXTRA_OECMAKE_prepend_class-target = "-DCMAKE_CROSSCOMPILING_EMULATOR=${WORKDIR}/qemuwrapper "
+
 # With Ninja it fails with:
 # make: *** No rule to make target `install'.  Stop.
 OECMAKE_GENERATOR = "Unix Makefiles"
@@ -117,12 +115,18 @@ do_generate_toolchain_file_append_class-native () {
     sed -i "/set( CMAKE_SYSTEM_PROCESSOR/d" ${WORKDIR}/toolchain.cmake
 }
 
-do_compile_prepend_class-target () {
-    # These need to be in-tree or make will think they need to be built,
-    # and since we're cross-compiling that is disabled
-    cp ${STAGING_BINDIR_NATIVE}/comp_err ${S}/extra
-    cp ${STAGING_BINDIR_NATIVE}/comp_sql ${S}/scripts
+do_configure_prepend_class-target () {
+	# Write out a qemu wrapper that will be used by cmake
+	# so that it can run target helper binaries through that.
+	qemu_binary="${@qemu_wrapper_cmdline(d, d.getVar('STAGING_DIR_HOST'), [d.expand('${STAGING_DIR_HOST}${libdir}'),d.expand('${STAGING_DIR_HOST}${base_libdir}')])}"
+	cat > ${WORKDIR}/qemuwrapper << EOF
+#!/bin/sh
+$qemu_binary "\$@"
+EOF
+	chmod +x ${WORKDIR}/qemuwrapper
+}
 
+do_compile_prepend_class-target () {
     if [ "${@bb.utils.contains('PACKAGECONFIG', 'krb5', 'yes', 'no', d)}" = "no" ]; then
         if ! [ -e ${B}/include/openssl/kssl.h ] ; then
             mkdir -p ${B}/include/openssl
@@ -132,11 +136,6 @@ do_compile_prepend_class-target () {
             echo "#endif" >>${B}/include/openssl/kssl.h
         fi
     fi
-    # workaround to handle out-of-source build from source package
-    yacc_files="sql_yacc.hh sql_yacc.cc sql_yacc_ora.hh sql_yacc_ora.cc"
-    for yacc_file in ${yacc_files}; do
-        cp ${S}/sql/${yacc_file} ${B}/sql/${yacc_file}
-    done
 }
 
 SYSROOT_PREPROCESS_FUNCS += "mariadb_sysroot_preprocess"
meta-oe/recipes-dbs/mysql/mariadb/cross-compiling.patch deleted +0 -25
deleted file mode 100644
index 0f4815b18..000000000
@@ -1,25 +0,0 @@
-This is not needed for OE builds
-
-building failed since native does not generate import_executables.cmake
-In fact, our building system will export the needed commands
-
-Upstream-Status: Inappropriate [configuration]
-
-Signed-off-by: Roy Li <[email protected]>
-Signed-off-by: Mingli Yu <[email protected]>
-Signed-off-by: Khem Raj <[email protected]>
-
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -392,11 +392,6 @@ CHECK_PCRE()
- 
- CHECK_SYSTEMD()
- 
--IF(CMAKE_CROSSCOMPILING AND NOT DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
--  SET(IMPORT_EXECUTABLES "IMPORTFILE-NOTFOUND" CACHE FILEPATH "Path to import_executables.cmake from a native build")
--  INCLUDE(${IMPORT_EXECUTABLES})
--ENDIF()
--
- #
- # Setup maintainer mode options. Platform checks are
- # not run with the warning options as to not perturb fragile checks
meta-oe/recipes-dbs/mysql/mariadb/sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch deleted +0 -67

67 lines not on this page · raw message

meta-oe/recipes-dbs/mysql/mariadb_10.5.10.bb +2 -2
index 8ae8241b0..57d7736ea 100644
@@ -1,8 +1,8 @@
 require mariadb.inc
 
-EXTRA_OECMAKE += "-DSTACK_DIRECTION=-1"
+inherit qemu
 
-DEPENDS += "mariadb-native bison-native boost libpcre2 curl openssl ncurses zlib libaio libedit libevent libxml2"
+DEPENDS += "qemu-native bison-native boost libpcre2 curl openssl ncurses zlib libaio libedit libevent libxml2"
 
 PROVIDES += "mysql5 libmysqlclient"
 
Signature · 1 line
2.31.1
#1 lore raw

PATCH 2/2 mariadb: Upgrade to 10.5.11

From: Zoltán Böszörményi <[email protected]>

---
 .../{mariadb-native_10.5.10.bb => mariadb-native_10.5.11.bb}    | 0
 meta-oe/recipes-dbs/mysql/mariadb.inc                           | 2 +-
 .../mysql/{mariadb_10.5.10.bb => mariadb_10.5.11.bb}            | 0
 3 files changed, 1 insertion(+), 1 deletion(-)
 rename meta-oe/recipes-dbs/mysql/{mariadb-native_10.5.10.bb => mariadb-native_10.5.11.bb} (100%)
 rename meta-oe/recipes-dbs/mysql/{mariadb_10.5.10.bb => mariadb_10.5.11.bb} (100%)
meta-oe/recipes-dbs/mysql/mariadb-native_10.5.11.bb renamed from meta-oe/recipes-dbs/mysql/mariadb-native_10.5.10.bb +0 -0
similarity index 100%
rename from meta-oe/recipes-dbs/mysql/mariadb-native_10.5.10.bb
rename to meta-oe/recipes-dbs/mysql/mariadb-native_10.5.11.bb
meta-oe/recipes-dbs/mysql/mariadb.inc +1 -1
index 7b1f537fb..71978740b 100644
@@ -25,7 +25,7 @@ SRC_URI = "https://downloads.mariadb.org/interstitial/${BP}/source/${BP}.tar.gz
           "
 SRC_URI_append_libc-musl = " file://ppc-remove-glibc-dep.patch"
 
-SRC_URI[sha256sum] = "a5ff32f9fcaaf26bf5cba94accc7b246d2d5eb75710d027e40122df6bac0babb"
+SRC_URI[sha256sum] = "761053605fe30ce393f324852117990350840a93b3e6305ef4d2f8c8305cc47a"
 
 UPSTREAM_CHECK_URI = "https://github.com/MariaDB/server/releases"
 
meta-oe/recipes-dbs/mysql/mariadb_10.5.11.bb renamed from meta-oe/recipes-dbs/mysql/mariadb_10.5.10.bb +0 -0
similarity index 100%
rename from meta-oe/recipes-dbs/mysql/mariadb_10.5.10.bb
rename to meta-oe/recipes-dbs/mysql/mariadb_10.5.11.bb
Signature · 1 line
2.31.1