Skip to contentSkip to conversation

package/gerbera: fix build with fmt > 8.0

PATCH Applied Fabrice Fontaine 2 participants 2 messages Feb 6, 2022 – Feb 13, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/gerbera: fix build with fmt > 8.0

Fix the following build failure raised since bump of fmt to version 8.1.1 in commit ec7fd50d08690a383fec40748ac9b78c3f764316:

/home/peko/autobuild/instance-0/output-1/host/mips64el-buildroot-linux-uclibc/sysroot/usr/include/fmt/core.h:1728:7: error: static assertion failed: Cannot format an argument. To make type T formattable provide a formatter<T> specialization: https://fmt.dev/latest/api.html#udt

       formattable,
       ^~~~~~~~~~~

Fixes:
- http://autobuild.buildroot.org/results/009db44f83c3b02025c910ce4f190bd709c5ab49

---
 package/gerbera/0001-Fix-for-fmt-8-0.patch | 44 ++++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 package/gerbera/0001-Fix-for-fmt-8-0.patch
package/gerbera/0001-Fix-for-fmt-8-0.patch new file +44 -0
new file mode 100644
index 0000000000..c4419209a5
@@ -0,0 +1,44 @@
+From 82d84ac5e62c23e717198fc7b2ef190ff95e70d1 Mon Sep 17 00:00:00 2001
+From: kyak <[email protected]>
+Date: Wed, 12 Jan 2022 19:41:37 +0300
+Subject: [PATCH] Fix for fmt > 8.0
+
+[Retrieved from:
+https://github.com/gerbera/gerbera/commit/82d84ac5e62c23e717198fc7b2ef190ff95e70d1]
+Signed-off-by: Fabrice Fontaine <[email protected]>
+---
+ src/util/logger.h | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+diff --git a/src/util/logger.h b/src/util/logger.h
+index 58696e52f..ba64afa79 100644
+--- a/src/util/logger.h
++++ b/src/util/logger.h
+@@ -32,7 +32,9 @@
+ #ifndef __LOGGER_H__
+ #define __LOGGER_H__
+ 
++#include <fmt/format.h>
+ #include <spdlog/spdlog.h>
++#include <type_traits>
+ 
+ #define log_debug SPDLOG_DEBUG
+ #define log_info SPDLOG_INFO
+@@ -40,4 +42,17 @@
+ #define log_error SPDLOG_ERROR
+ #define log_js SPDLOG_INFO
+ 
++#if FMT_VERSION >= 80100
++template <typename T>
++struct fmt::formatter<T, std::enable_if_t<std::is_enum_v<T>, char>>
++    : formatter<std::underlying_type_t<T>> {
++    template <typename FormatContext>
++    auto format(const T& value, FormatContext& ctx) -> decltype(ctx.out())
++    {
++        return fmt::formatter<std::underlying_type_t<T>>::format(
++            static_cast<std::underlying_type_t<T>>(value), ctx);
++    }
++};
++#endif
++
+ #endif // __LOGGER_H__
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 11 lines · Fabrice Fontaine

Fix the following build failure raised since bump of fmt to version 8.1.1 in commit ec7fd50d08690a383fec40748ac9b78c3f764316:

/home/peko/autobuild/instance-0/output-1/host/mips64el-buildroot-linux-uclibc/sysroot/usr/include/fmt/core.h:1728:7: error: static assertion failed: Cannot format an argument. To make type T formattable provide a formatter<T> specialization: https://fmt.dev/latest/api.html#udt

        formattable,
        ^~~~~~~~~~~

Fixes:
- http://autobuild.buildroot.org/results/009db44f83c3b02025c910ce4f190bd709c5ab49

Applied to master, thanks.

Regards,
Arnout

Quoted 45 lines
---
  package/gerbera/0001-Fix-for-fmt-8-0.patch | 44 ++++++++++++++++++++++
  1 file changed, 44 insertions(+)

create mode 100644 package/gerbera/0001-Fix-for-fmt-8-0.patch

package/gerbera/0001-Fix-for-fmt-8-0.patch new file +34 -0
new file mode 100644
index 0000000000..c4419209a5
@@ -0,0 +1,44 @@
+From 82d84ac5e62c23e717198fc7b2ef190ff95e70d1 Mon Sep 17 00:00:00 2001
+From: kyak <[email protected]>
+Date: Wed, 12 Jan 2022 19:41:37 +0300
+Subject: [PATCH] Fix for fmt > 8.0
+
+[Retrieved from:
+https://github.com/gerbera/gerbera/commit/82d84ac5e62c23e717198fc7b2ef190ff95e70d1]
+Signed-off-by: Fabrice Fontaine <[email protected]>
+---
+ src/util/logger.h | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+diff --git a/src/util/logger.h b/src/util/logger.h
+index 58696e52f..ba64afa79 100644
+--- a/src/util/logger.h
++++ b/src/util/logger.h
+@@ -32,7 +32,9 @@
+ #ifndef __LOGGER_H__
+ #define __LOGGER_H__
+
++#include <fmt/format.h>
+ #include <spdlog/spdlog.h>
++#include <type_traits>
+
+ #define log_debug SPDLOG_DEBUG
+ #define log_info SPDLOG_INFO
+@@ -40,4 +42,17 @@
+ #define log_error SPDLOG_ERROR
+ #define log_js SPDLOG_INFO
+
++#if FMT_VERSION >= 80100
++template <typename T>
++struct fmt::formatter<T, std::enable_if_t<std::is_enum_v<T>, char>>
++    : formatter<std::underlying_type_t<T>> {

package/gerbera/0001-Fix-for-fmt-8-0.patch line 44

Quoted 10 lines
package/gerbera/0001-Fix-for-fmt-8-0.patch new file +10 -0
++    template <typename FormatContext>
++    auto format(const T& value, FormatContext& ctx) -> decltype(ctx.out())
++    {
++        return fmt::formatter<std::underlying_type_t<T>>::format(
++            static_cast<std::underlying_type_t<T>>(value), ctx);
++    }
++};
++#endif
++
+ #endif // __LOGGER_H__

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot