Skip to contentSkip to conversation

mariadb: Use qemu to run cross-compiled binaries

PATCH New Khem Raj 5 participants 10 messages Jul 6, 2021 – Oct 27, 2022 4 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Khem Raj

author
#1 lore raw
Quoted 3 lines · Zoltán Böszörményi

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

how does build time gets impacted ? you can count that native build is not needed but still it will be good to know.
qemu dependency also means that qemu usermode has to be supported for this to work, which maybe troublesome on some
newer or lesser known architectures but perhaps thats a fine compromise perhaps.

Quoted 206 lines
---
 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
deleted file mode 100644
index 4cb044339..000000000
@@ -1,67 +0,0 @@
-From cfce1491827e5a581878b5e166bf4d30e6d90e07 Mon Sep 17 00:00:00 2001
-From: Mingli Yu <[email protected]>
-Date: Thu, 23 Jul 2020 00:08:16 -0700
-Subject: [PATCH] sql/CMakeLists.txt: fix gen_lex_hash not found
-
-Fix the below do_compile issue in cross-compiling env.
-| make[2]: *** No rule to make target '/build/tmp/work/aarch64-poky-linux/mariadb/10.3.13-r0/mariadb-10.3.13/sql/gen_lex_hash', needed by 'sql/lex_hash.h'.  Stop.
-| make[2]: *** No rule to make target '/build/tmp/work/aarch64-poky-linux/mariadb/10.3.13-r0/mariadb-10.3.13/sql/gen_lex_token', needed by 'sql/lex_token.h'.  Stop.
-
-Upstream-Status: Inappropriate [oe build specific]
-
-Signed-off-by: Mingli Yu <[email protected]>
----
- sql/CMakeLists.txt | 30 ++++++++++++++++++++----------
- 1 file changed, 20 insertions(+), 10 deletions(-)
-
-diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
-index 0dc3caa..616017b 100644
---- a/sql/CMakeLists.txt
-+++ b/sql/CMakeLists.txt
-@@ -52,11 +52,16 @@ ${CMAKE_BINARY_DIR}/sql
- ${CMAKE_SOURCE_DIR}/tpool
- )
-
--ADD_CUSTOM_COMMAND(
--  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
--  COMMAND gen_lex_token > lex_token.h
--  DEPENDS gen_lex_token
--)
-+IF(NOT CMAKE_CROSSCOMPILING)
-+  ADD_CUSTOM_COMMAND(
-+   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
-+   COMMAND gen_lex_token > lex_token.h
-+   DEPENDS gen_lex_token)
-+ELSE()
-+  ADD_CUSTOM_COMMAND(
-+   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
-+   COMMAND gen_lex_token > lex_token.h)
-+ENDIF()
-
- ADD_CUSTOM_COMMAND(
-   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc_ora.yy
-@@ -345,11 +350,16 @@ IF(NOT CMAKE_CROSSCOMPILING)
-   ADD_EXECUTABLE(gen_lex_hash gen_lex_hash.cc)
- ENDIF()
-
--ADD_CUSTOM_COMMAND(
--  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
--  COMMAND gen_lex_hash > lex_hash.h
--  DEPENDS gen_lex_hash
--)
-+IF(NOT CMAKE_CROSSCOMPILING)
-+  ADD_CUSTOM_COMMAND(
-+   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
-+   COMMAND gen_lex_hash > lex_hash.h
-+   DEPENDS gen_lex_hash)
-+ELSE()
-+  ADD_CUSTOM_COMMAND(
-+   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
-+   COMMAND gen_lex_hash > lex_hash.h)
-+ENDIF()
-
- MYSQL_ADD_EXECUTABLE(mariadb-tzinfo-to-sql tztime.cc COMPONENT Server)
- SET_TARGET_PROPERTIES(mariadb-tzinfo-to-sql PROPERTIES COMPILE_FLAGS "-DTZINFO2SQL")
---
-2.17.1
-
meta-oe/recipes-dbs/mysql/mariadb_10.5.10.bb +2 -3
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"
 
--

2.31.1

#2 lore raw

2021. 07. 06. 10:37 keltezéssel, Khem Raj írta:

Quoted 7 lines · Zoltán Böszörményi
Quoted 3 lines

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

how does build time gets impacted ? you can count that native build is not needed but still it will be good to know.

The build time of mariadb itself does not change significantly, it's around 15 minutes either way on our 16-core build machine. Same amount of time for mariadb-native, which is saved now.

Quoted 214 lines

qemu dependency also means that qemu usermode has to be supported for this to work, which maybe troublesome on some
newer or lesser known architectures but perhaps thats a fine compromise perhaps.

Quoted 210 lines
---
  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
deleted file mode 100644
index 4cb044339..000000000
@@ -1,67 +0,0 @@
-From cfce1491827e5a581878b5e166bf4d30e6d90e07 Mon Sep 17 00:00:00 2001
-From: Mingli Yu <[email protected]>
-Date: Thu, 23 Jul 2020 00:08:16 -0700
-Subject: [PATCH] sql/CMakeLists.txt: fix gen_lex_hash not found
-
-Fix the below do_compile issue in cross-compiling env.
-| make[2]: *** No rule to make target '/build/tmp/work/aarch64-poky-linux/mariadb/10.3.13-r0/mariadb-10.3.13/sql/gen_lex_hash', needed by 'sql/lex_hash.h'.  Stop.
-| make[2]: *** No rule to make target '/build/tmp/work/aarch64-poky-linux/mariadb/10.3.13-r0/mariadb-10.3.13/sql/gen_lex_token', needed by 'sql/lex_token.h'.  Stop.
-
-Upstream-Status: Inappropriate [oe build specific]
-
-Signed-off-by: Mingli Yu <[email protected]>
----
- sql/CMakeLists.txt | 30 ++++++++++++++++++++----------
- 1 file changed, 20 insertions(+), 10 deletions(-)
-
-diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
-index 0dc3caa..616017b 100644
---- a/sql/CMakeLists.txt
-+++ b/sql/CMakeLists.txt
-@@ -52,11 +52,16 @@ ${CMAKE_BINARY_DIR}/sql
- ${CMAKE_SOURCE_DIR}/tpool
- )
-
--ADD_CUSTOM_COMMAND(
--  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
--  COMMAND gen_lex_token > lex_token.h
--  DEPENDS gen_lex_token
--)
-+IF(NOT CMAKE_CROSSCOMPILING)
-+  ADD_CUSTOM_COMMAND(
-+   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
-+   COMMAND gen_lex_token > lex_token.h
-+   DEPENDS gen_lex_token)
-+ELSE()
-+  ADD_CUSTOM_COMMAND(
-+   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
-+   COMMAND gen_lex_token > lex_token.h)
-+ENDIF()
-
- ADD_CUSTOM_COMMAND(
-   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc_ora.yy
-@@ -345,11 +350,16 @@ IF(NOT CMAKE_CROSSCOMPILING)
-   ADD_EXECUTABLE(gen_lex_hash gen_lex_hash.cc)
- ENDIF()
-
--ADD_CUSTOM_COMMAND(
--  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
--  COMMAND gen_lex_hash > lex_hash.h
--  DEPENDS gen_lex_hash
--)
-+IF(NOT CMAKE_CROSSCOMPILING)
-+  ADD_CUSTOM_COMMAND(
-+   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
-+   COMMAND gen_lex_hash > lex_hash.h
-+   DEPENDS gen_lex_hash)
-+ELSE()
-+  ADD_CUSTOM_COMMAND(
-+   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
-+   COMMAND gen_lex_hash > lex_hash.h)
-+ENDIF()
-
- MYSQL_ADD_EXECUTABLE(mariadb-tzinfo-to-sql tztime.cc COMPONENT Server)
- SET_TARGET_PROPERTIES(mariadb-tzinfo-to-sql PROPERTIES COMPILE_FLAGS "-DTZINFO2SQL")
---
-2.17.1
-
meta-oe/recipes-dbs/mysql/mariadb_10.5.10.bb +2 -3
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"
 
--

2.31.1

author
#3 lore raw
Quoted 7 lines · Böszörményi Zoltán

2021. 07. 06. 10:37 keltezéssel, Khem Raj írta:

Quoted 5 lines · Zoltán Böszörményi
Quoted 3 lines

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

Quoted 7 lines
Quoted 2 lines

how does build time gets impacted ? you can count that native build is not needed but still it will be good to know.

The build time of mariadb itself does not change significantly, it's around 15 minutes either way on our 16-core build machine. Same amount of time for mariadb-native, which is saved now.

sounds good. poco is perhaps only other usecase for mariadb-native

Quoted 215 lines
Quoted 214 lines

qemu dependency also means that qemu usermode has to be supported for this to work, which maybe troublesome on some
newer or lesser known architectures but perhaps thats a fine compromise perhaps.

Quoted 210 lines
---
  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
deleted file mode 100644
index 4cb044339..000000000
@@ -1,67 +0,0 @@
-From cfce1491827e5a581878b5e166bf4d30e6d90e07 Mon Sep 17 00:00:00 2001
-From: Mingli Yu <[email protected]>
-Date: Thu, 23 Jul 2020 00:08:16 -0700
-Subject: [PATCH] sql/CMakeLists.txt: fix gen_lex_hash not found
-
-Fix the below do_compile issue in cross-compiling env.
-| make[2]: *** No rule to make target '/build/tmp/work/aarch64-poky-linux/mariadb/10.3.13-r0/mariadb-10.3.13/sql/gen_lex_hash', needed by 'sql/lex_hash.h'.  Stop.
-| make[2]: *** No rule to make target '/build/tmp/work/aarch64-poky-linux/mariadb/10.3.13-r0/mariadb-10.3.13/sql/gen_lex_token', needed by 'sql/lex_token.h'.  Stop.
-
-Upstream-Status: Inappropriate [oe build specific]
-
-Signed-off-by: Mingli Yu <[email protected]>
----
- sql/CMakeLists.txt | 30 ++++++++++++++++++++----------
- 1 file changed, 20 insertions(+), 10 deletions(-)
-
-diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
-index 0dc3caa..616017b 100644
---- a/sql/CMakeLists.txt
-+++ b/sql/CMakeLists.txt
-@@ -52,11 +52,16 @@ ${CMAKE_BINARY_DIR}/sql
- ${CMAKE_SOURCE_DIR}/tpool
- )
-
--ADD_CUSTOM_COMMAND(
--  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
--  COMMAND gen_lex_token > lex_token.h
--  DEPENDS gen_lex_token
--)
-+IF(NOT CMAKE_CROSSCOMPILING)
-+  ADD_CUSTOM_COMMAND(
-+   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
-+   COMMAND gen_lex_token > lex_token.h
-+   DEPENDS gen_lex_token)
-+ELSE()
-+  ADD_CUSTOM_COMMAND(
-+   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
-+   COMMAND gen_lex_token > lex_token.h)
-+ENDIF()
-
- ADD_CUSTOM_COMMAND(
-   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc_ora.yy
-@@ -345,11 +350,16 @@ IF(NOT CMAKE_CROSSCOMPILING)
-   ADD_EXECUTABLE(gen_lex_hash gen_lex_hash.cc)
- ENDIF()
-
--ADD_CUSTOM_COMMAND(
--  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
--  COMMAND gen_lex_hash > lex_hash.h
--  DEPENDS gen_lex_hash
--)
-+IF(NOT CMAKE_CROSSCOMPILING)
-+  ADD_CUSTOM_COMMAND(
-+   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
-+   COMMAND gen_lex_hash > lex_hash.h
-+   DEPENDS gen_lex_hash)
-+ELSE()
-+  ADD_CUSTOM_COMMAND(
-+   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
-+   COMMAND gen_lex_hash > lex_hash.h)
-+ENDIF()
-
- MYSQL_ADD_EXECUTABLE(mariadb-tzinfo-to-sql tztime.cc COMPONENT Server)
- SET_TARGET_PROPERTIES(mariadb-tzinfo-to-sql PROPERTIES COMPILE_FLAGS "-DTZINFO2SQL")
---
-2.17.1
-
meta-oe/recipes-dbs/mysql/mariadb_10.5.10.bb +2 -3
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"
 
--

2.31.1

#4 lore raw
In reply to Khem Raj

Failed to build for amd64:

| make[2]: Leaving directory '/build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build'
| qemu: uncaught target signal 4 (Illegal instruction) - core dumped
| [  4%] Built target tpool
| [  8%] Built target skip_all-t
| [  4%] Built target no_plan-t
| [  8%] Built target wsrep-lib
| [  8%] Built target ref10
| [  8%] Built target mariadb_obj
| make  -f libmariadb/libmariadb/CMakeFiles/mariadbclient.dir/build.make libmariadb/libmariadb/CMakeFiles/mariadbclient.dir/depend
| make  -f libmariadb/libmariadb/CMakeFiles/libmariadb.dir/build.make libmariadb/libmariadb/CMakeFiles/libmariadb.dir/depend
| make[2]: Entering directory '/build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build'
| cd /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build && /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/recipe-sysroot-native/usr/bin/cmake -E cmake_depends "Unix Makefiles" /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/mariadb-10.7.4 /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/mariadb-10.7.4/libmariadb/libmariadb /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build/libmariadb/libmariadb /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build/libmariadb/libmariadb/CMakeFiles/mariadbclient.dir/DependInfo.cmake --color=
| make[2]: Leaving directory '/build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build'
| make  -f libmariadb/libmariadb/CMakeFiles/mariadbclient.dir/build.make libmariadb/libmariadb/CMakeFiles/mariadbclient.dir/build
| Illegal instruction (core dumped)
| make[2]: *** [sql/CMakeFiles/GenServerSource.dir/build.make:76: sql/lex_hash.h] Error 132
| make[2]: *** Deleting file 'sql/lex_hash.h'
| make[2]: Entering directory '/build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build'
| [  8%] Linking C static library libmariadbclient.a
| cd /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build/libmariadb/libmariadb && /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/recipe-sysroot-native/usr/bin/cmake -P CMakeFiles/mariadbclient.dir/cmake_clean_target.cmake
| Illegal instruction (core dumped)
| Illegal instruction (core dumped)
| make[2]: *** [scripts/CMakeFiles/GenFixPrivs.dir/build.make:78: scripts/mysql_fix_privilege_tables_sql.c] Error 132

Thanks,

Quoted 229 lines · Khem Raj

[Please note: This e-mail is from an EXTERNAL e-mail address]

Quoted 3 lines · Zoltán Böszörményi

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

how does build time gets impacted ? you can count that native build is not needed but still it will be good to know.
qemu dependency also means that qemu usermode has to be supported for this to work, which maybe troublesome on some
newer or lesser known architectures but perhaps thats a fine compromise perhaps.

Quoted 216 lines
---
  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
deleted file mode 100644
index 4cb044339..000000000
@@ -1,67 +0,0 @@
-From cfce1491827e5a581878b5e166bf4d30e6d90e07 Mon Sep 17 00:00:00 2001
-From: Mingli Yu <[email protected]>
-Date: Thu, 23 Jul 2020 00:08:16 -0700
-Subject: [PATCH] sql/CMakeLists.txt: fix gen_lex_hash not found
-
-Fix the below do_compile issue in cross-compiling env.
-| make[2]: *** No rule to make target '/build/tmp/work/aarch64-poky-linux/mariadb/10.3.13-r0/mariadb-10.3.13/sql/gen_lex_hash', needed by 'sql/lex_hash.h'.  Stop.
-| make[2]: *** No rule to make target '/build/tmp/work/aarch64-poky-linux/mariadb/10.3.13-r0/mariadb-10.3.13/sql/gen_lex_token', needed by 'sql/lex_token.h'.  Stop.
-
-Upstream-Status: Inappropriate [oe build specific]
-
-Signed-off-by: Mingli Yu <[email protected]>
----
- sql/CMakeLists.txt | 30 ++++++++++++++++++++----------
- 1 file changed, 20 insertions(+), 10 deletions(-)
-
-diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
-index 0dc3caa..616017b 100644
---- a/sql/CMakeLists.txt
-+++ b/sql/CMakeLists.txt
-@@ -52,11 +52,16 @@ ${CMAKE_BINARY_DIR}/sql
- ${CMAKE_SOURCE_DIR}/tpool
- )
-
--ADD_CUSTOM_COMMAND(
--  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
--  COMMAND gen_lex_token > lex_token.h
--  DEPENDS gen_lex_token
--)
-+IF(NOT CMAKE_CROSSCOMPILING)
-+  ADD_CUSTOM_COMMAND(
-+   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
-+   COMMAND gen_lex_token > lex_token.h
-+   DEPENDS gen_lex_token)
-+ELSE()
-+  ADD_CUSTOM_COMMAND(
-+   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
-+   COMMAND gen_lex_token > lex_token.h)
-+ENDIF()
-
- ADD_CUSTOM_COMMAND(
-   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc_ora.yy
-@@ -345,11 +350,16 @@ IF(NOT CMAKE_CROSSCOMPILING)
-   ADD_EXECUTABLE(gen_lex_hash gen_lex_hash.cc)
- ENDIF()
-
--ADD_CUSTOM_COMMAND(
--  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
--  COMMAND gen_lex_hash > lex_hash.h
--  DEPENDS gen_lex_hash
--)
-+IF(NOT CMAKE_CROSSCOMPILING)
-+  ADD_CUSTOM_COMMAND(
-+   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
-+   COMMAND gen_lex_hash > lex_hash.h
-+   DEPENDS gen_lex_hash)
-+ELSE()
-+  ADD_CUSTOM_COMMAND(
-+   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
-+   COMMAND gen_lex_hash > lex_hash.h)
-+ENDIF()
-
- MYSQL_ADD_EXECUTABLE(mariadb-tzinfo-to-sql tztime.cc COMPONENT Server)
- SET_TARGET_PROPERTIES(mariadb-tzinfo-to-sql PROPERTIES COMPILE_FLAGS "-DTZINFO2SQL")
---
-2.17.1
-
meta-oe/recipes-dbs/mysql/mariadb_10.5.10.bb +2 -3
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"
 
--

2.31.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#92109): https://lists.openembedded.org/g/openembedded-devel/message/92109
Mute This Topic: https://lists.openembedded.org/mt/84015256/3618448
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#5 lore raw
Quoted 1 line · Mingli via lists.openembedded.org

| Illegal instruction (core dumped)

This is _exactly_ why using qemu-user in a build is a _terrible_ idea.

Please, someone revert this patch from 2021. Yes, CMake is terrible and doesn’t support easily building native tools for use at build time, so we need to build a miniature native package or to hand-compile the binaries which are needed. Plenty of prior art across oe-core for those.

Both of those solutions are better than building the binaries for the target and then just saying LOL OH WELL when qemu doesn’t work.

Mingli’s problem is almost certainly that the target tune is using (relatively) new and shiny x86 instructions (for example, glibc likes to use SSE when it can), which qemu-user can’t emulate.

Ross

#6 lore raw

PATCH 1/1 mariadb: not use qemu to run cross-compiled binaries

From: Mingli Yu <[email protected]>

The build fails when use qemu to run build for amd64 as below:

| make  -f libmariadb/libmariadb/CMakeFiles/mariadbclient.dir/build.make libmariadb/libmariadb/CMakeFiles/mariadbclient.dir/depend
| make  -f libmariadb/libmariadb/CMakeFiles/libmariadb.dir/build.make libmariadb/libmariadb/CMakeFiles/libmariadb.dir/depend
| make[2]: Entering directory '/build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build'
| cd /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build && /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/recipe-sysroot-native/usr/bin/cmake -E cmake_depends "Unix Makefiles" /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/mariadb-10.7.4 /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/mariadb-10.7.4/libmariadb/libmariadb /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build/libmariadb/libmariadb /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build/libmariadb/libmariadb/CMakeFiles/mariadbclient.dir/DependInfo.cmake --color=
| make[2]: Leaving directory '/build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build'
| make  -f libmariadb/libmariadb/CMakeFiles/mariadbclient.dir/build.make libmariadb/libmariadb/CMakeFiles/mariadbclient.dir/build
| Illegal instruction (core dumped)
| make[2]: *** [sql/CMakeFiles/GenServerSource.dir/build.make:76: sql/lex_hash.h] Error 132
| make[2]: *** Deleting file 'sql/lex_hash.h'
| make[2]: Entering directory '/build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build'
| [  8%] Linking C static library libmariadbclient.a
| cd /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build/libmariadb/libmariadb && /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/recipe-sysroot-native/usr/bin/cmake -P CMakeFiles/mariadbclient.dir/cmake_clean_target.cmake
| Illegal instruction (core dumped)
| Illegal instruction (core dumped)
| make[2]: *** [scripts/CMakeFiles/GenFixPrivs.dir/build.make:78: scripts/mysql_fix_privilege_tables_sql.c] Error 132

So don't use qemu to run cross-compiled binaries.

---
 .../mysql/mariadb-native_10.7.4.bb            |  4 +-
 meta-oe/recipes-dbs/mysql/mariadb.inc         | 20 +++---
 ...Lists.txt-fix-gen_lex_hash-not-found.patch | 69 +++++++++++++++++++
 .../mysql/mariadb/cross-compiling.patch       | 34 +++++++++
 meta-oe/recipes-dbs/mysql/mariadb_10.7.4.bb   |  4 +-
 5 files changed, 116 insertions(+), 15 deletions(-)
 create mode 100644 meta-oe/recipes-dbs/mysql/mariadb/0001-sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch
 create mode 100644 meta-oe/recipes-dbs/mysql/mariadb/cross-compiling.patch
meta-oe/recipes-dbs/mysql/mariadb-native_10.7.4.bb +3 -1
index e38726d3f..17a06349b 100644
@@ -2,7 +2,9 @@ require mariadb.inc
 inherit native
 
 PROVIDES += "mysql5-native"
-DEPENDS = "ncurses-native zlib-native bison-native libpcre2-native"
+DEPENDS = "ncurses-native zlib-native bison-native libpcre2-native \
+gnutls-native fmt-native \
+"
 
 RDEPENDS:${PN} = ""
 PACKAGES = ""
meta-oe/recipes-dbs/mysql/mariadb.inc +9 -11
index 922373b63..23322cf74 100644
@@ -20,6 +20,8 @@ SRC_URI = "https://archive.mariadb.org/${BP}/source/${BP}.tar.gz \
            file://mm_malloc.patch \
            file://sys_futex.patch \
            file://mariadb-openssl3.patch \
+           file://cross-compiling.patch \
+           file://0001-sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch \
           "
 SRC_URI:append:libc-musl = " file://ppc-remove-glibc-dep.patch"
 
@@ -61,6 +63,8 @@ FILES:${PN}-setupdb = "${sysconfdir}/init.d/install_db \
                        ${bindir}/mysql-systemd-start \
                        "
 
+EXTRA_OEMAKE = "'GEN_LEX_HASH=${STAGING_BINDIR_NATIVE}/gen_lex_hash'"
+
 PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)} openssl"
 PACKAGECONFIG:class-native = ""
 PACKAGECONFIG[pam] = ",-DWITHOUT_AUTH_PAM=TRUE,libpam"
