DiscussionsIssue archiveInstallation and Building

Archived discussion

OpenCascade - WebAssembly use

Installation and BuildingWed, 01/20/2021 - 13:082 replies

Browse this forum
QuestionAuthor

Hi,

Im trying to create small webassemby module converting IGES to VRML file.

C++ code compiled to "normal" application work ok. Emscripten compilation runs ok.  Then im loading created .js file to my page

Binded (EmBind) functions called from java script runs ok unless such function declares  IGESCAFControl_Reader object:

IGESCAFControl_Reader reader;

then error occurs in browser console "

Uncaught (in promise) getpwuid: TODO

Further investigations shows that problems is generated by IGESControl_Controller::Init() method in GESCAFControl_Reader constructor which construct IGESControl_Controller:

Handle(IGESControl_Controller) ADIGES = new IGESControl_Controller(Standard_False);

What may be reason for such error, and is there way to correct it?

Regards

Author

Discussion

2 archived replies

Posts are displayed in their archived order.

01Commenter-1
Uncaught (in promise) getpwuid: TODO

I believe, this could be a bug in Emscripten related to this function - it is probably has no implementation.
Compilation using this function (in OSD_Process.cxx) goes well, while causing a failure in runtime - which is unexpected behavior (either there should be a compile-time/link-time error or function should work as expected).
So I would report a bug to Emscripten project and see what they will say.

As a workaround, you may patch OSD_Process.cxx to avoid this function call - this function may unlikely be implemented in a reliable way in JavaScript world, so a fallback could be provided with "#ifdef __EMSCRIPTEN__" check.
I've seen a patch related to getpwuid() in some OCCT fork, but as it wasn't accompanied with a comment "why", I didn't understand what for it was done.

Don't forget to report a bug on OCCT Bugtracker if you will consider patching OCCT itself.

02Author

Hi,

Thank you for your support. The patch you proposed works. I will report this as you suggested at the evening.

Thanks