Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spdlog 1.14.1 fails to build with fmt 11.0.1 #3129

Closed
brad0 opened this issue Jul 7, 2024 · 2 comments · Fixed by #3130
Closed

spdlog 1.14.1 fails to build with fmt 11.0.1 #3129

brad0 opened this issue Jul 7, 2024 · 2 comments · Fixed by #3130

Comments

@brad0
Copy link

brad0 commented Jul 7, 2024

Updating our system copy of fmt to 11.0.1 I see spdlog 1.14.1 fails to build with an issue in example code.

[1/10] /home/ports/pobj/spdlog-1.14.1/bin/c++ -DFMT_SHARED -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -DSPDLOG_SHARED_LIB -Dspdlog_EXPORTS -I/home/ports/pobj/spdlog-1.14.1/spdlog-1.14.1/include -isystem /usr/local/include -O2 -pipe -DNDEBUG -std=c++11 -fPIC -MD -MT CMakeFiles/spdlog.dir/src/spdlog.cpp.o -MF CMakeFiles/spdlog.dir/src/spdlog.cpp.o.d -o CMakeFiles/spdlog.dir/src/spdlog.cpp.o -c /home/ports/pobj/spdlog-1.14.1/spdlog-1.14.1/src/spdlog.cpp
[2/10] /home/ports/pobj/spdlog-1.14.1/bin/c++ -DFMT_SHARED -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -DSPDLOG_SHARED_LIB -Dspdlog_EXPORTS -I/home/ports/pobj/spdlog-1.14.1/spdlog-1.14.1/include -isystem /usr/local/include -O2 -pipe -DNDEBUG -std=c++11 -fPIC -MD -MT CMakeFiles/spdlog.dir/src/stdout_sinks.cpp.o -MF CMakeFiles/spdlog.dir/src/stdout_sinks.cpp.o.d -o CMakeFiles/spdlog.dir/src/stdout_sinks.cpp.o -c /home/ports/pobj/spdlog-1.14.1/spdlog-1.14.1/src/stdout_sinks.cpp
[3/10] /home/ports/pobj/spdlog-1.14.1/bin/c++ -DFMT_SHARED -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -DSPDLOG_SHARED_LIB -Dspdlog_EXPORTS -I/home/ports/pobj/spdlog-1.14.1/spdlog-1.14.1/include -isystem /usr/local/include -O2 -pipe -DNDEBUG -std=c++11 -fPIC -MD -MT CMakeFiles/spdlog.dir/src/color_sinks.cpp.o -MF CMakeFiles/spdlog.dir/src/color_sinks.cpp.o.d -o CMakeFiles/spdlog.dir/src/color_sinks.cpp.o -c /home/ports/pobj/spdlog-1.14.1/spdlog-1.14.1/src/color_sinks.cpp
[4/10] /home/ports/pobj/spdlog-1.14.1/bin/c++ -DFMT_SHARED -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -DSPDLOG_SHARED_LIB -Dspdlog_EXPORTS -I/home/ports/pobj/spdlog-1.14.1/spdlog-1.14.1/include -isystem /usr/local/include -O2 -pipe -DNDEBUG -std=c++11 -fPIC -MD -MT CMakeFiles/spdlog.dir/src/file_sinks.cpp.o -MF CMakeFiles/spdlog.dir/src/file_sinks.cpp.o.d -o CMakeFiles/spdlog.dir/src/file_sinks.cpp.o -c /home/ports/pobj/spdlog-1.14.1/spdlog-1.14.1/src/file_sinks.cpp
[5/10] /home/ports/pobj/spdlog-1.14.1/bin/c++ -DFMT_SHARED -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -DSPDLOG_SHARED_LIB -Dspdlog_EXPORTS -I/home/ports/pobj/spdlog-1.14.1/spdlog-1.14.1/include -isystem /usr/local/include -O2 -pipe -DNDEBUG -std=c++11 -fPIC -MD -MT CMakeFiles/spdlog.dir/src/async.cpp.o -MF CMakeFiles/spdlog.dir/src/async.cpp.o.d -o CMakeFiles/spdlog.dir/src/async.cpp.o -c /home/ports/pobj/spdlog-1.14.1/spdlog-1.14.1/src/async.cpp
[6/10] /home/ports/pobj/spdlog-1.14.1/bin/c++ -DFMT_SHARED -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -DSPDLOG_SHARED_LIB -Dspdlog_EXPORTS -I/home/ports/pobj/spdlog-1.14.1/spdlog-1.14.1/include -isystem /usr/local/include -O2 -pipe -DNDEBUG -std=c++11 -fPIC -MD -MT CMakeFiles/spdlog.dir/src/cfg.cpp.o -MF CMakeFiles/spdlog.dir/src/cfg.cpp.o.d -o CMakeFiles/spdlog.dir/src/cfg.cpp.o -c /home/ports/pobj/spdlog-1.14.1/spdlog-1.14.1/src/cfg.cpp
[7/10] : && /home/ports/pobj/spdlog-1.14.1/bin/c++ -fPIC -O2 -pipe -DNDEBUG   -shared -Wl,-soname,libspdlog.so.2.0 -o libspdlog.so.2.0 CMakeFiles/spdlog.dir/src/spdlog.cpp.o CMakeFiles/spdlog.dir/src/stdout_sinks.cpp.o CMakeFiles/spdlog.dir/src/color_sinks.cpp.o CMakeFiles/spdlog.dir/src/file_sinks.cpp.o CMakeFiles/spdlog.dir/src/async.cpp.o CMakeFiles/spdlog.dir/src/cfg.cpp.o  -Wl,-z,origin,-rpath,/usr/local/lib:  /usr/local/lib/libfmt.so.3.0  -Wl,-rpath-link,/usr/X11R6/lib:/usr/local/lib && :
[8/10] /usr/local/bin/cmake -E cmake_symlink_library libspdlog.so.2.0 libspdlog.so.2.0 libspdlog.so && :
[9/10] /home/ports/pobj/spdlog-1.14.1/bin/c++ -DFMT_SHARED -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -DSPDLOG_SHARED_LIB -I/home/ports/pobj/spdlog-1.14.1/spdlog-1.14.1/include -isystem /usr/local/include -O2 -pipe -DNDEBUG -std=c++11 -MD -MT example/CMakeFiles/example.dir/example.cpp.o -MF example/CMakeFiles/example.dir/example.cpp.o.d -o example/CMakeFiles/example.dir/example.cpp.o -c /home/ports/pobj/spdlog-1.14.1/spdlog-1.14.1/example/example.cpp
FAILED: example/CMakeFiles/example.dir/example.cpp.o
/home/ports/pobj/spdlog-1.14.1/bin/c++ -DFMT_SHARED -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -DSPDLOG_SHARED_LIB -I/home/ports/pobj/spdlog-1.14.1/spdlog-1.14.1/include -isystem /usr/local/include -O2 -pipe -DNDEBUG -std=c++11 -MD -MT example/CMakeFiles/example.dir/example.cpp.o -MF example/CMakeFiles/example.dir/example.cpp.o.d -o example/CMakeFiles/example.dir/example.cpp.o -c /home/ports/pobj/spdlog-1.14.1/spdlog-1.14.1/example/example.cpp
In file included from /home/ports/pobj/spdlog-1.14.1/spdlog-1.14.1/example/example.cpp:31:
In file included from /home/ports/pobj/spdlog-1.14.1/spdlog-1.14.1/include/spdlog/spdlog.h:12:
In file included from /home/ports/pobj/spdlog-1.14.1/spdlog-1.14.1/include/spdlog/common.h:50:
In file included from /home/ports/pobj/spdlog-1.14.1/spdlog-1.14.1/include/spdlog/fmt/fmt.h:28:
In file included from /usr/local/include/fmt/core.h:5:
In file included from /usr/local/include/fmt/format.h:41:
/usr/local/include/fmt/base.h:1392:20: error: 'this' argument to member function 'format' has type 'const fmt::formatter<my_type>', but function is not marked const
    ctx.advance_to(cf.format(*static_cast<qualified_type*>(arg), ctx));
                   ^~
