Skip to content

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

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

Open
SaraBaradaran opened this issue Feb 21, 2024 · 3 comments
Open

Comments

@SaraBaradaran
Copy link

SaraBaradaran commented Feb 21, 2024

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 .
@sbc100
Copy link
Collaborator

sbc100 commented Feb 21, 2024

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?

@SaraBaradaran
Copy link
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.

@sbc100
Copy link
Collaborator

sbc100 commented Mar 25, 2024

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants