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

Building with emsdk 3.1.68 fails due to consteval of non-const expression in fmtlib #6

Open
kirkrodrigues opened this issue Sep 30, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@kirkrodrigues
Copy link
Member

kirkrodrigues commented Sep 30, 2024

Bug

When building clp-ffi-js with the latest version of emsdk (3.1.68), the build fails with the following error:

In file included from /root/clp-ffi-js/src/submodules/fmt/src/format.cc:8:
/root/clp-ffi-js/src/submodules/fmt/include/fmt/format-inl.h:2514:30: error: call to consteval function 'fmt::basic_format_string<char, unsigned int &>::basic_format_string<FMT_COMPILE_STRING, 0>' is not a constant expression
 2514 |         out = format_to(out, FMT_STRING("{:x}"), value);
      |                              ^
/root/clp-ffi-js/src/submodules/fmt/include/fmt/format.h:2155:23: note: expanded from macro 'FMT_STRING'
 2155 | #define FMT_STRING(s) FMT_STRING_IMPL(s, fmt::compile_string, )
      |                       ^
/root/clp-ffi-js/src/submodules/fmt/include/fmt/format.h:2132:3: note: expanded from macro 'FMT_STRING_IMPL'
 2132 |   [] {                                                                     \
      |   ^
/root/clp-ffi-js/src/submodules/fmt/include/fmt/core.h:2712:51: note: subexpression not valid in a constant expression
 2712 |     context_.advance_to(context_.begin() + (begin - &*context_.begin()));
      |                                             ~~~~~~^~~~~~~~~~~~~~~~~~~~
/root/clp-ffi-js/src/submodules/fmt/include/fmt/core.h:2371:15: note: in call to 'handler.on_format_specs(0, &"{:x}"[2], &"{:x}"[4])'
 2371 |       begin = handler.on_format_specs(adapter.arg_id, begin + 1, end);
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/clp-ffi-js/src/submodules/fmt/include/fmt/core.h:2396:21: note: in call to 'parse_replacement_field<char, fmt::detail::format_string_checker<char, fmt::detail::error_handler, unsigned int> &>(&"{:x}"[1], &"{:x}"[4], checker(s, {}))'
 2396 |         begin = p = parse_replacement_field(p - 1, end, handler);
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/clp-ffi-js/src/submodules/fmt/include/fmt/core.h:2845:7: note: in call to 'parse_format_string<true, char, fmt::detail::format_string_checker<char, fmt::detail::error_handler, unsigned int>>({&"{:x}"[0], 4}, checker(s, {}))'
 2845 |       detail::parse_format_string<true>(str_, checker(s, {}));
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/clp-ffi-js/src/submodules/fmt/include/fmt/format-inl.h:2514:30: note: in call to 'basic_format_string<FMT_COMPILE_STRING, 0>([] {
    struct FMT_COMPILE_STRING : fmt::compile_string {
        using char_type = fmt::remove_cvref_t<decltype("{:x}"[0])>;
        [[maybe_unused]] constexpr operator fmt::basic_string_view<char_type>() const {
            return fmt::detail_exported::compile_string_to_view<char_type>("{:x}");
        }
    };
    return FMT_COMPILE_STRING();
}())'
 2514 |         out = format_to(out, FMT_STRING("{:x}"), value);
      |                              ^~~~~~~~~~~~~~~~~~
/root/clp-ffi-js/src/submodules/fmt/include/fmt/format.h:2155:23: note: expanded from macro 'FMT_STRING'
 2155 | #define FMT_STRING(s) FMT_STRING_IMPL(s, fmt::compile_string, )
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/clp-ffi-js/src/submodules/fmt/include/fmt/format.h:2132:3: note: expanded from macro 'FMT_STRING_IMPL'
 2132 |   [] {                                                                     \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2133 |     /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2134 |     /* Use a macro-like name to avoid shadowing warnings. */               \
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2135 |     struct FMT_GCC_VISIBILITY_HIDDEN FMT_COMPILE_STRING : base {           \
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2136 |       using char_type = fmt::remove_cvref_t<decltype(s[0])>;               \
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2137 |       FMT_MAYBE_UNUSED FMT_CONSTEXPR explicit                              \
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2138 |       operator fmt::basic_string_view<char_type>() const {                 \
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2139 |         return fmt::detail_exported::compile_string_to_view<char_type>(s); \
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2140 |       }                                                                    \
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2141 |     };                                                                     \
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2142 |     return FMT_COMPILE_STRING();                                           \
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2143 |   }()
      |   ~~~
