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

Assertion failed in wasm-emscripten-finalize when compiling with -s RELOCATABLE=1 and -s USE_PTHREADS=1 #11375

Closed
jprendes opened this issue Jun 8, 2020 · 2 comments

Comments

@jprendes
Copy link
Contributor

jprendes commented Jun 8, 2020

I am trying to get dynamic linking working with pthreads.
After seeing kripken's comment in this issue, I was trying to get non-dlopen dynamic linking and pthreads working.
My first attempt was to remove the xxxx_MODULE + USE_PTHREADS assertions from emcc.py, but I hit a C++ assertion failure in wasm-emscripten-finalize.
I hit the same error without changing anything in emscripten's code if I use RELOCATABLE and USE_PTHREADS.

Reproduction steps:

em++ --version

emcc (Emscripten gcc/clang-like replacement) 1.39.16 (9ecd579ac647c4484e2d9af2ab0bbc1e1505aa95)
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

main.cpp:

#include <emscripten.h>
extern "C" {
EMSCRIPTEN_KEEPALIVE
int run(void) {
    return 42;
}
}

I am compiling with

$ em++ -s RELOCATABLE=1 -s USE_PTHREADS=1 --no-entry -o main.js main.cpp

I get the following error:

wasm-emscripten-finalize: /b/s/w/ir/cache/builder/emscripten-releases/binaryen/src/wasm/wasm.cpp:832: void wasm::Binary::finalize(): Assertion `left && right' failed.
em++: error: '/path/to/emsdk/upstream/bin/wasm-emscripten-finalize --detect-features --global-base=0 --check-stack-overflow --pass-arg=legalize-js-interface-export-originals /tmp/emscripten_temp_0se714du/main.wasm -o /tmp/emscripten_temp_0se714du/main.wasm.o.wasm' failed (-6)
@sbc100
Copy link
Collaborator

sbc100 commented Jun 8, 2020

I'm afraid that making work will require more than just removing the check.

If you want to work on this you will most likely need to dig deep into both emscripten and binaryen.

With this first issue you are hitting you will need to look at the binaryen code to find out why that assertion is firing.

@jprendes
Copy link
Contributor Author

I believe this issue was addressed by #13245 and can be closed.

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