@@ -95,9 +99,9 @@ EXTRA_OECMAKE = "-DWITH_EMBEDDED_SERVER=ON \
                  -DINSTALL_SYSCONFDIR:PATH=${sysconfdir} \
                  -DMYSQL_DATADIR:PATH=/var/mysql \
                  -DCAT_EXECUTABLE=`which cat` \
+                 -DSTACK_DIRECTION=1 \
                  -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.
@@ -121,18 +125,12 @@ do_generate_toolchain_file:append:class-native () {
     sed -i "/set( CMAKE_SYSTEM_PROCESSOR/d" ${WORKDIR}/toolchain.cmake
 }
 
-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 () {
+    # 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
     if [ "${@bb.utils.contains('PACKAGECONFIG', 'krb5', 'yes', 'no', d)}" = "no" ]; then
         if ! [ -e ${B}/include/openssl/kssl.h ] ; then
             mkdir -p ${B}/include/openssl
meta-oe/recipes-dbs/mysql/mariadb/0001-sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch new file +69 -0

69 lines not on this page · raw message

meta-oe/recipes-dbs/mysql/mariadb/cross-compiling.patch new file +34 -0
new file mode 100644
index 000000000..d0d6e3c73
@@ -0,0 +1,34 @@
+From 80be37351d995654f86b838f6b5ed47e8a90261b Mon Sep 17 00:00:00 2001
+From: Mingli Yu <[email protected]>
+Date: Fri, 23 Sep 2022 12:05:17 +0800
+Subject: [PATCH] CMakeLists.txt: not include import_executables.cmake
+
+building failed since native does not generate import_executables.cmake
+In fact, our building system will export the needed commands.
+
+Upstream-Status: Inappropriate [oe specific]
+
+Signed-off-by: Mingli Yu <[email protected]>
+---
+ CMakeLists.txt | 5 -----
+ 1 file changed, 5 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f9e2b1b..34924ba 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -394,11 +394,6 @@ CHECK_LIBFMT()
+ ADD_SUBDIRECTORY(tpool)
+ 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
+-- 
+2.25.1
+
meta-oe/recipes-dbs/mysql/mariadb_10.7.4.bb +1 -3
index c800c4c56..8dba5c858 100644
@@ -1,8 +1,6 @@
 require mariadb.inc
 
-inherit qemu
-
-DEPENDS += "qemu-native bison-native boost libpcre2 curl ncurses \
+DEPENDS += "mariadb-native bison-native boost libpcre2 curl ncurses \
             zlib libaio libedit libevent libxml2 gnutls fmt lzo"
 
 PROVIDES += "mysql5 libmysqlclient"
Signature · 1 line
2.25.1

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw

Re: [oe] [meta-oe][kirkstone][PATCH] mariadb: not use qemu to run cross-compiled binaries

Ping.

Thanks,

Quoted 244 lines · Mingli

From: Mingli Yu <[email protected]>

The build fails when use qemu to run build for amd64 as below:

| make  -f libmariadb/libmariadb/CMakeFiles/mariadbclient.dir/build.make libmariadb/libmariadb/CMakeFiles/mariadbclient.dir/depend
| make  -f libmariadb/libmariadb/CMakeFiles/libmariadb.dir/build.make libmariadb/libmariadb/CMakeFiles/libmariadb.dir/depend
| make[2]: Entering directory '/build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build'
| cd /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build && /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/recipe-sysroot-native/usr/bin/cmake -E cmake_depends "Unix Makefiles" /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/mariadb-10.7.4 /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/mariadb-10.7.4/libmariadb/libmariadb /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build/libmariadb/libmariadb /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build/libmariadb/libmariadb/CMakeFiles/mariadbclient.dir/DependInfo.cmake --color=
| make[2]: Leaving directory '/build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build'
| make  -f libmariadb/libmariadb/CMakeFiles/mariadbclient.dir/build.make libmariadb/libmariadb/CMakeFiles/mariadbclient.dir/build
| Illegal instruction (core dumped)
| make[2]: *** [sql/CMakeFiles/GenServerSource.dir/build.make:76: sql/lex_hash.h] Error 132
| make[2]: *** Deleting file 'sql/lex_hash.h'
| make[2]: Entering directory '/build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build'
| [  8%] Linking C static library libmariadbclient.a
| cd /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build/libmariadb/libmariadb && /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/recipe-sysroot-native/usr/bin/cmake -P CMakeFiles/mariadbclient.dir/cmake_clean_target.cmake
| Illegal instruction (core dumped)
| Illegal instruction (core dumped)
| make[2]: *** [scripts/CMakeFiles/GenFixPrivs.dir/build.make:78: scripts/mysql_fix_privilege_tables_sql.c] Error 132

So don't use qemu to run cross-compiled binaries.

---
  .../mysql/mariadb-native_10.7.4.bb            |  4 +-
  meta-oe/recipes-dbs/mysql/mariadb.inc         | 20 +++---
  ...Lists.txt-fix-gen_lex_hash-not-found.patch | 69 +++++++++++++++++++
  .../mysql/mariadb/cross-compiling.patch       | 34 +++++++++
  meta-oe/recipes-dbs/mysql/mariadb_10.7.4.bb   |  4 +-
  5 files changed, 116 insertions(+), 15 deletions(-)

create mode 100644 meta-oe/recipes-dbs/mysql/mariadb/0001-sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch create mode 100644 meta-oe/recipes-dbs/mysql/mariadb/cross-compiling.patch

meta-oe/recipes-dbs/mysql/mariadb-native_10.7.4.bb +3 -1
index e38726d3f..17a06349b 100644
@@ -2,7 +2,9 @@ require mariadb.inc
  inherit native
 
  PROVIDES += "mysql5-native"
-DEPENDS = "ncurses-native zlib-native bison-native libpcre2-native"
+DEPENDS = "ncurses-native zlib-native bison-native libpcre2-native \
+gnutls-native fmt-native \
+"
 
  RDEPENDS:${PN} = ""
  PACKAGES = ""
meta-oe/recipes-dbs/mysql/mariadb.inc +9 -11
index 922373b63..23322cf74 100644
@@ -20,6 +20,8 @@ SRC_URI = "https://archive.mariadb.org/${BP}/source/${BP}.tar.gz \
             file://mm_malloc.patch \
             file://sys_futex.patch \
             file://mariadb-openssl3.patch \
+           file://cross-compiling.patch \
+           file://0001-sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch \
            "
  SRC_URI:append:libc-musl = " file://ppc-remove-glibc-dep.patch"
 
@@ -61,6 +63,8 @@ FILES:${PN}-setupdb = "${sysconfdir}/init.d/install_db \
                         ${bindir}/mysql-systemd-start \
                         "
 
+EXTRA_OEMAKE = "'GEN_LEX_HASH=${STAGING_BINDIR_NATIVE}/gen_lex_hash'"
+
  PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)} openssl"
  PACKAGECONFIG:class-native = ""
  PACKAGECONFIG[pam] = ",-DWITHOUT_AUTH_PAM=TRUE,libpam"