/usr/local/include/fmt/base.h:1373:21: note: in instantiation of function template specialization 'fmt::detail::value<fmt::context>::format_custom_arg<my_type, fmt::formatter<my_type>>' requested here
    custom.format = format_custom_arg<
                    ^
/usr/local/include/fmt/base.h:1631:10: note: in instantiation of function template specialization 'fmt::detail::value<fmt::context>::value<my_type>' requested here
  return {arg_mapper<Context>().map(val)};
         ^
/usr/local/include/fmt/base.h:2002:20: note: in instantiation of function template specialization 'fmt::detail::make_arg<true, fmt::context, my_type, 0>' requested here
  return {{detail::make_arg<NUM_ARGS <= detail::max_packed_args, Context>(
                   ^
/home/ports/pobj/spdlog-1.14.1/spdlog-1.14.1/include/spdlog/logger.h:80:9: note: in instantiation of function template specialization 'spdlog::logger::log_<my_type>' requested here
        log_(loc, lvl, details::to_string_view(fmt), std::forward<Args>(args)...);
        ^
/home/ports/pobj/spdlog-1.14.1/spdlog-1.14.1/include/spdlog/logger.h:85:9: note: in instantiation of function template specialization 'spdlog::logger::log<my_type>' requested here
        log(source_loc{}, lvl, fmt, std::forward<Args>(args)...);
        ^
/home/ports/pobj/spdlog-1.14.1/spdlog-1.14.1/include/spdlog/logger.h:140:9: note: in instantiation of function template specialization 'spdlog::logger::log<my_type>' requested here
        log(level::info, fmt, std::forward<Args>(args)...);
        ^
/home/ports/pobj/spdlog-1.14.1/spdlog-1.14.1/include/spdlog/spdlog.h:168:27: note: in instantiation of function template specialization 'spdlog::logger::info<my_type>' requested here
    default_logger_raw()->info(fmt, std::forward<Args>(args)...);
                          ^
/home/ports/pobj/spdlog-1.14.1/spdlog-1.14.1/example/example.cpp:289:39: note: in instantiation of function template specialization 'spdlog::info<my_type>' requested here
void user_defined_example() { spdlog::info("user defined type: {}", my_type(14)); }
                                      ^
/home/ports/pobj/spdlog-1.14.1/spdlog-1.14.1/example/example.cpp:275:10: note: 'format' declared here
    auto format(my_type my, format_context &ctx) -> decltype(ctx.out()) {
         ^
1 error generated.
@tt4g
Copy link
Contributor

tt4g commented Jul 7, 2024

Duplicate #3115 (comment)

PRs to make the example code work with the latest fmt would be welcome.
Or skip building example with CMake variable -DSPDLOG_BUILD_EXAMPLE=OFF.

@brad0
Copy link
Author

brad0 commented Jul 7, 2024

Duplicate #3115 (comment)

PRs to make the example code work with the latest fmt would be welcome. Or skip building example with CMake variable -DSPDLOG_BUILD_EXAMPLE=OFF.

Thanks. I'll use that for our package anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants