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

Some errors encountered when packaging #4144

Closed
kamrann opened this issue Sep 2, 2024 · 9 comments
Closed

Some errors encountered when packaging #4144

kamrann opened this issue Sep 2, 2024 · 9 comments

Comments

@kamrann
Copy link
Contributor

kamrann commented Sep 2, 2024

I'm trying to update the build2 fmt package to v11 and have run into a few issues with certain toolchains used by the build2 CI configurations. Some or all of these may simply be outside of fmt supported environments, and quite likely compiler/STL bugs rather than fmt bugs, but I'm not qualified to make that judgement, especially since I can't locally test most of these configurations, so am just posting the errors that I've run into.

All these are on latest master (bc3af51). I can just disable these configurations for the moment in the package, so if this is outside the scope of what fmt can support/address then no worries. I'm also curious though if there's a reason that the fmt CI (from what I can see) does not seem to be building with any recent compiler versions? Looks like the most recent clang used is 11, for example.

Link to full build2 CI output, which includes full platform/distribution details.

  1. There's an error building ranges-test on debian/clang17:
In file included from /tmp/dist/fmt-tests-11.0.1-a.0.20240902045134.60423130ce74/basics/test/ranges-test.cc:8:
In file included from /tmp/dist/fmt-11.0.1-a.0.20240902045134.60423130ce74/fmt/include/fmt/ranges.h:13:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/iterator:66:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/streambuf_iterator.h:35:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/streambuf:43:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/ios_base.h:41:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/locale_classes.h:40:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/string:58:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/memory_resource.h:41:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/uses_allocator_args.h:38:
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/tuple:691:2: error: pack expansion contains parameter pack '_UTypes' that has a different length (1 vs. 0) from outer parameter packs
  691 |         using __convertible = __and_<is_convertible<_UTypes, _Types>...>;
      |         ^~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/tuple:853:27: note: in instantiation of template type alias '__convertible' requested here
  853 |           = _TCC<true>::template __convertible<_Args...>::value;
      |                                  ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/tuple:948:12: note: in instantiation of static data member 'std::tuple<std::vector<char>>::__convertible<>' requested here
  948 |         explicit(!__convertible<_UElements&...>)
      |                   ^
/tmp/dist/fmt-tests-11.0.1-a.0.20240902045134.60423130ce74/basics/test/ranges-test.cc:581:31: note: while substituting deduced template arguments into function template 'tuple' [with _UElements = (no value)]
  581 |   EXPECT_EQ(fmt::format("{}", std::tuple<std::vector<char>>{{'x'}}), "(['x'])");
      |                               ^
  1. Some tests are failing on freebsd:
/tmp/dist/fmt-tests-11.0.1-a.0.20240902045134.60423130ce74/basics/test/xchar-test.cc:575: Failure
Value of: saturdays
Expected: contains at least one element that is equal to L"s\xE1" L"b."
  Actual: { L"s\xE1" L"b", L"s\xE1." }
[  FAILED  ] locale_test.chrono_weekday (2 ms)
/tmp/dist/fmt-tests-11.0.1-a.0.20240902045134.60423130ce74/basics/test/chrono-test.cc:767: Failure
Value of: saturdays
Expected: contains at least one element that is equal to "s\xC3\xA1" "b."
    As Text: "sáb."
  Actual: { "s\xC3\xA1" "b"
    As Text: "sáb", "s\xC3\xA1."
    As Text: "sá." }
/tmp/dist/fmt-tests-11.0.1-a.0.20240902045134.60423130ce74/basics/test/chrono-test.cc:768: Failure
Value of: saturdays
Expected: contains at least one element that is equal to "s\xC3\xA1" "b."
    As Text: "sáb."
  Actual: { "s\xC3\xA1" "b"
    As Text: "sáb", "s\xC3\xA1."
    As Text: "sá." }
/tmp/dist/fmt-tests-11.0.1-a.0.20240902045134.60423130ce74/basics/test/chrono-test.cc:769: Failure
Value of: saturdays
Expected: contains at least one element that is equal to "s\xC3\xA1" "b."
    As Text: "sáb."
  Actual: { "s\xC3\xA1" "b"
    As Text: "sáb", "s\xC3\xA1."
    As Text: "sá." }
[  FAILED  ] chrono_test.weekday (1 ms)
  1. The library itself fails to build on MSVC 17.8. Since it compiles fine on both earlier and later versions I guess this is most likely a compiler bug, but for completeness:
C:\Coding\Build2\third-party-packaging\build2-packaging\fmt\fmt\fmt\include\fmt\base.h(2200): error C2672: 'fmt::v11::detail::buffer<T>::append': no matching overloaded function found
        with
        [
            T=char
        ]
C:\Coding\Build2\third-party-packaging\build2-packaging\fmt\fmt\fmt\include\fmt\base.h(1944): note: could be 'void fmt::v11::detail::buffer<T>::append(const U *,const U *)'
        with
        [
            T=char
        ]
