Details
Description
MariaDB fails to build with the latest libfmt 10.1.0 (https://github.com/fmtlib/fmt/releases/tag/10.1.0). CMake configuration fails with the following:
CMake Error at cmake/libfmt.cmake:45 (MESSAGE):
|
system libfmt library is not found or unusable
|
The underlying error is that the code snippet in cmake/libfmt.cmake fails to compile (compiler explorer: https://godbolt.org/z/bWGoW55x3 ):
#define FMT_STATIC_THOUSANDS_SEPARATOR ','
|
#define FMT_HEADER_ONLY 1
|
#include <fmt/format-inl.h>
|
#include <iostream>
|
int main() { |
fmt::format_args::format_arg arg=
|
fmt::detail::make_arg<fmt::format_context>(42);
|
std::cout << fmt::vformat("The answer is {}.", |
fmt::format_args(&arg, 1));
|
}
|
<source>: In function 'int main()':
|
<source>:7:47: error: no matching function for call to 'make_arg<fmt::v10::format_context>(int)'
|
7 | fmt::detail::make_arg<fmt::format_context>(42);
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
|
In file included from /opt/compiler-explorer/libs/fmt/trunk/include/fmt/format.h:49,
|
from /opt/compiler-explorer/libs/fmt/trunk/include/fmt/format-inl.h:25,
|
from <source>:3:
|
/opt/compiler-explorer/libs/fmt/trunk/include/fmt/core.h:1588:20: note: candidate: 'constexpr fmt::v10::basic_format_arg<Context> fmt::v10::detail::make_arg(T&) [with Context = fmt::v10::basic_format_context<fmt::v10::appender, char>; T = int]' (near match)
|
1588 | FMT_CONSTEXPR auto make_arg(T& val) -> basic_format_arg<Context> {
|
| ^~~~~~~~
|
/opt/compiler-explorer/libs/fmt/trunk/include/fmt/core.h:1588:20: note: conversion of argument 1 would be ill-formed:
|
<source>:7:48: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
|
7 | fmt::detail::make_arg<fmt::format_context>(42);
|
| ^~
|
/opt/compiler-explorer/libs/fmt/trunk/include/fmt/core.h:1559:31: note: candidate: 'template<bool PACKED, class Context, class T, typename std::enable_if<PACKED, int>::type <anonymous> > constexpr fmt::v10::detail::value<Context> fmt::v10::detail::make_arg(T&)'
|
1559 | FMT_CONSTEXPR FMT_INLINE auto make_arg(T& val) -> value<Context> {
|
| ^~~~~~~~
|
/opt/compiler-explorer/libs/fmt/trunk/include/fmt/core.h:1559:31: note: template argument deduction/substitution failed:
|
<source>:7:47: error: type/value mismatch at argument 1 in template parameter list for 'template<bool PACKED, class Context, class T, typename std::enable_if<PACKED, int>::type <anonymous> > constexpr fmt::v10::detail::value<Context> fmt::v10::detail::make_arg(T&)'
|
7 | fmt::detail::make_arg<fmt::format_context>(42);
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
|
<source>:7:47: note: expected a constant of type 'bool', got 'fmt::v10::format_context' {aka 'fmt::v10::basic_format_context<fmt::v10::appender, char>'}
|
/opt/compiler-explorer/libs/fmt/trunk/include/fmt/core.h:1596:27: note: candidate: 'template<bool PACKED, class Context, class T, typename std::enable_if<(! PACKED), int>::type <anonymous> > constexpr fmt::v10::basic_format_arg<Context> fmt::v10::detail::make_arg(T&)'
|
1596 | FMT_CONSTEXPR inline auto make_arg(T& val) -> basic_format_arg<Context> {
|
| ^~~~~~~~
|
/opt/compiler-explorer/libs/fmt/trunk/include/fmt/core.h:1596:27: note: template argument deduction/substitution failed:
|
<source>:7:47: error: type/value mismatch at argument 1 in template parameter list for 'template<bool PACKED, class Context, class T, typename std::enable_if<(! PACKED), int>::type <anonymous> > constexpr fmt::v10::basic_format_arg<Context> fmt::v10::detail::make_arg(T&)'
|
7 | fmt::detail::make_arg<fmt::format_context>(42);
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
|
<source>:7:47: note: expected a constant of type 'bool', got 'fmt::v10::format_context' {aka 'fmt::v10::basic_format_context<fmt::v10::appender, char>'}
|
Compiler returned: 1
|
sql/item_strfunc.cc also fails to compile, with basically the same error. Error output can be found in the attachment item_strfunc.log.
The reason behind this is that fmt::detail::make_arg does not accept temporaries, as mentioned in https://github.com/fmtlib/fmt/issues/3596#issuecomment-1679244746.
This error was observed while packaging MariaDB 10.9.8 (https://github.com/Homebrew/homebrew-core/pull/139568), 10.10.6 (https://github.com/Homebrew/homebrew-core/pull/139563), 10.11.5 (https://github.com/Homebrew/homebrew-core/pull/139564), and 11.0.3 (https://github.com/Homebrew/homebrew-core/pull/139562) for Homebrew. I believe that this also affects all other versions where libfmt is used, including the newest 11.3 that's still under development.
Attachments
Issue Links
- is duplicated by
-
MDEV-32564 Mariadb not detect libfmt libs existing in system
- Closed