Skip to content

Error in system/lib/libcxx/include/optional when _LIBCPP_STD_VER < 20 #21382

Open

Description

@SaraBaradaran

I faced the following error when compiling cpputest (https://github.com/cpputest/cpputest) using Emscripten. It seems there is a bug in system/lib/libcxx/include/optional when _LIBCPP_STD_VER < 20.

version: latest and even 3.1.54

/home/sara/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/optional:419:16: error: type name requires a specifier or qualifier
  419 |         ::new ((void*)_VSTD::addressof(this->__val_)) value_type(_VSTD::forward<_Args>(__args)...);
      |                ^
/home/sara/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/optional:419:23: error: expected ')'
  419 |         ::new ((void*)_VSTD::addressof(this->__val_)) value_type(_VSTD::forward<_Args>(__args)...);
      |                       ^
/home/sara/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/__config:848:17: note: expanded from macro '_VSTD'
  848 | #  define _VSTD std
      |                 ^
/home/sara/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/optional:419:15: note: to match this '('
  419 |         ::new ((void*)_VSTD::addressof(this->__val_)) value_type(_VSTD::forward<_Args>(__args)...);
      |

You can reproduce the error using the following commands:

$ git clone https://github.com/cpputest/cpputest
$ cd cpputest/build
$ emcmake cmake ..
$ emmake cmake --build .

Activity

  1. sbc100 commented on Feb 21, 2024

    @sbc100
    Collaborator

    Emscripten uses the libc++ headers from the latest stable llvm release. That means we are currently including the libc++ headers from llvm 17. Its likely that this issue is an upstream issue with llvm 17. Is there some way you could try building that library with libc++-17 to confirm this?

  2. SaraBaradaran commented on Mar 24, 2024

    @SaraBaradaran
    Author

    Emscripten uses the libc++ headers from the latest stable llvm release. That means we are currently including the libc++ headers from llvm 17. Its likely that this issue is an upstream issue with llvm 17. Is there some way you could try building that library with libc++-17 to confirm this?

    Thanks for your response. I compiled the same project using emscripten version 3.1.41 which uses libc++ headers from llvm 16 and it could build the project without introducing any errors. So, this seems to be an issue related to headers from llvm 17.

  3. sbc100 commented on Mar 25, 2024

    @sbc100
    Collaborator

    Let see if this bug is fixed when we update the llvm headers: #21530

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

      Issue actions