EasyRPG / buildscripts

The scripts used to compile needed libraries for supported platform ports on our Jenkins server
https://ci.easyrpg.org/view/Toolchains/
Other
16 stars 17 forks source link

vcpkg: Compilation error when using fmt::styled with fmt::print #183

Open monokotech opened 6 days ago

monokotech commented 6 days ago

The following error message is displayed during compilation (output.cpp:104):

C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.41.34120\include\xutility(1190,54):
error C2794: 'reference': is not a member of any direct or indirect base class of 'std::iterator_traits<fmt::v11::appender>'
error C2938: 'std::_Iter_ref_t' : Failed to specialize alias template
error C2062: type 'unknown-type' unexpected
error C3376: 'std::_Iterator_is_volatile': only static data member templates are allowed
error C2976: 'std::_Iter_copy_cat': too few template arguments
error C2039: '_Bitcopy_assignable': is not a member of '`global namespace''

Here is the latest version of format.h in the fmtlib:

namespace std {
template <> struct iterator_traits<fmt::appender> {
  using iterator_category = output_iterator_tag;
  using value_type = char;
  using reference = char&;
  using difference_type = fmt::appender::difference_type;
};
}  // namespace std

The version of format.h in vcpkg-export-20240826-223407.zip is as follows:

namespace std {
template <> struct iterator_traits<fmt::appender> {
  using iterator_category = output_iterator_tag;
  using value_type = char;
  // Missing reference and difference_type
};
}  // namespace std

My guess about the cause of the above error is that the missing reference and difference_type may be contributing factors, but I don't know how to resolve this issue. Simply removing the use of fmt::styled allows the compilation to succeed.

Ghabry commented 6 days ago

That's a bug in fmtlib https://github.com/fmtlib/fmt/issues/4091

There is no new release of fmtlib yet so you can keep your workaround until they release a new version.

monokotech commented 5 days ago

The issue can be temporarily resolved by adding the missing using reference = char&;.

carstene1ns commented 5 days ago

I think it would be good to keep this open until we have either the next version of fmt in vcpkg or we would need to pin the version there. (That is pinning vcpkg version, since package versions can only be specified with some JSON file which we do not use)