@@ -95,9 +99,9 @@ EXTRA_OECMAKE = "-DWITH_EMBEDDED_SERVER=ON \
                   -DINSTALL_SYSCONFDIR:PATH=${sysconfdir} \
                   -DMYSQL_DATADIR:PATH=/var/mysql \
                   -DCAT_EXECUTABLE=`which cat` \
+                 -DSTACK_DIRECTION=1 \
                   -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.
@@ -121,18 +125,12 @@ do_generate_toolchain_file:append:class-native () {
      sed -i "/set( CMAKE_SYSTEM_PROCESSOR/d" ${WORKDIR}/toolchain.cmake
  }
 
-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 () {
+    # 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
      if [ "${@bb.utils.contains('PACKAGECONFIG', 'krb5', 'yes', 'no', d)}" = "no" ]; then
          if ! [ -e ${B}/include/openssl/kssl.h ] ; then
              mkdir -p ${B}/include/openssl
meta-oe/recipes-dbs/mysql/mariadb/0001-sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch new file +69 -0
new file mode 100644
index 000000000..456a2bad6
@@ -0,0 +1,69 @@
+From f92f657973997df30afdb0032c88ad3a14ead46b Mon Sep 17 00:00:00 2001
+From: Mingli Yu <[email protected]>
+Date: Fri, 23 Sep 2022 15:48:21 +0800
+Subject: [PATCH] sql/CMakeLists.txt: fix gen_lex_hash not found
+
+Fix the below do_compile issue in cross-compiling env.
+| make[2]: *** No rule to make target '/build/tmp/work/aarch64-poky-linux/mariadb/10.3.13-r0/mariadb-10.3.13/sql/gen_lex_hash', needed by 'sql/lex_hash.h'.  Stop.
+| make[2]: *** No rule to make target '/build/tmp/work/aarch64-poky-linux/mariadb/10.3.13-r0/mariadb-10.3.13/sql/gen_lex_token', needed by 'sql/lex_token.h'.  Stop.
+
+Upstream-Status: Inappropriate [oe build specific]
+
+Signed-off-by: Mingli Yu <[email protected]>
+---
+ sql/CMakeLists.txt | 30 ++++++++++++++++++++++--------
+ 1 file changed, 22 insertions(+), 8 deletions(-)
+
+diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
+index 241b482..27a3991 100644
+--- a/sql/CMakeLists.txt
++++ b/sql/CMakeLists.txt
+@@ -60,11 +60,18 @@ ${CMAKE_BINARY_DIR}/sql
+ ${CMAKE_SOURCE_DIR}/tpool
+ )
+
+-ADD_CUSTOM_COMMAND(
+-  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
+-  COMMAND gen_lex_token > lex_token.h
+-  DEPENDS gen_lex_token
++IF(NOT CMAKE_CROSSCOMPILING)
++  ADD_CUSTOM_COMMAND(
++    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
++    COMMAND gen_lex_token > lex_token.h
++    DEPENDS gen_lex_token
++)
++ELSE()
++  ADD_CUSTOM_COMMAND(
++    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
++    COMMAND gen_lex_token > lex_token.h
+ )
++ENDIF()
+
+ FIND_PACKAGE(BISON 2.4)
+
+@@ -372,11 +379,18 @@ IF(NOT CMAKE_CROSSCOMPILING OR DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
+   ADD_EXECUTABLE(gen_lex_hash gen_lex_hash.cc)
+ ENDIF()
+
+-ADD_CUSTOM_COMMAND(
+-  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
+-  COMMAND gen_lex_hash > lex_hash.h
+-  DEPENDS gen_lex_hash
++IF(NOT CMAKE_CROSSCOMPILING)
++  ADD_CUSTOM_COMMAND(
++    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
++    COMMAND gen_lex_hash > lex_hash.h
++    DEPENDS gen_lex_hash
++)
++ELSE()
++  ADD_CUSTOM_COMMAND(
++    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
++    COMMAND gen_lex_hash > lex_hash.h
+ )
++ENDIF()
+
+ MYSQL_ADD_EXECUTABLE(mariadb-tzinfo-to-sql tztime.cc)
+ SET_TARGET_PROPERTIES(mariadb-tzinfo-to-sql PROPERTIES COMPILE_FLAGS "-DTZINFO2SQL")
+--
+2.25.1
+
meta-oe/recipes-dbs/mysql/mariadb/cross-compiling.patch new file +34 -0
new file mode 100644
index 000000000..d0d6e3c73
@@ -0,0 +1,34 @@
+From 80be37351d995654f86b838f6b5ed47e8a90261b Mon Sep 17 00:00:00 2001
+From: Mingli Yu <[email protected]>
+Date: Fri, 23 Sep 2022 12:05:17 +0800
+Subject: [PATCH] CMakeLists.txt: not include import_executables.cmake
+
+building failed since native does not generate import_executables.cmake
+In fact, our building system will export the needed commands.
+
+Upstream-Status: Inappropriate [oe specific]
+
+Signed-off-by: Mingli Yu <[email protected]>
+---
+ CMakeLists.txt | 5 -----
+ 1 file changed, 5 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f9e2b1b..34924ba 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -394,11 +394,6 @@ CHECK_LIBFMT()
+ ADD_SUBDIRECTORY(tpool)
+ 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
+--
+2.25.1
+
meta-oe/recipes-dbs/mysql/mariadb_10.7.4.bb +1 -4
index c800c4c56..8dba5c858 100644
@@ -1,8 +1,6 @@
  require mariadb.inc
 
-inherit qemu
-
-DEPENDS += "qemu-native bison-native boost libpcre2 curl ncurses \
+DEPENDS += "mariadb-native bison-native boost libpcre2 curl ncurses \
              zlib libaio libedit libevent libxml2 gnutls fmt lzo"
 
  PROVIDES += "mysql5 libmysqlclient"
 
 
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#98949): https://lists.openembedded.org/g/openembedded-devel/message/98949
Mute This Topic: https://lists.openembedded.org/mt/93920978/3618448
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#9 lore raw

Re: [oe] [meta-oe][kirkstone][PATCH] mariadb: not use qemu to run cross-compiled binaries

Quoted 1 line · Mingli

Ping.

Armin,

Did you miss this one since it was threaded?

../Randy

Quoted 256 lines

Thanks,

Quoted 236 lines · Mingli

From: Mingli Yu <[email protected]>

The build fails when use qemu to run build for amd64 as below:

| make  -f libmariadb/libmariadb/CMakeFiles/mariadbclient.dir/build.make libmariadb/libmariadb/CMakeFiles/mariadbclient.dir/depend
| make  -f libmariadb/libmariadb/CMakeFiles/libmariadb.dir/build.make libmariadb/libmariadb/CMakeFiles/libmariadb.dir/depend
| make[2]: Entering directory '/build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build'
| cd /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build && /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/recipe-sysroot-native/usr/bin/cmake 
-E cmake_depends "Unix Makefiles" 
/build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/mariadb-10.7.4 /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/mariadb-10.7.4/libmariadb/libmariadb /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build/libmariadb/libmariadb /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build/libmariadb/libmariadb/CMakeFiles/mariadbclient.dir/DependInfo.cmake 
--color=
| make[2]: Leaving directory '/build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build'
| make  -f libmariadb/libmariadb/CMakeFiles/mariadbclient.dir/build.make libmariadb/libmariadb/CMakeFiles/mariadbclient.dir/build
| Illegal instruction (core dumped)
| make[2]: *** [sql/CMakeFiles/GenServerSource.dir/build.make:76: sql/lex_hash.h] Error 132
| make[2]: *** Deleting file 'sql/lex_hash.h'
| make[2]: Entering directory '/build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build'
| [  8%] Linking C static library libmariadbclient.a
| cd /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build/libmariadb/libmariadb && /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/recipe-sysroot-native/usr/bin/cmake 
-P CMakeFiles/mariadbclient.dir/cmake_clean_target.cmake
| Illegal instruction (core dumped)
| Illegal instruction (core dumped)
| make[2]: *** [scripts/CMakeFiles/GenFixPrivs.dir/build.make:78: scripts/mysql_fix_privilege_tables_sql.c] Error 132

So don't use qemu to run cross-compiled binaries.

---
  .../mysql/mariadb-native_10.7.4.bb            |  4 +- meta-oe/recipes-dbs/mysql/mariadb.inc         | 20 +++--- ...Lists.txt-fix-gen_lex_hash-not-found.patch | 69 +++++++++++++++++++ .../mysql/mariadb/cross-compiling.patch       | 34 +++++++++ meta-oe/recipes-dbs/mysql/mariadb_10.7.4.bb   |  4 +-

  5 files changed, 116 insertions(+), 15 deletions(-)

  create mode 100644 meta-oe/recipes-dbs/mysql/mariadb/0001-sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch create mode 100644 meta-oe/recipes-dbs/mysql/mariadb/cross-compiling.patch

meta-oe/recipes-dbs/mysql/mariadb-native_10.7.4.bb +0 -0
index e38726d3f..17a06349b 100644
@@ -2,7 +2,9 @@ require mariadb.inc

  inherit native
    PROVIDES += "mysql5-native"

meta-oe/recipes-dbs/mysql/mariadb-native_10.7.4.bb +3 -1
-DEPENDS = "ncurses-native zlib-native bison-native libpcre2-native"
+DEPENDS = "ncurses-native zlib-native bison-native libpcre2-native \
+gnutls-native fmt-native \
+"

    RDEPENDS:${PN} = ""
  PACKAGES = ""

meta-oe/recipes-dbs/mysql/mariadb.inc +2 -0
index 922373b63..23322cf74 100644
@@ -20,6 +20,8 @@ SRC_URI = 
 "https://archive.mariadb.org/${BP}/source/${BP}.tar.gz \
              file://mm_malloc.patch \
              file://sys_futex.patch \
              file://mariadb-openssl3.patch \
+           file://cross-compiling.patch \
+ file://0001-sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch \

            "
  SRC_URI:append:libc-musl = " file://ppc-remove-glibc-dep.patch" @@ -61,6 +63,8 @@ FILES:${PN}-setupdb = "${sysconfdir}/init.d/install_db \
                         ${bindir}/mysql-systemd-start \
                         "
  +EXTRA_OEMAKE = "'GEN_LEX_HASH=${STAGING_BINDIR_NATIVE}/gen_lex_hash'" +
  PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)} openssl" PACKAGECONFIG:class-native = ""
  PACKAGECONFIG[pam] = ",-DWITHOUT_AUTH_PAM=TRUE,libpam"

meta-oe/recipes-dbs/mysql/mariadb.inc +1 -0
@@ -95,9 +99,9 @@ EXTRA_OECMAKE = "-DWITH_EMBEDDED_SERVER=ON \
                    -DINSTALL_SYSCONFDIR:PATH=${sysconfdir} \
                    -DMYSQL_DATADIR:PATH=/var/mysql \
                    -DCAT_EXECUTABLE=`which cat` \
+                 -DSTACK_DIRECTION=1 \

                   -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.

meta-oe/recipes-dbs/mysql/mariadb.inc +0 -0
@@ -121,18 +125,12 @@ do_generate_toolchain_file:append:class-native 
 () {

      sed -i "/set( CMAKE_SYSTEM_PROCESSOR/d" ${WORKDIR}/toolchain.cmake
  }
  -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

meta-oe/recipes-dbs/mysql/mariadb.inc +0 -5
-#!/bin/sh
-$qemu_binary "\$@"
-EOF
-    chmod +x ${WORKDIR}/qemuwrapper
-}

    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
      if [ "${@bb.utils.contains('PACKAGECONFIG', 'krb5', 'yes', 'no', d)}" = "no" ]; then if ! [ -e ${B}/include/openssl/kssl.h ] ; then
              mkdir -p ${B}/include/openssl

