Skip to content

shared:ERROR: unexpected error while trying to eval ctors Fatal: ...stopping since could not flatten memory #2418

@woodser

Description

@woodser

Hi. I am receiving this error when building a WASM project with the upstream emscripten backend and with pthreads enabled:

shared:ERROR: unexpected error while trying to eval ctors:
Fatal:   ...stopping since could not flatten memory

I first build boost libs system, thread, chrono, serialization, filesystem, and regex with -s USE_PTHREADS=1 -s ALLOW_MEMORY_GROWTH=0 passed to emcc and -pthread passed to cxxflags.

Then I build my source project which links to the boost libs as static libraries with -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=10 -s PROXY_TO_PTHREAD=1 -s ALLOW_MEMORY_GROWTH=0 passed to emcc and -pthread passed to cxxflags.

In what appears to be one of the final steps of linking, I get this error if and only if pthreads are enabled in boost and my project source. If I don't use pthreads, both projects build and link successfully, but then I cannot use emscripten's Fetch API synchronously, which is my end goal.

I cannot find any search results on this error except the original source code in wasm-ctor-eval.cpp so it not a commonly encountered problem.

I am not using the ported boost in emscripten-ports. Perhaps I need to?

The project will ultimately be run in node. Perhaps PR #9745 is relevant?

Any advice? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions