emscripten-core / emscripten

Emscripten: An LLVM-to-WebAssembly Compiler
Other
25.84k stars 3.31k forks source link

Operator Overloading Error in system/lib/libcxx/include/__algorithm/sort.h #22014

Open SaraBaradaran opened 5 months ago

SaraBaradaran commented 5 months ago

I faced the following error when compiling stxxl (https://github.com/stxxl/stxxl) using Emscripten. It seems there is a bug in system/lib/libcxx/include/__algorithm/sort.h header.

version: latest (3.1.60) and 3.1.54

/home/sara/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/__algorithm/sort.h:614:14: error: no viable overloaded '='
  614 |     *__begin = _Ops::__iter_move(__pivot_pos);
      |     ~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can reproduce the error using the following commands:

$ git clone https://github.com/stxxl/stxxl
$ cd stxxl
$ mkdir build
$ cd build
$ emcmake cmake -DBUILD_TESTS=ON ..
$ emmake cmake --build .
sbc100 commented 5 months ago

Emscripten uses the upstream libc++ from llvm so if this is a bug in libc++ then it is likely an llvm issue.

Did this project ever compile with emscripten?

SaraBaradaran commented 5 months ago

Emscripten uses the upstream libc++ from llvm so if this is a bug in libc++ then it is likely an llvm issue.

Did this project ever compile with emscripten?

Thank you for replying. I compiled the same project using emscripten version 3.1.41 which uses libc++ headers from llvm 16 and there wasn't such an error. This issue seems to be related to headers from new versions of llvm.

sbc100 commented 5 months ago

BTW it looks like https://github.com/stxxl/stxxl has not had a commit in 6 years.. perhaps its out of date in some way with respect the C++ standard.