Skip to content

Build failure using gcc 16.1.0 #1172

Description

@xytovl

Bug in Gentoo: https://bugs.gentoo.org/975268

gcc --version
gcc (Gentoo 16.1.0 p1) 16.1.0
Copyright (C) 2026 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
/tmp/KTX-Software-4.4.2.old/tools/ktx/command.h: In instantiation of 'void ktx::Reporter::fatal_usage(Args&& ...) [with Args = {const char (&)[26], const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&}]':
/tmp/KTX-Software-4.4.2.old/tools/ktx/command.h:233:31:   required from here
  233 |             report.fatal_usage("Unsupported format: \"{}\".", formatStr);
      |             ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/KTX-Software-4.4.2.old/tools/ktx/command.h:122:19: error: call to consteval function 'fmt::v11::fstring<const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>((* & std::forward<const char (&)[26]>((* & args#0))))' is not a constant expression
  122 |         fmt::print(std::cerr, std::forward<Args>(args)...);
      |         ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /tmp/KTX-Software-4.4.2.old/external/fmt/include/fmt/format.h:41,
                 from /tmp/KTX-Software-4.4.2.old/external/fmt/include/fmt/chrono.h:23,
                 from /tmp/KTX-Software-4.4.2.old/external/fmt/include/fmt/ostream.h:23,
                 from /tmp/KTX-Software-4.4.2.old/tools/ktx/utility.h:10,
                 from /tmp/KTX-Software-4.4.2.old/tools/ktx/command.h:12:
/tmp/KTX-Software-4.4.2.old/tools/ktx/command.h:122:19:   in 'constexpr' expansion of 'fmt::v11::fstring<const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>((* & std::forward<const char (&)[26]>((* & args#0))))'
/tmp/KTX-Software-4.4.2.old/external/fmt/include/fmt/base.h:2736:53:   in 'constexpr' expansion of 'fmt::v11::basic_string_view<char>(((const char*)s))'
 2736 |     if (FMT_USE_CONSTEVAL) parse_format_string<char>(s, checker(s, arg_pack()));
      |                            ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/KTX-Software-4.4.2.old/external/fmt/include/fmt/base.h:548:5: error: 'args#0' is not a constant expression
  548 |     while (*s++) ++len;
      |     ^~~~~

The following code no longer builds with GCC 16.1:

template <typename ...Arg>  
inline void do_print(Arg&&...a )  
{                       
        fmt::print(std::cerr, std::forward<Arg>(a)...);                                            
}

It can be fixed with

template <typename ...Arg>                               
inline void do_print(fmt::format_string<Arg...> f, Arg&&...a )  
{                                                                                                                                                                                          
        fmt::print(std::cerr, f, std::forward<Arg>(a)...);                                                                                                                                 
} 

This is however not sufficient and we get other fmt related failures in formatOptionalFileOffset, DiffHexFixedWidth.

I am not sure if this is a bug in KTX-Software, libfmt or gcc.
Replacing the bundled libfmt with system one 12.1.0 does not fix the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions