From 4cfdfa16f2491708142fc7d0ec58a4ec67fa1996 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Thu, 17 Aug 2023 16:43:43 -0700 Subject: [PATCH] mariadb: Fix build with libfmt 10.1+ Signed-off-by: Khem Raj Cc: Markus Volk Cc: Wang Mingyu --- meta-oe/recipes-dbs/mysql/mariadb.inc | 1 + .../mysql/mariadb/libfmt_make_fmt.patch | 68 +++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 meta-oe/recipes-dbs/mysql/mariadb/libfmt_make_fmt.patch diff --git a/meta-oe/recipes-dbs/mysql/mariadb.inc b/meta-oe/recipes-dbs/mysql/mariadb.inc index ee3fe0a3285..d64d5b0e426 100644 --- a/meta-oe/recipes-dbs/mysql/mariadb.inc +++ b/meta-oe/recipes-dbs/mysql/mariadb.inc @@ -23,6 +23,7 @@ SRC_URI = "https://archive.mariadb.org/${BP}/source/${BP}.tar.gz \ file://0001-sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch \ file://lfs64.patch \ file://0001-Add-missing-includes-cstdint-and-cstdio.patch \ + file://libfmt_make_fmt.patch \ " SRC_URI:append:libc-musl = " file://ppc-remove-glibc-dep.patch" SRC_URI[sha256sum] = "4c9484048d4d0c71dd076ab33fc2a9ce8510bdf762886de0d63fe52496f3dbbb" diff --git a/meta-oe/recipes-dbs/mysql/mariadb/libfmt_make_fmt.patch b/meta-oe/recipes-dbs/mysql/mariadb/libfmt_make_fmt.patch new file mode 100644 index 00000000000..4d5f4a611b2 --- /dev/null +++ b/meta-oe/recipes-dbs/mysql/mariadb/libfmt_make_fmt.patch @@ -0,0 +1,68 @@ +Make make_arg work with libfmt 10.1+ + +This ensures that compiler can find the correct template to use +Fixes + +mariadb-10.11.5/sql/item_strfunc.cc:1429:22: error: no matching functi +on for call to 'make_arg' +| 1429 | vargs[carg-1]= fmt::detail::make_arg(args[carg]->val_int()); +| | ^~~~~~~~~~~~~~~~~~~~~~~~~~ +| /mnt/b/yoe/master/build/tmp/work/cortexa72-cortexa53-crypto-yoe-linux/mariadb/10.11.5/recipe-sysroot/usr/include/fmt/core.h:1588:20: note: candidate functio +n [with Context = fmt::basic_format_context, T = long long] not viable: expects an lvalue for 1st argument +| 1588 | FMT_CONSTEXPR auto make_arg(T& val) -> basic_format_arg { +| | ^ ~~~~~~ +| /mnt/b/yoe/master/build/tmp/work/cortexa72-cortexa53-crypto-yoe-linux/mariadb/10.11.5/recipe-sysroot/usr/include/fmt/core.h:1559:31: note: candidate templat +e ignored: invalid explicitly-specified argument for template parameter 'PACKED' +| 1559 | FMT_CONSTEXPR FMT_INLINE auto make_arg(T& [ 46%] Building C object mysys/CMakeFiles/mysys.dir/my_likely.c.o +| val) -> value { +| | ^ +| /mnt/b/yoe/master/build/tmp/work/cortexa72-cortexa53-crypto-yoe-linux/mariadb/10.11.5/recipe-sysroot/usr/include/fmt/core.h:1596:27: note: candidate templat +e ignored: invalid explicitly-specified argument for template parameter 'PACKED' +| 1596 | FMT_CONSTEXPR inline auto make_arg(T& val) -> basic_format_arg { +| | ^ + +Upstream-Status: Pending +Signed-off-by: Khem Raj + +--- a/cmake/libfmt.cmake ++++ b/cmake/libfmt.cmake +@@ -33,8 +33,9 @@ MACRO (CHECK_LIBFMT) + #include + #include + int main() { ++ int val = 42; + fmt::format_args::format_arg arg= +- fmt::detail::make_arg(42); ++ fmt::detail::make_arg(val); + std::cout << fmt::vformat(\"The answer is {}.\", + fmt::format_args(&arg, 1)); + }" HAVE_SYSTEM_LIBFMT) +--- a/sql/item_strfunc.cc ++++ b/sql/item_strfunc.cc +@@ -1426,14 +1426,22 @@ String *Item_func_sformat::val_str(Strin + switch (args[carg]->result_type()) + { + case INT_RESULT: +- vargs[carg-1]= fmt::detail::make_arg(args[carg]->val_int()); ++ int intval; ++ intval = args[carg]->val_int(); ++ vargs[carg-1]= fmt::detail::make_arg(intval); + break; + case DECIMAL_RESULT: // TODO + case REAL_RESULT: ++ float fval; ++ int val; + if (args[carg]->field_type() == MYSQL_TYPE_FLOAT) +- vargs[carg-1]= fmt::detail::make_arg((float)args[carg]->val_real()); +- else +- vargs[carg-1]= fmt::detail::make_arg(args[carg]->val_real()); ++ { ++ fval = (float)args[carg]->val_real(); ++ vargs[carg-1]= fmt::detail::make_arg(fval); ++ } else { ++ val = args[carg]->val_real(); ++ vargs[carg-1]= fmt::detail::make_arg(val); ++ } + break; + case STRING_RESULT: + if (!(parg= args[carg]->val_str(&val_arg[carg-1])))