unoplatform / Uno.Wasm.Bootstrap

A simple nuget package to run C# code in a WASM-compatible browser
Other
373 stars 57 forks source link

Some changes needed by Wave Engine #245

Closed MarcosCobena closed 4 years ago

MarcosCobena commented 4 years ago

Hi!

We, @WaveEngine, would like moving to this package for everything Mono/Wasm related. Among other things, we are interested in statically linking the OpenGL layer to gain some speed in there.

Our mate @davilovick has pushed some changes to consume the latest Mono bits, which has required bumping Emscripten, which has required moving into WSL for some IO stuff:

https://github.com/unoplatform/Uno.Wasm.Bootstrap/compare/master...davilovick:master

Would there be any chance those could be included in your repo? We have not wanted to create a PR directly, as consider you may find a better way of doing things, or even have any other block.

We are considering as well forking this package to quickly offer such in our next release but, ideally, would really like to simply consume yours :-)

Thanks in advance!

jeromelaban commented 4 years ago

Hey @MarcosCobena !

We'll be updating the mono runtime soon, along with the emscripten version (hoping that https://github.com/emscripten-core/emscripten/issues/10551) will have some available fix or workaround.

For now, we have one more update to put in for the 1.3 release, they we'll do the mono updates in the 1.4 release.

That being said, could you explain the other WSL related updates in your branch? Are the paths incorrect for your scenario ?

davilovick commented 4 years ago

Testing with mono master branch version and Emscripten 1.39.18 we've found the following issue:

If Emsdk was deployed on any Windows folder (project obj by default, or other windows folder, not in WSL filesystem) the ninja build process fails throwing several Permission denied errors while trying to copy some files from Emsdk. This is usually caused because some process maintain some files locked in the Windows filesystem, causing the error.

We modified the Emsdk installation to install on the WSL filesystem, and the error was gone.

Here is the ninja build log showing the error: Complete (1).log

jeromelaban commented 4 years ago

Thanks for the explanation. I've never seen such errors, and in theory, there should not be any locking there from the windows side. I'm wondering if it's related to a duplicate build or something similar.

Would you have a sample project that would reproduce it ?

In any case, there's the WASMSHELL_EMSDK environment variable that could support unix paths (and be left as-is) so that it would be possible to keep it somewhere in the WSL filesystem.

davilovick commented 4 years ago

Here is a sample project that that reproduce the Permission Denied issue: TestUnoPlatform.zip

Here you can find two things:

PD: I've observed that Uno.Wasm.Bootstrap always try to perform a translation of WASMHELL_EMSDK to Unix path using the wslpath 'path' command, even if WASMHELL_EMSDK contains a Unix path. So, for example, if WASMHELL_EMSDK value is /home/davilovick, internally it's translates to/mnt/c/home/davilovick, pointing to a Windows folder.

Thanks-

EDIT: The permission denied issue appears only with latest versions of Emsdk (at least 1.39.18). Using the current supported version in Uno.Wasm.Bootstrap (1.39.11), the issue cannot be reproduced.

jeromelaban commented 4 years ago

There's been progress on this front, and https://github.com/unoplatform/Uno.Wasm.Bootstrap/pull/249 is almost ready to merge. There's one issue in mono that breaks the build when P/Invoke callbacks are used (https://github.com/mono/mono/issues/20120).

The rest of the issues, w.r.t access denied is fixed by moving emscripten to the WSL filesystem, as you've discovered. Thanks for the troubleshooting :)