In file included from /root/clp-ffi-js/src/submodules/fmt/src/format.cc:8:
/root/clp-ffi-js/src/submodules/fmt/include/fmt/format-inl.h:2518:28: error: call to consteval function 'fmt::basic_format_string<char, unsigned int &>::basic_format_string<FMT_COMPILE_STRING, 0>' is not a constant expression
 2518 |       out = format_to(out, FMT_STRING("{:08x}"), value);
      |                            ^
/root/clp-ffi-js/src/submodules/fmt/include/fmt/format.h:2155:23: note: expanded from macro 'FMT_STRING'
 2155 | #define FMT_STRING(s) FMT_STRING_IMPL(s, fmt::compile_string, )
      |                       ^
/root/clp-ffi-js/src/submodules/fmt/include/fmt/format.h:2132:3: note: expanded from macro 'FMT_STRING_IMPL'
 2132 |   [] {                                                                     \
      |   ^
/root/clp-ffi-js/src/submodules/fmt/include/fmt/core.h:2712:51: note: subexpression not valid in a constant expression
 2712 |     context_.advance_to(context_.begin() + (begin - &*context_.begin()));
      |                                             ~~~~~~^~~~~~~~~~~~~~~~~~~~
/root/clp-ffi-js/src/submodules/fmt/include/fmt/core.h:2371:15: note: in call to 'handler.on_format_specs(0, &"{:08x}"[2], &"{:08x}"[6])'
 2371 |       begin = handler.on_format_specs(adapter.arg_id, begin + 1, end);
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/clp-ffi-js/src/submodules/fmt/include/fmt/core.h:2396:21: note: in call to 'parse_replacement_field<char, fmt::detail::format_string_checker<char, fmt::detail::error_handler, unsigned int> &>(&"{:08x}"[1], &"{:08x}"[6], checker(s, {}))'
 2396 |         begin = p = parse_replacement_field(p - 1, end, handler);
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/clp-ffi-js/src/submodules/fmt/include/fmt/format.h:2132:3: note: expanded from macro 'FMT_STRING_IMPL'
2132 |   [] {                                                                     \
     |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2133 |     /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \
     |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2134 |     /* Use a macro-like name to avoid shadowing warnings. */               \
     |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2135 |     struct FMT_GCC_VISIBILITY_HIDDEN FMT_COMPILE_STRING : base {           \
     |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2136 |       using char_type = fmt::remove_cvref_t<decltype(s[0])>;               \
     |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2137 |       FMT_MAYBE_UNUSED FMT_CONSTEXPR explicit                              \
     |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2138 |       operator fmt::basic_string_view<char_type>() const {                 \
     |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2139 |         return fmt::detail_exported::compile_string_to_view<char_type>(s); \
     |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2140 |       }                                                                    \
     |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2141 |     };                                                                     \
     |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2142 |     return FMT_COMPILE_STRING();                                           \
     |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2143 |   }()
     |   ~~~
In file included from /root/clp-ffi-js/src/submodules/fmt/src/format.cc:8:
/root/clp-ffi-js/src/submodules/fmt/include/fmt/format-inl.h:2518:28: error: call to consteval function 'fmt::basic_format_string<char, unsigned int &>::basic_format_string<FMT_COMPILE_STRING, 0>' is not a constant expression
2518 |       out = format_to(out, FMT_STRING("{:08x}"), value);
     |                            ^
/root/clp-ffi-js/src/submodules/fmt/include/fmt/format.h:2155:23: note: expanded from macro 'FMT_STRING'
2155 | #define FMT_STRING(s) FMT_STRING_IMPL(s, fmt::compile_string, )
     |                       ^
/root/clp-ffi-js/src/submodules/fmt/include/fmt/format.h:2132:3: note: expanded from macro 'FMT_STRING_IMPL'
2132 |   [] {                                                                     \
     |   ^
/root/clp-ffi-js/src/submodules/fmt/include/fmt/core.h:2712:51: note: subexpression not valid in a constant expression
2712 |     context_.advance_to(context_.begin() + (begin - &*context_.begin()));
     |                                             ~~~~~~^~~~~~~~~~~~~~~~~~~~
/root/clp-ffi-js/src/submodules/fmt/include/fmt/core.h:2371:15: note: in call to 'handler.on_format_specs(0, &"{:08x}"[2], &"{:08x}"[6])'
2371 |       begin = handler.on_format_specs(adapter.arg_id, begin + 1, end);
     |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/clp-ffi-js/src/submodules/fmt/include/fmt/core.h:2396:21: note: in call to 'parse_replacement_field<char, fmt::detail::format_string_checker<char, fmt::detail::error_handler, unsigned int> &>(&"{:08x}"[1], &"{:08x}"[6], checker(s, {}))'
2396 |         begin = p = parse_replacement_field(p - 1, end, handler);
     |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/clp-ffi-js/src/submodules/fmt/include/fmt/core.h:2845:7: note: in call to 'parse_format_string<true, char, fmt::detail::format_string_checker<char, fmt::detail::error_handler, unsigned int>>({&"{:08x}"[0], 6}, checker(s, {}))'
 2845 |       detail::parse_format_string<true>(str_, checker(s, {}));
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/clp-ffi-js/src/submodules/fmt/include/fmt/format-inl.h:2518:28: note: in call to 'basic_format_string<FMT_COMPILE_STRING, 0>([] {
    struct FMT_COMPILE_STRING : fmt::compile_string {
        using char_type = fmt::remove_cvref_t<decltype("{:08x}"[0])>;
        [[maybe_unused]] constexpr operator fmt::basic_string_view<char_type>() const {
            return fmt::detail_exported::compile_string_to_view<char_type>("{:08x}");
        }
    };
    return FMT_COMPILE_STRING();
}())'
 2518 |       out = format_to(out, FMT_STRING("{:08x}"), value);
      |                            ^~~~~~~~~~~~~~~~~~~~
