Compile error VS with Clang

Author: brccabralCreated Jul 16, 2026Updated Jul 22, 2026

I am trying to compile on Windows with Visual Studio. I did the steps to decompress MM and VS has Clang+Cmake support.

call to consteval function 'fmt::basic_format_string<char, const char *&, fmt::basic_string_view<char>>::basic_format_string<FMT_COMPILE_STRING, 0>' is not a constant expression

>------ Build started: Project: CMakeLists, Configuration: Release ------ (skipped messages) Working dir: D:\GitHubProjects\Zelda64Recomp [84/1204] Generating ../src/shaders/RasterPSDynamicMS.hlsl.spv [85/1204] Generating ../src/shaders/RasterVSSpecConstantFlat.hlsl.spv [86/1204] Generating ../src/shaders/FbChangesClearCS.hlsl.dxil [87/1204] Generating ../src/shaders/RasterPSDynamic.hlsl.spv [88/1204] Generating ../src/shaders/FbChangesClearCS.hlsl.spv [89/1204] Generating ../src/shaders/FbChangesDrawColorPS.hlsl.dxil [90/1204] Generating ../src/shaders/FbChangesDrawColorPS.hlsl.spv [91/1204] Generating ../src/shaders/FbChangesDrawDepthPS.hlsl.dxil [92/1204] Generating ../src/shaders/FbReadAnyChangesCS.hlsl.dxil [93/1204] Generating ../src/shaders/FbChangesDrawDepthPS.hlsl.spv [94/1204] Generating ../src/shaders/FbReinterpretCS.hlsl.dxil [95/1204] Generating ../src/shaders/FbReadAnyChangesCS.hlsl.spv [96/1204] Building CXX object lib\N64ModernRuntime\librecomp\N64Recomp\lib\fmt\CMakeFiles\fmt.dir\src\os.cc.obj FAILED: [code=1] lib/N64ModernRuntime/librecomp/N64Recomp/lib/fmt/CMakeFiles/fmt.dir/src/os.cc.obj D:\PROGRA~1\LLVM\bin\clang-cl.exe /nologo -TP -DHLSL_CPU -DNOMINMAX -ID:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include --target=amd64-pc-windows-msvc -fdiagnostics-absolute-paths /DWIN32 /D_WINDOWS /EHsc -Wno-everything -D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR /O2 /Ob2 /DNDEBUG -std:c++20 -MD /utf-8 -clang:-MD -clang:-MTlib\N64ModernRuntime\librecomp\N64Recomp\lib\fmt\CMakeFiles\fmt.dir\src\os.cc.obj -clang:-MFlib\N64ModernRuntime\librecomp\N64Recomp\lib\fmt\CMakeFiles\fmt.dir\src\os.cc.obj.d /Folib\N64ModernRuntime\librecomp\N64Recomp\lib\fmt\CMakeFiles\fmt.dir\src\os.cc.obj /Fdfmt.pdb -c -- D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\src\os.cc D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\src\os.cc(148,39): error : call to consteval function 'fmt::basic_format_string>::basic_format_string' is not a constant expression 148 | fmt::format_to(appender(out), FMT_STRING("{}: {}"), message, | ^ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\format.h(1840,23): note: expanded from macro 'FMT_STRING' 1840 | #define FMT_STRING(s) FMT_STRING_IMPL(s, fmt::detail::compile_string, ) | ^ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\format.h(1817,3): note: expanded from macro 'FMT_STRING_IMPL' 1817 | [] { \ | ^ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\base.h(757,54): note: subexpression not valid in a constant expression 757 | format_str_.remove_prefix(detail::to_unsigned(it - begin())); | ~~~^~~~~~~~~ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\base.h(2761,5): note: in call to 'this->context_.advance_to(&"{}: {}"[1])' 2761 | context_.advance_to(begin); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\base.h(2756,5): note: in call to 'this->on_format_specs(0, &"{}: {}"[1], &"{}: {}"[1])' 2756 | on_format_specs(id, begin, begin); // Call parse() on empty specs. | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\base.h(2581,5): note: in call to 'handler.on_replacement_field(0, &"{}: {}"[1])' 2581 | handler.on_replacement_field(handler.on_arg_id(), begin); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\base.h(2613,21): note: in call to 'parse_replacement_field> &>(&"{}: {}"[1], &"{}: {}"[6], checker(s))' 2613 | begin = p = parse_replacement_field(p - 1, end, handler); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\base.h(2879,7): note: in call to 'parse_format_string>>({&"{}: {}"[0], 6}, checker(s))' 2879 | detail::parse_format_string(str_, checker(s)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\src\os.cc(148,39): note: in call to 'basic_format_string([] { struct __attribute__((visibility("hidden"))) FMT_COMPILE_STRING : fmt::detail::compile_string { using char_type [[maybe_unused]] = fmt::remove_cvref_t; [[maybe_unused]] constexpr operator basic_string_view() const { return fmt::detail_exported::compile_string_to_view("{}: {}"); } }; return FMT_COMPILE_STRING(); }())' 148 | fmt::format_to(appender(out), FMT_STRING("{}: {}"), message, | ^~~~~~~~~~~~~~~~~~~~ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\format.h(1840,23): note: expanded from macro 'FMT_STRING' 1840 | #define FMT_STRING(s) FMT_STRING_IMPL(s, fmt::detail::compile_string, ) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\format.h(1817,3): note: expanded from macro 'FMT_STRING_IMPL' 1817 | [] { \ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1818 | /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1819 | /* Use a macro-like name to avoid shadowing warnings. */ \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1820 | struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1821 | using char_type FMT_MAYBE_UNUSED = fmt::remove_cvref_t; \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1822 | FMT_MAYBE_UNUSED FMT_CONSTEXPR explicit \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1823 | operator fmt::basic_string_view() const { \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1824 | return fmt::detail_exported::compile_string_to_view(s); \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1825 | } \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1826 | }; \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1827 | return FMT_COMPILE_STRING(); \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1828 | }() | ~~~ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\src\os.cc(172,35): error : call to consteval function 'fmt::basic_format_string::basic_format_string' is not a constant expression 172 | FMT_THROW(system_error(errno, FMT_STRING("cannot open file {}"), | ^ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\format.h(1840,23): note: expanded from macro 'FMT_STRING' 1840 | #define FMT_STRING(s) FMT_STRING_IMPL(s, fmt::detail::compile_string, ) | ^ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\format.h(1817,3): note: expanded from macro 'FMT_STRING_IMPL' 1817 | [] { \ | ^ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\base.h(757,54): note: subexpression not valid in a constant expression 757 | format_str_.remove_prefix(detail::to_unsigned(it - begin())); | ~~~^~~~~~~~~ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\base.h(2761,5): note: in call to 'this->context_.advance_to(&"cannot open file {}"[18])' 2761 | context_.advance_to(begin); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\base.h(2756,5): note: in call to 'this->on_format_specs(0, &"cannot open file {}"[18], &"cannot open file {}"[18])' 2756 | on_format_specs(id, begin, begin); // Call parse() on empty specs. | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\base.h(2581,5): note: in call to 'handler.on_replacement_field(0, &"cannot open file {}"[18])' 2581 | handler.on_replacement_field(handler.on_arg_id(), begin); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\base.h(2613,21): note: in call to 'parse_replacement_field &>(&"cannot open file {}"[18], &"cannot open file {}"[19], checker(s))' 2613 | begin = p = parse_replacement_field(p - 1, end, handler); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\base.h(2879,7): note: in call to 'parse_format_string>({&"cannot open file {}"[0], 19}, checker(s))' 2879 | detail::parse_format_string(str_, checker(s)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\src\os.cc(172,35): note: in call to 'basic_format_string([] { struct __attribute__((visibility("hidden"))) FMT_COMPILE_STRING : fmt::detail::compile_string { using char_type [[maybe_unused]] = fmt::remove_cvref_t; [[maybe_unused]] constexpr operator basic_string_view() const { return fmt::detail_exported::compile_string_to_view("cannot open file {}"); } }; return FMT_COMPILE_STRING(); }())' 172 | FMT_THROW(system_error(errno, FMT_STRING("cannot open file {}"), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 173 | filename.c_str())); | ~~~~~~~~~~~~~~~~~~ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\format.h(1840,23): note: expanded from macro 'FMT_STRING' 1840 | #define FMT_STRING(s) FMT_STRING_IMPL(s, fmt::detail::compile_string, ) | ^ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\format.h(1817,3): note: expanded from macro 'FMT_STRING_IMPL' 1817 | [] { \ | ^ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\format.h(125,45): note: expanded from macro 'FMT_THROW' 125 | # define FMT_THROW(x) detail::do_throw(x) | ^ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\src\os.cc(287,16): error : call to consteval function 'fmt::basic_format_string::basic_format_string' is not a constant expression 287 | errno, FMT_STRING("cannot duplicate file descriptor {}"), fd)); | ^ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\format.h(1840,23): note: expanded from macro 'FMT_STRING' 1840 | #define FMT_STRING(s) FMT_STRING_IMPL(s, fmt::detail::compile_string, ) | ^ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\format.h(1817,3): note: expanded from macro 'FMT_STRING_IMPL' 1817 | [] { \ | ^ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\base.h(757,54): note: subexpression not valid in a constant expression 757 | format_str_.remove_prefix(detail::to_unsigned(it - begin())); | ~~~^~~~~~~~~ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\base.h(2761,5): note: in call to 'this->context_.advance_to(&"cannot duplicate file descriptor {}"[34])' 2761 | context_.advance_to(begin); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\base.h(2756,5): note: in call to 'this->on_format_specs(0, &"cannot duplicate file descriptor {}"[34], &"cannot duplicate file descriptor {}"[34])' 2756 | on_format_specs(id, begin, begin); // Call parse() on empty specs. | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\base.h(2581,5): note: in call to 'handler.on_replacement_field(0, &"cannot duplicate file descriptor {}"[34])' 2581 | handler.on_replacement_field(handler.on_arg_id(), begin); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\base.h(2647,13): note: in call to 'parse_replacement_field &>(&"cannot duplicate file descriptor {}"[34], &"cannot duplicate file descriptor {}"[35], checker(s))' 2647 | begin = parse_replacement_field(p, end, handler); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\base.h(2879,7): note: in call to 'parse_format_string>({&"cannot duplicate file descriptor {}"[0], 35}, checker(s))' 2879 | detail::parse_format_string(str_, checker(s)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\src\os.cc(287,16): note: in call to 'basic_format_string([] { struct __attribute__((visibility("hidden"))) FMT_COMPILE_STRING : fmt::detail::compile_string { using char_type [[maybe_unused]] = fmt::remove_cvref_t; [[maybe_unused]] constexpr operator basic_string_view() const { return fmt::detail_exported::compile_string_to_view("cannot duplicate file descriptor {}"); } }; return FMT_COMPILE_STRING(); }())' 286 | FMT_THROW(system_error( | ~~~~~~~~~~~~~~~~~~~~~~~ 287 | errno, FMT_STRING("cannot duplicate file descriptor {}"), fd)); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\format.h(1840,23): note: expanded from macro 'FMT_STRING' 1840 | #define FMT_STRING(s) FMT_STRING_IMPL(s, fmt::detail::compile_string, ) | ^ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\format.h(1817,3): note: expanded from macro 'FMT_STRING_IMPL' 1817 | [] { \ | ^ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\format.h(125,45): note: expanded from macro 'FMT_THROW' 125 | # define FMT_THROW(x) detail::do_throw(x) | ^ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\src\os.cc(296,16): error : call to consteval function 'fmt::basic_format_string::basic_format_string' is not a constant expression 296 | errno, FMT_STRING("cannot duplicate file descriptor {} to {}"), fd_, | ^ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\format.h(1840,23): note: expanded from macro 'FMT_STRING' 1840 | #define FMT_STRING(s) FMT_STRING_IMPL(s, fmt::detail::compile_string, ) | ^ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\format.h(1817,3): note: expanded from macro 'FMT_STRING_IMPL' 1817 | [] { \ | ^ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\base.h(757,54): note: subexpression not valid in a constant expression 757 | format_str_.remove_prefix(detail::to_unsigned(it - begin())); | ~~~^~~~~~~~~ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\base.h(2761,5): note: in call to 'this->context_.advance_to(&"cannot duplicate file descriptor {} to {}"[34])' 2761 | context_.advance_to(begin); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\base.h(2756,5): note: in call to 'this->on_format_specs(0, &"cannot duplicate file descriptor {} to {}"[34], &"cannot duplicate file descriptor {} to {}"[34])' 2756 | on_format_specs(id, begin, begin); // Call parse() on empty specs. | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\base.h(2581,5): note: in call to 'handler.on_replacement_field(0, &"cannot duplicate file descriptor {} to {}"[34])' 2581 | handler.on_replacement_field(handler.on_arg_id(), begin); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ D:\GitHubProjects\Zelda64Recomp\lib\N64ModernRuntime\N64Recomp\lib\fmt\include\fmt\base.h(2647,13): note: in call to 'parse_replacement_field &>(&"cannot duplicate file descriptor {} to {}"[34], &"cannot duplicate file descriptor {} to {}"[41], checker(s))' 2647 | begin = parse_replacement_field(p, en

Source: Zelda64Recomp/Zelda64Recomp