C:\Coding\Build2\third-party-packaging\build2-packaging\fmt\fmt\fmt\include\fmt\base.h(2200): note: Failed to specialize function template 'void fmt::v11::detail::buffer<T>::append(const U *,const U *)'
        with
        [
            T=char
        ]
C:\Coding\Build2\third-party-packaging\build2-packaging\fmt\fmt\fmt\include\fmt\base.h(2200): note: With the following template arguments:
C:\Coding\Build2\third-party-packaging\build2-packaging\fmt\fmt\fmt\include\fmt\base.h(2200): note: 'U=char'
C:\Coding\Build2\third-party-packaging\build2-packaging\fmt\fmt\fmt\include\fmt\base.h(2200): note: the template instantiation context (the oldest one first) is
C:\Coding\Build2\third-party-packaging\build2-packaging\fmt\fmt\fmt\include\fmt\format.h(3180): note: see reference to function template instantiation 'OutputIt fmt::v11::detail::format_decimal<char,uint32_t,fmt::v11::appender,0>(OutputIt,UInt,int)' being compiled
        with
        [
            OutputIt=fmt::v11::appender,
            UInt=uint32_t
        ]
C:\Coding\Build2\third-party-packaging\build2-packaging\fmt\fmt\fmt\include\fmt\format.h(1376): note: see reference to function template instantiation 'OutputIt fmt::v11::detail::copy_noinline<char,char*,OutputIt>(InputIt,InputIt,OutputIt)' being compiled
        with
        [
            OutputIt=fmt::v11::appender,
            InputIt=char *
        ]
C:\Coding\Build2\third-party-packaging\build2-packaging\fmt\fmt\fmt\include\fmt\format.h(599): note: see reference to function template instantiation 'OutputIt fmt::v11::detail::copy<char,InputIt,OutputIt,0>(InputIt,InputIt,OutputIt)' being compiled
        with
        [
            OutputIt=fmt::v11::appender,
            InputIt=char *
        ]
error: process C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/HostX64/x64/cl.exe exited with code 2
  info: command line: "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/HostX64/x64/cl.exe" -IC:\Coding\Build2\third-party-packaging\build2-packaging\fmt\fmt\fmt/include -IC:\Coding\Build2\third-party-packaging\build2-packaging\build\msvc\fmt -IC:\Coding\Build2\third-party-packaging\build2-packaging\fmt\fmt -DFMT_LIB_EXPORT /Zi /nologo /std:c++latest /Zc:__cplusplus /permissive- /I "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include" /I "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt" /I "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared" /I "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um" /I "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt" /diagnostics:color /utf-8 /EHsc /MD /Fd: ..\..\build\msvc\fmt\fmt\src\format.dll.obj.pdb /Fo: ..\..\build\msvc\fmt\fmt\src\format.dll.obj /c /TP C:\Coding\Build2\third-party-packaging\build2-packaging\fmt\fmt\fmt\src\format.cc
@vitaut
Copy link
Contributor

vitaut commented Sep 2, 2024

FreeBSD failures are just different localized outputs and are easy to fix. As for clang 17 issue, I wasn't able to repro it in https://www.godbolt.org/z/cePKMjWa8. You'll need to provide more repro details.

@kamrann
Copy link
Contributor Author

kamrann commented Sep 3, 2024

Eventually managed to repro on Compiler Explorer.
Seems to be specifically the combination of Clang 17, libstdc++ and c++23 mode. On that combo it shows up on prior fmt versions too, but all is fine on Clang 18. So seems like it's probably just another compiler bug.

Edit: yeah it seems you can remove fmt entirely and the tuple alone generates the error ;)

@kamrann
Copy link
Contributor Author

kamrann commented Sep 3, 2024

For reference: llvm/llvm-project#61415

@vitaut
Copy link
Contributor

vitaut commented Sep 3, 2024

FreeBSD issue should be fixed in 79e5ae9.

@vitaut
Copy link
Contributor

vitaut commented Sep 3, 2024

MSVC repro: https://www.godbolt.org/z/rP8s67vod

@vitaut
Copy link
Contributor

vitaut commented Sep 3, 2024

Worked around the clang bug in 4cae2da.

@vitaut
Copy link
Contributor

vitaut commented Sep 3, 2024

There is already a workaround for the MSVC bug but the version check was too optimistic. Fixed in 15694c9.

Thanks for reporting.

@vitaut vitaut closed this as completed Sep 3, 2024
@kamrann
Copy link
Contributor Author

kamrann commented Sep 4, 2024

Fantastic, thanks!