meta-oe/recipes-dbs/mysql/mariadb/0001-sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch +0 -0

new file mode 100644
index 000000000..456a2bad6
--- /dev/null
+++
b/meta-oe/recipes-dbs/mysql/mariadb/0001-sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch

meta-oe/recipes-dbs/mysql/mariadb/0001-sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch +7 -0
@@ -0,0 +1,69 @@
+From f92f657973997df30afdb0032c88ad3a14ead46b Mon Sep 17 00:00:00 2001
+From: Mingli Yu <[email protected]>
+Date: Fri, 23 Sep 2022 15:48:21 +0800
+Subject: [PATCH] sql/CMakeLists.txt: fix gen_lex_hash not found
+
+Fix the below do_compile issue in cross-compiling env.
+| make[2]: *** No rule to make target 

'/build/tmp/work/aarch64-poky-linux/mariadb/10.3.13-r0/mariadb-10.3.13/sql/gen_lex_hash', needed by 'sql/lex_hash.h'.  Stop. +| make[2]: *** No rule to make target '/build/tmp/work/aarch64-poky-linux/mariadb/10.3.13-r0/mariadb-10.3.13/sql/gen_lex_token', needed by 'sql/lex_token.h'.  Stop.

meta-oe/recipes-dbs/mysql/mariadb/0001-sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch +36 -0
+
+Upstream-Status: Inappropriate [oe build specific]
+
+Signed-off-by: Mingli Yu <[email protected]>
+---
+ sql/CMakeLists.txt | 30 ++++++++++++++++++++++--------
+ 1 file changed, 22 insertions(+), 8 deletions(-)
+
+diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
+index 241b482..27a3991 100644
+--- a/sql/CMakeLists.txt
++++ b/sql/CMakeLists.txt
+@@ -60,11 +60,18 @@ ${CMAKE_BINARY_DIR}/sql
+ ${CMAKE_SOURCE_DIR}/tpool
+ )
+
+-ADD_CUSTOM_COMMAND(
+-  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
+-  COMMAND gen_lex_token > lex_token.h
+-  DEPENDS gen_lex_token
++IF(NOT CMAKE_CROSSCOMPILING)
++  ADD_CUSTOM_COMMAND(
++    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
++    COMMAND gen_lex_token > lex_token.h
++    DEPENDS gen_lex_token
++)
++ELSE()
++  ADD_CUSTOM_COMMAND(
++    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
++    COMMAND gen_lex_token > lex_token.h
+ )
++ENDIF()
+
+ FIND_PACKAGE(BISON 2.4)
+
+@@ -372,11 +379,18 @@ IF(NOT CMAKE_CROSSCOMPILING OR DEFINED 

CMAKE_CROSSCOMPILING_EMULATOR)
+   ADD_EXECUTABLE(gen_lex_hash gen_lex_hash.cc)
+ ENDIF()

meta-oe/recipes-dbs/mysql/mariadb/0001-sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch +20 -0
+
+-ADD_CUSTOM_COMMAND(
+-  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
+-  COMMAND gen_lex_hash > lex_hash.h
+-  DEPENDS gen_lex_hash
++IF(NOT CMAKE_CROSSCOMPILING)
++  ADD_CUSTOM_COMMAND(
++    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
++    COMMAND gen_lex_hash > lex_hash.h
++    DEPENDS gen_lex_hash
++)
++ELSE()
++  ADD_CUSTOM_COMMAND(
++    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
++    COMMAND gen_lex_hash > lex_hash.h
+ )
++ENDIF()
+
+ MYSQL_ADD_EXECUTABLE(mariadb-tzinfo-to-sql tztime.cc)
+ SET_TARGET_PROPERTIES(mariadb-tzinfo-to-sql PROPERTIES 

COMPILE_FLAGS "-DTZINFO2SQL")
+--
+2.25.1

meta-oe/recipes-dbs/mysql/mariadb/0001-sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch +1 -0
+
meta-oe/recipes-dbs/mysql/mariadb/cross-compiling.patch new file +25 -0
new file mode 100644
index 000000000..d0d6e3c73
@@ -0,0 +1,34 @@
+From 80be37351d995654f86b838f6b5ed47e8a90261b Mon Sep 17 00:00:00 2001
+From: Mingli Yu <[email protected]>
+Date: Fri, 23 Sep 2022 12:05:17 +0800
+Subject: [PATCH] CMakeLists.txt: not include import_executables.cmake
+
+building failed since native does not generate import_executables.cmake
+In fact, our building system will export the needed commands.
+
+Upstream-Status: Inappropriate [oe specific]
+
+Signed-off-by: Mingli Yu <[email protected]>
+---
+ CMakeLists.txt | 5 -----
+ 1 file changed, 5 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f9e2b1b..34924ba 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -394,11 +394,6 @@ CHECK_LIBFMT()
+ ADD_SUBDIRECTORY(tpool)
+ 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
+--
+2.25.1

meta-oe/recipes-dbs/mysql/mariadb/cross-compiling.patch new file +1 -0
+
meta-oe/recipes-dbs/mysql/mariadb_10.7.4.bb +0 -0
index c800c4c56..8dba5c858 100644
@@ -1,8 +1,6 @@

  require mariadb.inc
  -inherit qemu

meta-oe/recipes-dbs/mysql/mariadb_10.7.4.bb +1 -2
-
-DEPENDS += "qemu-native bison-native boost libpcre2 curl ncurses \
+DEPENDS += "mariadb-native bison-native boost libpcre2 curl ncurses \
Quoted 7 lines

              zlib libaio libedit libevent libxml2 gnutls fmt lzo" PROVIDES += "mysql5 libmysqlclient"

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#99188): https://lists.openembedded.org/g/openembedded-devel/message/99188
Mute This Topic: https://lists.openembedded.org/mt/94378750/3616765
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 2 lines
# Randy MacLeod
# Wind River Linux

A message that is not in the archive (sent off-list or not yet received): [email protected]

#11 lore raw
# bitbake -cdevshell mariadb
# pwd
/build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/mariadb-10.7.4
# cd /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build/scripts && /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/qemuwrapper /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build/scripts/comp_sql mysql_fix_privilege_tables mysql_fix_privilege_tables.sql mysql_fix_privilege_tables_sql.c
qemu: uncaught target signal 4 (Illegal instruction) - core dumped
Illegal instruction (core dumped)

Thanks,

Quoted 286 lines · Mingli

Failed to build for amd64:

| make[2]: Leaving directory '/build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build'
| qemu: uncaught target signal 4 (Illegal instruction) - core dumped
| [  4%] Built target tpool
| [  8%] Built target skip_all-t
| [  4%] Built target no_plan-t
| [  8%] Built target wsrep-lib
| [  8%] Built target ref10
| [  8%] Built target mariadb_obj
| make  -f libmariadb/libmariadb/CMakeFiles/mariadbclient.dir/build.make libmariadb/libmariadb/CMakeFiles/mariadbclient.dir/depend
| make  -f libmariadb/libmariadb/CMakeFiles/libmariadb.dir/build.make libmariadb/libmariadb/CMakeFiles/libmariadb.dir/depend
| make[2]: Entering directory '/build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build'
| cd /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build && /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/recipe-sysroot-native/usr/bin/cmake 
-E cmake_depends "Unix Makefiles" 
/build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/mariadb-10.7.4 /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/mariadb-10.7.4/libmariadb/libmariadb /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build/libmariadb/libmariadb /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build/libmariadb/libmariadb/CMakeFiles/mariadbclient.dir/DependInfo.cmake 
--color=
| make[2]: Leaving directory '/build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build'
| make  -f libmariadb/libmariadb/CMakeFiles/mariadbclient.dir/build.make libmariadb/libmariadb/CMakeFiles/mariadbclient.dir/build
| Illegal instruction (core dumped)
| make[2]: *** [sql/CMakeFiles/GenServerSource.dir/build.make:76: sql/lex_hash.h] Error 132
| make[2]: *** Deleting file 'sql/lex_hash.h'
| make[2]: Entering directory '/build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build'
| [  8%] Linking C static library libmariadbclient.a
| cd /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/build/libmariadb/libmariadb && /build/tmp-glibc/work/dbfp5-wrs-linux/mariadb/10.7.4-r0/recipe-sysroot-native/usr/bin/cmake 
-P CMakeFiles/mariadbclient.dir/cmake_clean_target.cmake
| Illegal instruction (core dumped)
| Illegal instruction (core dumped)
| make[2]: *** [scripts/CMakeFiles/GenFixPrivs.dir/build.make:78: scripts/mysql_fix_privilege_tables_sql.c] Error 132

Thanks,

Quoted 237 lines · Khem Raj

[Please note: This e-mail is from an EXTERNAL e-mail address]

Quoted 3 lines · Zoltán Böszörményi

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

how does build time gets impacted ? you can count that native build is not needed but still it will be good to know.
qemu dependency also means that qemu usermode has to be supported for this to work, which maybe troublesome on some
newer or lesser known architectures but perhaps thats a fine compromise perhaps.

Quoted 224 lines

---
  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 +0 -0
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 \

meta-oe/recipes-dbs/mysql/mariadb.inc +0 -0
@@ -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 \
            "

meta-oe/recipes-dbs/mysql/mariadb.inc +0 -0
@@ -60,8 +58,6 @@ SYSTEMD_AUTO_ENABLE_${PN}-setupdb ?= "enable"

  ALLOW_EMPTY_${PN}-setupdb ?= "1" FILES_${PN}-setupdb = "${sysconfdir}/init.d/install_db"

meta-oe/recipes-dbs/mysql/mariadb.inc +0 -2
-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"

meta-oe/recipes-dbs/mysql/mariadb.inc +0 -0
@@ -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"

meta-oe/recipes-dbs/mysql/mariadb.inc +0 -0
@@ -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

meta-oe/recipes-dbs/mysql/mariadb.inc +6 -0
+#!/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

meta-oe/recipes-dbs/mysql/mariadb.inc +0 -0
@@ -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 -19
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()

Signature · 3 lines
- #
- # 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 +0 -0

deleted file mode 100644
index 4cb044339..000000000
---
a/meta-oe/recipes-dbs/mysql/mariadb/sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch

+++ /dev/null

meta-oe/recipes-dbs/mysql/mariadb/sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch +0 -7
@@ -1,67 +0,0 @@
-From cfce1491827e5a581878b5e166bf4d30e6d90e07 Mon Sep 17 00:00:00 2001
-From: Mingli Yu <[email protected]>
-Date: Thu, 23 Jul 2020 00:08:16 -0700
-Subject: [PATCH] sql/CMakeLists.txt: fix gen_lex_hash not found
-
-Fix the below do_compile issue in cross-compiling env.
-| make[2]: *** No rule to make target 

'/build/tmp/work/aarch64-poky-linux/mariadb/10.3.13-r0/mariadb-10.3.13/sql/gen_lex_hash', needed by 'sql/lex_hash.h'.  Stop. -| make[2]: *** No rule to make target '/build/tmp/work/aarch64-poky-linux/mariadb/10.3.13-r0/mariadb-10.3.13/sql/gen_lex_token', needed by 'sql/lex_token.h'.  Stop.

meta-oe/recipes-dbs/mysql/mariadb/sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch +0 -56
-
-Upstream-Status: Inappropriate [oe build specific]
-
-Signed-off-by: Mingli Yu <[email protected]>
----
- sql/CMakeLists.txt | 30 ++++++++++++++++++++----------
- 1 file changed, 20 insertions(+), 10 deletions(-)
-
-diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
-index 0dc3caa..616017b 100644
---- a/sql/CMakeLists.txt
-+++ b/sql/CMakeLists.txt
-@@ -52,11 +52,16 @@ ${CMAKE_BINARY_DIR}/sql
- ${CMAKE_SOURCE_DIR}/tpool
- )
-
--ADD_CUSTOM_COMMAND(
--  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
--  COMMAND gen_lex_token > lex_token.h
--  DEPENDS gen_lex_token
--)
-+IF(NOT CMAKE_CROSSCOMPILING)
-+  ADD_CUSTOM_COMMAND(
-+   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
-+   COMMAND gen_lex_token > lex_token.h
-+   DEPENDS gen_lex_token)
-+ELSE()
-+  ADD_CUSTOM_COMMAND(
-+   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
-+   COMMAND gen_lex_token > lex_token.h)
-+ENDIF()
-
- ADD_CUSTOM_COMMAND(
-   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc_ora.yy
-@@ -345,11 +350,16 @@ IF(NOT CMAKE_CROSSCOMPILING)
-   ADD_EXECUTABLE(gen_lex_hash gen_lex_hash.cc)
- ENDIF()
-
--ADD_CUSTOM_COMMAND(
--  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
--  COMMAND gen_lex_hash > lex_hash.h
--  DEPENDS gen_lex_hash
--)
-+IF(NOT CMAKE_CROSSCOMPILING)
-+  ADD_CUSTOM_COMMAND(
-+   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
-+   COMMAND gen_lex_hash > lex_hash.h
-+   DEPENDS gen_lex_hash)
-+ELSE()
-+  ADD_CUSTOM_COMMAND(
-+   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
-+   COMMAND gen_lex_hash > lex_hash.h)
-+ENDIF()
-
- MYSQL_ADD_EXECUTABLE(mariadb-tzinfo-to-sql tztime.cc COMPONENT Server)
- SET_TARGET_PROPERTIES(mariadb-tzinfo-to-sql PROPERTIES 

COMPILE_FLAGS "-DTZINFO2SQL")
---
-2.17.1

meta-oe/recipes-dbs/mysql/mariadb/sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch +0 -1
-
meta-oe/recipes-dbs/mysql/mariadb_10.5.10.bb +0 -0
index 8ae8241b0..57d7736ea 100644
@@ -1,8 +1,8 @@

  require mariadb.inc

meta-oe/recipes-dbs/mysql/mariadb_10.5.10.bb +1 -2
-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"

Quoted 7 lines
Quoted 7 lines
Signature · 1 line
2.31.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#98920): https://lists.openembedded.org/g/openembedded-devel/message/98920
Mute This Topic: https://lists.openembedded.org/mt/84015256/3618448
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#13 lore raw

Re: [meta-oe][PATCH 2/2] mariadb: Upgrade to 10.5.11

it also needed musl patch refresh, since it was straight forward I took care if it this time. Revised patch is in master-next

Quoted 34 lines · Zoltán Böszörményi
---
 .../{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 -1
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
--

2.31.1