You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
explicitly include fmt/ostream.h for fmt::print()
The `fmt::print(std::ostream&, ...)` API is provided through `fmt/ostream.h`.
Previously, we relied on indirect inclusion of this header through other
fmt headers, which was fragile and broke with fmt 8.x.
Fix this by explicitly including `fmt/ostream.h` in all source files that
use the ostream API. This addresses build failures with fmt 8.x while
making the header dependencies more explicit.
See https://fmt.dev/11.0/api/#ostream-apiFixesscylladb#2584
Signed-off-by: Kefu Chai <[email protected]>
Hi,
I am having trouble building the latest version of seastar (master branch).
Platform: Ubuntu 22.04.4 LTS
g++ version: 12.3.0
Boost version: 1.73
Configured with command:
./configure.py --mode=release --prefix=/opt/seastar --without-tests
The compilation fails with log
[53/100] Building CXX object CMakeFiles/seastar.dir/src/net/ethernet.cc.o FAILED: CMakeFiles/seastar.dir/src/net/ethernet.cc.o /usr/bin/g++ -DBOOST_NO_CXX98_FUNCTION_BASE -DFMT_LOCALE -DFMT_SHARED -DSEASTAR_API_LEVEL=7 -DSEASTAR_DEFERRED_ACTION_REQUIRE_NOEXCEPT -DSEASTAR_DEPRECATED_OSTREAM_FORMATTERS -DSEASTAR_HAS_MEMBARRIER -DSEASTAR_HAVE_ASAN_FIBER_SUPPORT -DSEASTAR_HAVE_HWLOC -DSEASTAR_HAVE_NUMA -DSEASTAR_HAVE_SYSTEMTAP_SDT -DSEASTAR_HAVE_URING -DSEASTAR_LOGGER_COMPILE_TIME_FMT -DSEASTAR_LOGGER_TYPE_STDOUT -DSEASTAR_PTHREAD_ATTR_SETAFFINITY_NP -DSEASTAR_SCHEDULING_GROUPS_COUNT=16 -DSEASTAR_SSTRING -DSEASTAR_STRERROR_R_CHAR_P -I/home/alevandal/work/seastar/include -I/home/alevandal/work/seastar/build/release/gen/include -I/home/alevandal/work/seastar/build/release/gen/src -I/home/alevandal/work/seastar/src -isystem /home/alevandal/work/boost_1_73_0 -O2 -g -DNDEBUG -Wno-maybe-uninitialized -Wno-error=unused-result -fno-semantic-interposition -UNDEBUG -Wall -Werror -Wimplicit-fallthrough -Wdeprecated -Wno-error=deprecated -Wno-error=stringop-overflow -Wno-error=array-bounds -Wdeprecated-declarations -Wno-error=deprecated-declarations -fvisibility=hidden -gz -std=gnu++23 -MD -MT CMakeFiles/seastar.dir/src/net/ethernet.cc.o -MF CMakeFiles/seastar.dir/src/net/ethernet.cc.o.d -o CMakeFiles/seastar.dir/src/net/ethernet.cc.o -c /home/alevandal/work/seastar/src/net/ethernet.cc /home/alevandal/work/seastar/src/net/ethernet.cc: In function ‘std::ostream& seastar::net::operator<<(std::ostream&, ethernet_address)’: /home/alevandal/work/seastar/src/net/ethernet.cc:34:15: error: no matching function for call to ‘print(std::ostream&, const char [42], u, u, u, u, u, u)’ 34 | fmt::print(os, "{:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}", | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 35 | u(m[0]), u(m[1]), u(m[2]), u(m[3]), u(m[4]), u(m[5])); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/fmt/format.h:48, from /home/alevandal/work/seastar/include/seastar/core/sstring.hh:40, from /home/alevandal/work/seastar/include/seastar/core/format.hh:24, from /home/alevandal/work/seastar/include/seastar/core/print.hh:24, from /home/alevandal/work/seastar/src/net/ethernet.cc:22: /usr/include/fmt/core.h:3206:17: note: candidate: ‘void fmt::v8::print(format_string<T ...>, T&& ...) [with T = {const char (&)[42], unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int}; format_string<T ...> = basic_format_string<char, const char (&)[42], unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>]’ 3206 | FMT_INLINE void print(format_string<T...> fmt, T&&... args) { | ^~~~~ /usr/include/fmt/core.h:3206:43: note: no known conversion for argument 1 from ‘std::ostream’ {aka ‘std::basic_ostream<char>’} to ‘fmt::v8::format_string<const char (&)[42], unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>’ {aka ‘fmt::v8::basic_format_string<char, const char (&)[42], unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>’} 3206 | FMT_INLINE void print(format_string<T...> fmt, T&&... args) { | ~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/fmt/core.h:3223:17: note: candidate: ‘template<class ... T> void fmt::v8::print(FILE*, format_string<T ...>, T&& ...)’ 3223 | FMT_INLINE void print(std::FILE* f, format_string<T...> fmt, T&&... args) { | ^~~~~ /usr/include/fmt/core.h:3223:17: note: template argument deduction/substitution failed: /home/alevandal/work/seastar/src/net/ethernet.cc:34:16: note: cannot convert ‘os’ (type ‘std::ostream’ {aka ‘std::basic_ostream<char>’}) to type ‘FILE*’ 34 | fmt::print(os, "{:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}", | ^~ [62/100] Building CXX object CMakeFiles/seastar.dir/src/core/reactor.cc.o ninja: build stopped: subcommand failed.
I have tried boost-1.78, boost-1.86, g++ 11, clang 14, still without success.
Could you provide any advise?
The text was updated successfully, but these errors were encountered: