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

Any plans to support fmt v11 #84

Closed
ujos opened this issue Jan 4, 2025 · 11 comments
Closed

Any plans to support fmt v11 #84

ujos opened this issue Jan 4, 2025 · 11 comments

Comments

@ujos
Copy link

ujos commented Jan 4, 2025

I'm starting a new project and would like to use the latest versions of the sbepp and spdlog libraries. The problem is that:

  • sbepp/1.5.1 requires fmt/10.2.0
  • while spdlog/1.15.0 requires fmt/11.0.2

In case if I force Conan to use fmt/11.0.2, it fails to compile the sbeppc tool:

sbepp/1.5.1: Running CMake.build()
sbepp/1.5.1: RUN: cmake --build "C:\Users\dmitr\.conan2\p\b\sbepp1dd2656835cf4\b\build" --config Debug
MSBuild version 17.12.12+1cce77968 for .NET Framework

  1>Checking Build System
  1>Building Custom Rule C:/Users/dmitr/.conan2/p/b/sbepp1dd2656835cf4/b/src/sbeppc/CMakeLists.txt
  main.cpp
  build_info.cpp
C:\Users\dmitr\.conan2\p\b\sbepp1dd2656835cf4\b\src\sbeppc\src\sbepp\sbeppc\sbe_schema_validator.hpp(1127,24): warning C4573: the usage of 'sbepp::sbeppc::sbe_schema_validator::is_constant_composite_element' requires the compiler to capture 'this' but the current default capture mode does not allow it [C:\Users\dmitr\.conan2\p\b\sbepp1dd2656835cf4\b\build\sbeppc\sbepp_sbeppc.vcxproj]
  (compiling source file '../../src/sbeppc/src/sbepp/sbeppc/main.cpp')
  
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\xutility(1187,54): error C2794: 'reference': is not a member of any direct or indirect base class of 'std::iterator_traits<fmt::v11::appender>' [C:\Users\dmitr\.conan2\p\b\sbepp1dd2656835cf4\b\build\sbeppc\sbepp_sbeppc.vcxproj]
  (compiling source file '../../src/sbeppc/src/sbepp/sbeppc/main.cpp')
      C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\xutility(1187,54):
      the template instantiation context (the oldest one first) is
          C:\Users\dmitr\.conan2\p\b\sbepp1dd2656835cf4\b\src\sbeppc\src\sbepp\sbeppc\reporter.hpp(20,14):
          see reference to function template instantiation 'void fmt::v11::print<fmt::v11::detail::styled_arg<char [6]>,std::string_view&>(fmt::v11::basic_format_string<char,fmt::v11::detail::styled_arg<char [6]>,std::string_view &>,fmt::v11::detail::styled_arg<char [6]> &&,std::string_view &)' being compiled
          C:\Users\dmitr\.conan2\p\b\fmtf1512e9da6780\p\include\fmt\base.h(3032,28):
          see reference to function template instantiation 'fmt::v11::detail::format_arg_store<fmt::v11::format_context,2,0,223> fmt::v11::make_format_args<fmt::v11::format_context,fmt::v11::detail::styled_arg<char [6]>,std::string_view,2,0,223,0>(fmt::v11::detail::styled_arg<char [6]> &,std::string_view &)' being compiled
          C:\Users\dmitr\.conan2\p\b\fmtf1512e9da6780\p\include\fmt\base.h(2018,20):
          see reference to function template instantiation 'fmt::v11::detail::value<Context> fmt::v11::detail::make_arg<true,Context,fmt::v11::detail::styled_arg<char [6]>,0>(T &)' being compiled
          with
          [
              Context=fmt::v11::context,
              T=fmt::v11::detail::styled_arg<char [6]>
          ]
          C:\Users\dmitr\.conan2\p\b\fmtf1512e9da6780\p\include\fmt\base.h(1647,36):
          see reference to function template instantiation 'fmt::v11::detail::value<Context>::value<T>(T &)' being compiled
          with
          [
              Context=fmt::v11::context,
              T=fmt::v11::detail::styled_arg<char [6]>
          ]
          C:\Users\dmitr\.conan2\p\b\fmtf1512e9da6780\p\include\fmt\base.h(1383,21):
          see reference to function template instantiation 'void fmt::v11::detail::value<Context>::format_custom_arg<fmt::v11::detail::value<Context>::{ctor}::value_type,fmt::v11::formatter<U,char,void>>(void *,fmt::v11::context::parse_context_type &,Context &)' being compiled
          with
          [
              Context=fmt::v11::context,
              U=fmt::v11::detail::styled_arg<char [6]>
          ]
          C:\Users\dmitr\.conan2\p\b\fmtf1512e9da6780\p\include\fmt\base.h(1402,23):
          see reference to function template instantiation 'fmt::v11::appender fmt::v11::formatter<U,char,void>::format<Context>(const fmt::v11::detail::styled_arg<char [6]> &,FormatContext &) const' being compiled
          with
          [
              U=fmt::v11::detail::styled_arg<char [6]>,
              Context=fmt::v11::format_context,
              FormatContext=fmt::v11::format_context
          ]
          C:\Users\dmitr\.conan2\p\b\fmtf1512e9da6780\p\include\fmt\color.h(570,18):
          see reference to function template instantiation '_OutIt std::copy<const Char*,fmt::v11::appender>(_InIt,_InIt,_OutIt)' being compiled
          with
          [
              _OutIt=fmt::v11::appender,
              Char=char,
              _InIt=const char *
          ]
          C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\xutility(4761,36):
          see reference to function template instantiation '_OutIt std::_Copy_unchecked<_InIt,_InIt,_OutIt>(_InIt,_Sent,_OutIt)' being compiled
          with
          [
              _OutIt=fmt::v11::appender,
              _InIt=const char *,
              _Sent=const char *
          ]
          C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\xutility(4731,23):
          see reference to alias template instantiation 'std::_Sent_copy_cat<_InIt,_Sent,_OutIt>' being compiled
          with
          [
              _InIt=const char *,
              _Sent=const char *,
              _OutIt=fmt::v11::appender
          ]
          C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\xutility(4607,29):
          see reference to variable template 'const bool _Iterator_is_volatile<fmt::v11::basic_appender<char> >' being compiled
          C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\xutility(4546,73):
          see reference to alias template instantiation 'std::_Iter_ref_t<_Iter>' being compiled
          with
          [
              _Iter=fmt::v11::appender
          ]
  
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\xutility(4546,73): error C2938: 'std::_Iter_ref_t' : Failed to specialize alias template [C:\Users\dmitr\.conan2\p\b\sbepp1dd2656835cf4\b\build\sbeppc\sbepp_sbeppc.vcxproj]
  (compiling source file '../../src/sbeppc/src/sbepp/sbeppc/main.cpp')
  
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\xutility(4546,40): error C2062: type 'unknown-type' unexpected [C:\Users\dmitr\.conan2\p\b\sbepp1dd2656835cf4\b\build\sbeppc\sbepp_sbeppc.vcxproj]
  (compiling source file '../../src/sbeppc/src/sbepp/sbeppc/main.cpp')
  
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\xutility(4607,29): error C3376: 'std::_Iterator_is_volatile': only static data member templates are allowed [C:\Users\dmitr\.conan2\p\b\sbepp1dd2656835cf4\b\build\sbeppc\sbepp_sbeppc.vcxproj]
  (compiling source file '../../src/sbeppc/src/sbepp/sbeppc/main.cpp')
  
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\xutility(4722,5): error C2976: 'std::_Iter_copy_cat': too few template arguments [C:\Users\dmitr\.conan2\p\b\sbepp1dd2656835cf4\b\build\sbeppc\sbepp_sbeppc.vcxproj]
  (compiling source file '../../src/sbeppc/src/sbepp/sbeppc/main.cpp')
      C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\xutility(4608,8):
      see declaration of 'std::_Iter_copy_cat'
  
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\xutility(4731,61): error C2039: '_Bitcopy_assignable': is not a member of '`global namespace'' [C:\Users\dmitr\.conan2\p\b\sbepp1dd2656835cf4\b\build\sbeppc\sbepp_sbeppc.vcxproj]
  (compiling source file '../../src/sbeppc/src/sbepp/sbeppc/main.cpp')
  
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\xutility(4731,80): error C2059: syntax error: ')' [C:\Users\dmitr\.conan2\p\b\sbepp1dd2656835cf4\b\build\sbeppc\sbepp_sbeppc.vcxproj]
  (compiling source file '../../src/sbeppc/src/sbepp/sbeppc/main.cpp')
  
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\xutility(4731,82): error C2143: syntax error: missing ';' before '{' [C:\Users\dmitr\.conan2\p\b\sbepp1dd2656835cf4\b\build\sbeppc\sbepp_sbeppc.vcxproj]
  (compiling source file '../../src/sbeppc/src/sbepp/sbeppc/main.cpp')

So far I've downgraded fmt to v10.2.0 and it works. But I just wonder, are there any plans to support fmt at least 11.0.2?

@OleksandrKvl
Copy link
Owner

OleksandrKvl commented Jan 6, 2025

Hi, there was #63 where I fixed fmt/11 build but I only tested it locally on macOS. Can you identify the root of the problem? There should be no serious incompatibilities with fmt/11, I'm pretty sure it's another MSVC quirk.

@OleksandrKvl
Copy link
Owner

Seems that problematic line is this:

fmt::print("{}: {}\n", fmt::styled("Error", fmt::emphasis::bold), msg);
but that file has never been changed since the initial commit. In the latest fmt::styled documentation I see no major changes or other things that can suggest that current code is wrong. Maybe you can try the latest fmt?

@ujos
Copy link
Author

ujos commented Jan 6, 2025

Just for the record, in case if I build the library from the main branch using the MSVC 2022, I get the CMake error:

-- Using Conan toolchain: .../Sources/other/sbepp/.build/x86_64-v143-debug/conan_toolchain.cmake
-- Conan toolchain: CMAKE_GENERATOR_TOOLSET=v143
CMake Error at .build/x86_64-v143-debug/conan_toolchain.cmake:43 (message):
  The CMake policy CMP0091 must be NEW, but is ''
