Skip to content

Bookworm missing C++20 <format> header #3814

@BsAtHome

Description

@BsAtHome

There is a problem in Debian 12 (Bookworm) where gcc-12 is missing the C++20 <format> header. That means that things like the following is not possible:

#include <format>
....
std::string s = std::format("This string {} is at least {} times better.", "formatter", 10);
// formats into: "This string formatter is at least 10 times better."
....

This type of formatting is also the default in python nowadays and is much better than any snprintf or other bodgeworks.

The solution is to add a dependency libfmt-dev for building LinuxCNC to include libfmt (https://github.com/fmtlib/fmt), which is available as packages on all platforms afaik (libfmt7 on bullseye, libfmt9 on bookworm, libfmt10 on trixie; even buster has it).
Using libfmt means that #include <format> with std::format() just needs to be rewritten as #include <fmt/format.h> and use fmt::format().

What do you guys say, is this acceptable?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions