Skip to content

Unexpected error in system/lib/libcxx/include/__format/format_arg_store.h #22252

Closed
@SaraBaradaran

Description

@SaraBaradaran

I faced the following error when compiling network_opt (https://github.com/google/network-opt) using Emscripten. It seems there is a bug in LLVM's libc++ header system/lib/libcxx/include/__format/format_arg_store.h.

version: 3.1.54

/home/sara/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/__format/format_arg_store.h:227:34: error: parameter declarator cannot be qualified
  227 | template <class _Context, size_t N>
      |                                  ^

You can reproduce the error using the following commands:

$ git clone https://github.com/google/network-opt
$ cd network-opt
$ mkdir build
$ cd build
$ emcmake cmake -DCMAKE_CXX_FLAGS="-sUSE_BOOST_HEADERS" ..
$ emmake cmake --build .

Activity

kripken

kripken commented on Jul 17, 2024

@kripken
Member

I tried with 3.1.64. I had to add

git submodule init
git submodule update

to those commands. After that, it errors for me on

[ 39%] Building CXX object external/abseil-cpp/absl/hash/CMakeFiles/absl_hash.dir/internal/hash.cc.o
In file included from network-opt/external/abseil-cpp/absl/hash/internal/hash.cc:15:
In file included from network-opt/external/abseil-cpp/absl/hash/internal/hash.h:48:
In file included from network-opt/external/abseil-cpp/absl/container/fixed_array.h:50:
network-opt/external/abseil-cpp/absl/container/internal/compressed_tuple.h:252:42: error: no member named 'get' in the global namespace
  252 |     return std::move(*this).StorageT<I>::get();
      |                                        ~~^
network-opt/external/abseil-cpp/absl/container/internal/compressed_tuple.h:257:43: error: no member named 'get' in the global namespace
  257 |     return absl::move(*this).StorageT<I>::get();
      |                                         ~~^
2 errors generated.

which I do not understand, but looks like a project-specific issue?

SaraBaradaran

SaraBaradaran commented on Jul 18, 2024

@SaraBaradaran
Author

I tried with 3.1.64. I had to add

git submodule init
git submodule update

to those commands. After that, it errors for me on

[ 39%] Building CXX object external/abseil-cpp/absl/hash/CMakeFiles/absl_hash.dir/internal/hash.cc.o
In file included from network-opt/external/abseil-cpp/absl/hash/internal/hash.cc:15:
In file included from network-opt/external/abseil-cpp/absl/hash/internal/hash.h:48:
In file included from network-opt/external/abseil-cpp/absl/container/fixed_array.h:50:
network-opt/external/abseil-cpp/absl/container/internal/compressed_tuple.h:252:42: error: no member named 'get' in the global namespace
  252 |     return std::move(*this).StorageT<I>::get();
      |                                        ~~^
network-opt/external/abseil-cpp/absl/container/internal/compressed_tuple.h:257:43: error: no member named 'get' in the global namespace
  257 |     return absl::move(*this).StorageT<I>::get();
      |                                         ~~^
2 errors generated.

which I do not understand, but looks like a project-specific issue?

Thank you for replying. I found there is no version 3.1.64 in emsdk. The latest version is 3.1.63. When I tried with 3.1.54, I received the following error message. I've also added git submodule init and git submodule update as you mentioned.

[ 68%] Building CXX object CMakeFiles/network_opt.dir/src/network_opt_local.cc.o
In file included from /home/sara/test2/network-opt/src/network_opt_local.cc:16:
In file included from /home/sara/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/chrono:796:
In file included from /home/sara/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/__chrono/formatter.h:23:
In file included from /home/sara/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/__chrono/ostream.h:30:
In file included from /home/sara/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/__format/format_functions.h:19:
/home/sara/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/__format/format_arg_store.h:227:34: error: parameter declarator cannot be qualified
  227 | template <class _Context, size_t N>
      |                                  ^
/home/sara/test2/network-opt/src/network_opt.h:29:30: note: expanded from macro 'N'
   29 | #define N network_opt::Node::create
      |           ~~~~~~~~~~~~~~~~~~~^
In file included from /home/sara/test2/network-opt/src/network_opt_local.cc:16:
In file included from /home/sara/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/chrono:796:
In file included from /home/sara/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/__chrono/formatter.h:23:
In file included from /home/sara/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/__chrono/ostream.h:30:
In file included from /home/sara/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/__format/format_functions.h:19:
/home/sara/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/__format/format_arg_store.h:229:48: error: reference to overloaded function could not be resolved; did you mean to call it with no arguments?
  229 |   __basic_format_arg_value<_Context> __values_[N];
      |                                                ^

When I tried with Emscripten version 3.1.63, there wasn't such an error. This issue seems to be solved by LLVM's libc++ headers 18 as did by (#21638)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

        Participants

        @kripken@SaraBaradaran

        Issue actions

          Unexpected error in system/lib/libcxx/include/__format/format_arg_store.h · Issue #22252 · emscripten-core/emscripten