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

partial specialization of ‘struct fmt::v10::formatter<std::basic_string_view<_CharT>, Char>’ after instantiation of ‘struct fmt::v10::formatter<std::basic_string_view<char> >’ [-fpermissive] #2151

Open
mickey298 opened this issue Mar 21, 2024 · 5 comments

Comments

@mickey298
Copy link

Seastar commit: 4aa93b6
Code from tutorial.md
env: archlinux

//1.cpp
#include <seastar/core/app-template.hh>
#include <seastar/util/log.hh>
#include <iostream>
#include <stdexcept>

extern seastar::future<> f();

int main(int argc, char** argv) {
    seastar::app_template app;
    try {
        app.run(argc, argv, f);
    } catch(...) {
        std::cerr << "Couldn't start application: "
                  << std::current_exception() << "\n";
        return 1;
    }
    return 0;
}
//2.cpp
#include <seastar/core/sleep.hh>
#include <iostream>

seastar::future<> f() {
    std::cout << "Sleeping... " << std::flush;
    using namespace std::chrono_literals;
    return seastar::sleep(1s).then([] {
        std::cout << "Done.\n";
    });
}

compile

❯ g++ -g src/1.cpp src/2.cpp `pkg-config --cflags --libs --static seastar`                                         ─╯
In file included from /usr/include/fmt/ostream.h:21,
                 from /usr/include/seastar/core/sstring.hh:40,
                 from /usr/include/seastar/core/scheduling.hh:30,
                 from /usr/include/seastar/core/task.hh:24,
                 from /usr/include/seastar/core/future.hh:36,
                 from /usr/include/seastar/core/sleep.hh:29,
                 from src/2.cpp:2:
/usr/include/fmt/format.h:4051:1: error: partial specialization of ‘struct fmt::v10::formatter<std::basic_string_view<_CharT>, Char>’ after instantiation of ‘struct fmt::v10::formatter<std::basic_string_view<char> >’ [-fpermissive]
 4051 | FMT_FORMAT_AS(detail::std_string_view<Char>, basic_string_view<Char>);
  1. It's compiled ok if merge above code into 1 file without use extern.
  2. It's compiled ok on a new ubuntu vm.

Althought the difference of gcc version of system(ubuntu is 11 and the archlinux is 13),basically i believe it's fmt version problems.
the fmt on archlinux is 10.2 and the ubuntu is 8. And It is highly suspected that more version issues will be found in the future if we use fmt 10.2 because i seen many similar issues on fmt issue pages.
BTW. the package of libudev-dev and libunistring-dev missing in install-dependencies.sh
@tchaikov

@tchaikov
Copy link
Contributor

sounds like a fmt issue.

the install-dependencies.sh issue should be addressed by #1997 .

@tchaikov
Copy link
Contributor

another data point, i am building seasetar tree with fmt v10.2.1 and clang 19 just fine.

$ ./configure.py --mode debug --compile-commands-json --ccache --compiler clang++ --c-compiler clang 
$ ninja -C build/debug 
ninja: Entering directory `build/debug'
...
[259/259] Linking CXX executable apps/memcached/tests/app_memcached_test_ascii

@mickey298
Copy link
Author

another data point, i am building seasetar tree with fmt v10.2.1 and clang 19 just fine.

$ ./configure.py --mode debug --compile-commands-json --ccache --compiler clang++ --c-compiler clang 
$ ninja -C build/debug 
ninja: Entering directory `build/debug'
...
[259/259] Linking CXX executable apps/memcached/tests/app_memcached_test_ascii

Are you means building above code fines too? @tchaikov

@tchaikov
Copy link
Contributor

tchaikov commented Mar 25, 2024

no, i haven't got a chance to reproduce the above test case. will do.

tchaikov added a commit to tchaikov/seastar that referenced this issue Apr 3, 2024
in order to workaround fmtlib/fmt#3584 on impacted {fmt} versions.

Refs scylladb#2151
Signed-off-by: Kefu Chai <[email protected]>
@tchaikov
Copy link
Contributor

tchaikov commented Apr 3, 2024

i managed to reproduce fmtlib/fmt#2769 when testing a github workflow change, see https://github.com/tchaikov/seastar/actions/runs/8532553474/job/23373886423 .

when it comes to your issue, i guess it should be fixed by a newer {fmt} version which includes fmtlib/fmt@bbb784f . but {fmt} v10.2 should have it already...

anyway, i will see what we can do on our side.

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