Call Stack (most recent call first):
  C:/Users/Public/Bin/cmake-3.26.0-rc4-windows-x86_64/share/cmake-3.26/Modules/CMakeDetermineSystem.cmake:145 (include)
  CMakeLists.txt:3 (project)

The content of the conan_toolchain.cmake file is following:

########## 'vs_runtime' block #############
# Definition of VS runtime CMAKE_MSVC_RUNTIME_LIBRARY, from settings build_type,
# compiler.runtime, compiler.runtime_type

cmake_policy(GET CMP0091 POLICY_CMP0091)
if(NOT "${POLICY_CMP0091}" STREQUAL NEW)
    message(FATAL_ERROR "The CMake policy CMP0091 must be NEW, but is '${POLICY_CMP0091}'")
endif()
message(STATUS "Conan toolchain: Setting CMAKE_MSVC_RUNTIME_LIBRARY=$<$<CONFIG:Debug>:MultiThreadedDebugDLL>")
set(CMAKE_MSVC_RUNTIME_LIBRARY "$<$<CONFIG:Debug>:MultiThreadedDebugDLL>")

So, in order to solve this issue I either should:

  • add -DCMAKE_POLICY_DEFAULT_CMP0091=NEW command line parameter
  • or set the cmake_minimum_required(VERSION 3.15)

@ujos
Copy link
Author

ujos commented Jan 6, 2025

fmt/11.1.1 compiles just great. fmt/11.0.2 does not.... The problem is that spdlog/1.15.0 does not support fmt/11.1.1 yet...

Ok I will wait for the spdlog upgrade

@OleksandrKvl
Copy link
Owner

CMake error is weird because I have GitHub's Windows in CI and it builds just fine. https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md says that it uses Visual Studio Enterprise 2022. Even weirder is that error happens inside Conan-generated file.

fmt/11.1.1 compiles just great

As I expected, it's likely to be an MSVC bug, I work-arounded a couple of them recently (already released). Maybe fmt faced them as well.

Ok I will wait for the spdlog for upgrade

Can't you force newer version on both of them in Conan?

@OleksandrKvl
Copy link
Owner

Btw, probably fmtlib/fmt#4091 is the issue you're facing here.

@ujos
Copy link
Author

ujos commented Jan 6, 2025

Can't you force newer version on both of them in Conan?

I tried to use fmt/11.1.1. They removed to_string_view method or something like that

@ujos
Copy link
Author

ujos commented Jan 6, 2025

Btw, probably fmtlib/fmt#4091 is the issue you're facing here.

Perfect. That was it. The issue had been fixed in fmt/11.1.0.

The MSVC + spdlog/1.15.0 + sbepp/1.5.1 + fmt/11.0.1 composition works just great.

Thank you very much

@ujos
Copy link
Author

ujos commented Jan 6, 2025

CMake error is weird because I have GitHub's Windows in CI and it builds just fine. https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md says that it uses Visual Studio Enterprise 2022. Even weirder is that error happens inside Conan-generated file.

What is the CMake version used for the runner ? 3.31.2, right?

@ujos
Copy link
Author

ujos commented Jan 6, 2025

Let me create another issue so I can close this one

@ujos ujos closed this as completed Jan 6, 2025
@ujos
Copy link
Author

ujos commented Jan 6, 2025

Perfect. That was it. The issue had been fixed in fmt/11.0.1. The MSVC + spdlog/1.15.0 + sbepp/1.5.1 + fmt/11.0.1 composition works just great.

I was too fast on that.

  • fmt/11.0.1 - works well with both spdlog/1.15.0 and sbepp/1.5.1
  • fmt/11.0.2 - does not work with sbepp/1.5.1 because of missing reference type
  • fmt/11.1.0 (the version that fixes the issue MSVC 19.35 error C2794 fmtlib/fmt#4091) is not available on the Conan Repository
  • fmt/11.1.1 - does not work with spdlog/1.15.0 because of to_string_view

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

No branches or pull requests

2 participants