Looks like the MSVC 17.8 workaround triggers a follow-on constexpr error when building the tests, output below. Everything else on the CI has now passed though (modules builds aside, will open a new issue for that once I've investigated a bit further).

C:\tmp\dist\fmt-tests-11.0.1-a.0.20240904001404.105613fbd26a\basics\test\compile-test.cc(205): error C3615: constexpr function 'fmt::v11::detail::copy' cannot result in a constant expression
C:\tmp\dist\fmt-11.0.1-a.0.20240904001404.105613fbd26a\fmt\include\fmt\base.h(2115): note: failure was caused by call of undefined function or one not declared 'constexpr'
C:\tmp\dist\fmt-11.0.1-a.0.20240904001404.105613fbd26a\fmt\include\fmt\base.h(2115): note: see usage of 'fmt::v11::detail::buffer<T>::append'
        with
        [
            T=char
        ]
C:\tmp\dist\fmt-tests-11.0.1-a.0.20240904001404.105613fbd26a\basics\test\compile-test.cc(205): note: the call stack of the evaluation (the oldest call first) is
C:\tmp\dist\fmt-tests-11.0.1-a.0.20240904001404.105613fbd26a\basics\test\compile-test.cc(206): note: while evaluating function 'size_t fmt::v11::formatted_size<compile_test_constexpr_formatted_size_Test::TestBody::<lambda_2>::()::FMT_COMPILE_STRING,int,0>(const S &,const int &)'
        with
        [
            S=compile_test_constexpr_formatted_size_Test::TestBody::<lambda_2>::()::FMT_COMPILE_STRING
        ]
C:\tmp\dist\fmt-11.0.1-a.0.20240904001404.105613fbd26a\fmt/include\fmt/compile.h(521): note: while evaluating function 'OutputIt fmt::v11::format_to<fmt::v11::appender,S,const int&,0>(OutputIt,const S &,const int &)'
        with
        [
            OutputIt=fmt::v11::appender,
            S=compile_test_constexpr_formatted_size_Test::TestBody::<lambda_2>::()::FMT_COMPILE_STRING
        ]
C:\tmp\dist\fmt-11.0.1-a.0.20240904001404.105613fbd26a\fmt/include\fmt/compile.h(501): note: while evaluating function 'OutputIt fmt::v11::format_to<OutputIt,T,int,0>(OutputIt,const CompiledFormat &,const int &)'
        with
        [
            OutputIt=fmt::v11::appender,
            T=fmt::v11::detail::spec_field<char_type,int,0>,
            CompiledFormat=fmt::v11::detail::spec_field<char_type,int,0>
        ]
C:\tmp\dist\fmt-11.0.1-a.0.20240904001404.105613fbd26a\fmt/include\fmt/compile.h(461): note: while evaluating function 'OutputIt fmt::v11::detail::spec_field<char_type,int,0>::format<OutputIt,int>(OutputIt,const int &) const'
        with
        [
            OutputIt=fmt::v11::appender
        ]
C:\tmp\dist\fmt-11.0.1-a.0.20240904001404.105613fbd26a\fmt/include\fmt/compile.h(221): note: while evaluating function 'fmt::v11::appender fmt::v11::detail::native_formatter<T,Char,fmt::v11::detail::type::int_type>::format<fmt::v11::context>(const T &,FormatContext &) const'
        with
        [
            T=int,
            Char=char,
            FormatContext=fmt::v11::context
        ]
C:\tmp\dist\fmt-11.0.1-a.0.20240904001404.105613fbd26a\fmt\include\fmt\format.h(4268): note: while evaluating function 'fmt::v11::basic_appender<char> fmt::v11::detail::write<Char,T,0>(fmt::v11::basic_appender<char>,T,const fmt::v11::format_specs &,fmt::v11::detail::locale_ref)'
        with
        [
            Char=char,
            T=int
        ]
C:\tmp\dist\fmt-11.0.1-a.0.20240904001404.105613fbd26a\fmt\include\fmt\format.h(2290): note: while evaluating function 'OutputIt fmt::v11::detail::write_int_noinline<Char,fmt::v11::basic_appender<char>,unsigned int>(OutputIt,fmt::v11::detail::write_int_arg<unsigned int>,const fmt::v11::format_specs &)'
        with
        [
            OutputIt=fmt::v11::basic_appender<char>,
            Char=char
        ]
C:\tmp\dist\fmt-11.0.1-a.0.20240904001404.105613fbd26a\fmt\include\fmt\format.h(2279): note: while evaluating function 'OutputIt fmt::v11::detail::write_int<Char,OutputIt,unsigned int>(OutputIt,fmt::v11::detail::write_int_arg<unsigned int>,const fmt::v11::format_specs &)'
        with
        [
            OutputIt=fmt::v11::basic_appender<char>,
            Char=char
        ]
C:\tmp\dist\fmt-11.0.1-a.0.20240904001404.105613fbd26a\fmt\include\fmt\format.h(2261): note: while evaluating function 'OutputIt fmt::v11::detail::copy<Char,const char*,fmt::v11::basic_appender<char>,0>(InputIt,InputIt,OutputIt)'
        with
        [
            OutputIt=fmt::v11::basic_appender<char>,
            Char=char,
            InputIt=const char *
        ]

@vitaut vitaut reopened this Sep 4, 2024
@vitaut
Copy link
Contributor

vitaut commented Sep 4, 2024

Updated compile-test in 565461a.

@vitaut vitaut closed this as completed Sep 4, 2024
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