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

Updated fmt library to v10 to address some compilation issues on macOS 13 #1506

Merged
merged 3 commits into from
May 30, 2023

Conversation

jeff-cohere
Copy link
Contributor

@jeff-cohere jeff-cohere commented May 29, 2023

Hi there! I encountered some compilation errors on macOS Ventura, likely from the very different C++ compiler (see below). I was able to pull in the most recent release of the fmt library and fix the issues introduced there by casting a few arguments being formatted. I'm not 100% sure I did everything properly, but I figured it would be good to see the CI results. With these fixes, slade builds and runs on my M1 Mac laptop.

Here are the errors I saw from the version of fmt in the master branch:

/Users/jeffreyjohnson/projects/gamedev/slade/thirdparty/fmt/src/format.cc:14:37: error: redefinition of 'basic_data'
template <typename T = void> struct basic_data {
                                    ^
/opt/homebrew/include/fmt/format.h:1739:37: note: previous definition is here
template <typename T = void> struct basic_data {
                                    ^
/Users/jeffreyjohnson/projects/gamedev/slade/thirdparty/fmt/src/format.cc:68:58: error: use of undeclared identifier 'FMT_SNPRINTF'
  int (*snprintf_ptr)(char*, size_t, const char*, ...) = FMT_SNPRINTF;
                                                         ^
/Users/jeffreyjohnson/projects/gamedev/slade/thirdparty/fmt/src/format.cc:74:5: error: variable cannot be defined in an explicit instantiation; if this declaration is meant to be a variable definition, remove the 'template' keyword
    FMT_NOEXCEPT;
    ^
/Users/jeffreyjohnson/projects/gamedev/slade/thirdparty/fmt/src/format.cc:73:58: error: out-of-line declaration of 'to_decimal' does not match any declaration in namespace 'fmt::detail::dragonbox'
template FMT_API dragonbox::decimal_fp<float> dragonbox::to_decimal(float x)
                                                         ^~~~~~~~~~
/Users/jeffreyjohnson/projects/gamedev/slade/thirdparty/fmt/src/format.cc:73:77: error: expected ';' at end of declaration
template FMT_API dragonbox::decimal_fp<float> dragonbox::to_decimal(float x)
                                                                            ^
                                                                            ;
/Users/jeffreyjohnson/projects/gamedev/slade/thirdparty/fmt/src/format.cc:74:5: error: C++ requires a type specifier for all declarations
    FMT_NOEXCEPT;
    ^
/Users/jeffreyjohnson/projects/gamedev/slade/thirdparty/fmt/src/format.cc:76:5: error: variable cannot be defined in an explicit instantiation; if this declaration is meant to be a variable definition, remove the 'template' keyword
    FMT_NOEXCEPT;
    ^
/Users/jeffreyjohnson/projects/gamedev/slade/thirdparty/fmt/src/format.cc:75:59: error: out-of-line declaration of 'to_decimal' does not match any declaration in namespace 'fmt::detail::dragonbox'
template FMT_API dragonbox::decimal_fp<double> dragonbox::to_decimal(double x)
                                                          ^~~~~~~~~~
/Users/jeffreyjohnson/projects/gamedev/slade/thirdparty/fmt/src/format.cc:75:79: error: expected ';' at end of declaration
template FMT_API dragonbox::decimal_fp<double> dragonbox::to_decimal(double x)
                                                                              ^
                                                                              ;
/Users/jeffreyjohnson/projects/gamedev/slade/thirdparty/fmt/src/format.cc:76:5: error: C++ requires a type specifier for all declarations
    FMT_NOEXCEPT;
    ^
/Users/jeffreyjohnson/projects/gamedev/slade/thirdparty/fmt/src/format.cc:101:46: error: expected '(' for function-style cast or type construction
    basic_format_args<FMT_BUFFER_CONTEXT(char)>, detail::locale_ref);
                                         ~~~~^
/Users/jeffreyjohnson/projects/gamedev/slade/thirdparty/fmt/src/format.cc:99:31: error: explicit instantiation of 'vformat_to' does not refer to a function template, variable template, member function, member class, or static data member
template FMT_API void detail::vformat_to(
                              ^
/opt/homebrew/include/fmt/format.h:4554:6: note: candidate template ignored: failed template argument deduction
void vformat_to(buffer<Char>& buf, basic_string_view<Char> fmt,
     ^
/Users/jeffreyjohnson/projects/gamedev/slade/thirdparty/fmt/src/format.cc:103:30: error: explicit instantiation of 'snprintf_float' does not refer to a function template, variable template, member function, member class, or static data member
template FMT_API int detail::snprintf_float(double, int, detail::float_specs,
                             ^
/Users/jeffreyjohnson/projects/gamedev/slade/thirdparty/fmt/src/format.cc:105:30: error: explicit instantiation of 'snprintf_float' does not refer to a function template, variable template, member function, member class, or static data member
template FMT_API int detail::snprintf_float(long double, int,
                             ^
14 errors generated.
make[2]: *** [src/external/fmt/CMakeFiles/fmt.dir/src/format.cc.o] Error 1
make[1]: *** [src/external/fmt/CMakeFiles/fmt.dir/all] Error 2
make: *** [all] Error 2

@sirjuddington sirjuddington merged commit da215c2 into sirjuddington:master May 30, 2023
3 checks passed
@jeff-cohere jeff-cohere deleted the new-fmt branch May 30, 2023 02:21
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 this pull request may close these issues.

None yet

2 participants