/root/clp-ffi-js/src/submodules/fmt/include/fmt/format.h:2155:23: note: expanded from macro 'FMT_STRING'
 2155 | #define FMT_STRING(s) FMT_STRING_IMPL(s, fmt::compile_string, )
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/clp-ffi-js/src/submodules/fmt/include/fmt/format.h:2132:3: note: expanded from macro 'FMT_STRING_IMPL'
 2132 |   [] {                                                                     \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2133 |     /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2134 |     /* Use a macro-like name to avoid shadowing warnings. */               \
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2135 |     struct FMT_GCC_VISIBILITY_HIDDEN FMT_COMPILE_STRING : base {           \
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2136 |       using char_type = fmt::remove_cvref_t<decltype(s[0])>;               \
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2137 |       FMT_MAYBE_UNUSED FMT_CONSTEXPR explicit                              \
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2138 |       operator fmt::basic_string_view<char_type>() const {                 \
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2139 |         return fmt::detail_exported::compile_string_to_view<char_type>(s); \
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2140 |       }                                                                    \
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2141 |     };                                                                     \
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2142 |     return FMT_COMPILE_STRING();                                           \
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2143 |   }()
      |   ~~~
2 errors generated.
gmake[3]: *** [CMakeFiles/ClpFfiJs.dir/build.make:197: CMakeFiles/ClpFfiJs.dir/src/submodules/fmt/src/format.cc.o] Error 1
gmake[3]: *** Waiting for unfinished jobs....
gmake[2]: *** [CMakeFiles/Makefile2:83: CMakeFiles/ClpFfiJs.dir/all] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:90: CMakeFiles/ClpFfiJs.dir/rule] Error 2
gmake: *** [Makefile:124: ClpFfiJs] Error 2
exit status 2

Locking emsdk's version to 3.1.67 and performing a clean build resolves the issue.

clp-ffi-js version

a6a518f

Environment

Ubuntu 22.04 (Jammy)

Reproduction steps

task clean
task
@junhaoliao
Copy link
Collaborator

The issue is also reported in the Emscripten repo: emscripten-core/emsdk#1480

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants