Unable to compile WebAssembly app when STEPCAFControl_Reader is used.

RockWithBoA

CAD practitioner
I'm trying to read a step file and display it. When I create a STEPCAFControl_Reader object, compile will fail with the following error:

em++: error: 'D:/emsdk/upstream\bin\wasm-emscripten-finalize --minimize-wasm-changes -g --dyncalls-i64 --dwarf occt-webgl-sample.wasm -o occt-webgl-sample.wasm --detect-features' failed (returned 3221226505)
mingw32-make[2]: *** [src/occt-webgl-sample.js] Error 1
mingw32-make[1]: *** [src/CMakeFiles/occt-webgl-sample.dir/all] Error 2
mingw32-make: *** [all] Error 2
emmake: error: 'D:\emsdk\mingw\4.6.2_32bit\mingw32-make.exe install' failed (returned 2)

The code snippet causing the issue is as shown below. The error occurs once "STEPCAFControl_Reader cafReader;" is used.
C++:
Handle(TDocStd_Document) StepModelLoader::Load()
{
    //Create XDE document.
    Handle(TDocStd_Application) app = new TDocStd_Application;
    BinXCAFDrivers::DefineFormat(app);
    Handle(TDocStd_Document) doc;
    app->NewDocument("BinXCAF", doc);

    STEPCAFControl_Reader cafReader;
    // STEPControl_Reader& reader = cafReader.ChangeReader();
    
    return doc;
}

I'm wondering if OCAF supports webassembly? Or do I missing something? I've attached my test code.
 

Attachments

  • src.zip
    17.3 KB · Views: 0

JSlyadne

Administrator
Staff member
Hello! Since Emscripten is the compiler of C/C++ to WebAssembly, I believe the issue lies somewhere outside of OCCT. If I were you, I would look for a help on forums dedicated to Emscripten.
 

RockWithBoA

CAD practitioner
Hello! Since Emscripten is the compiler of C/C++ to WebAssembly, I believe the issue lies somewhere outside of OCCT. If I were you, I would look for a help on forums dedicated to Emscripten.
Thank you for your help. I reported it for Emscripten and it turns out that it is related to the drawf info being generated during build in debug mode. wasm-emscripten-finalize needs to consume a lot of memory (more than 10 GB) to generate that info and it crashes due to out of memory.
 

JSlyadne

Administrator
Staff member
Thank you for your help. I reported it for Emscripten and it turns out that it is related to the drawf info being generated during build in debug mode. wasm-emscripten-finalize needs to consume a lot of memory (more than 10 GB) to generate that info and it crashes due to out of memory.
Thank you for sharing this! I see many people interesting in bringing OCCT to Web, so your experience will be appreciated by them.
 
Top