emscripten-core / emscripten

Emscripten: An LLVM-to-WebAssembly Compiler
Other
25.84k stars 3.31k forks source link

-lproxyfs.js doesn't include PROXYFS #12351

Closed vadimkantorov closed 4 years ago

vadimkantorov commented 4 years ago

I'd like to use PROXYFS within a WebWorker to skip re-init of file system and data package reloading.

Specifying -lproxyfs.js doesn't lead FS.filesystems to have PROXYFS OTOH, specifying -lworkerfs.js does work, and indeed FS.filesystems has WORKERFS now

Specifying -s EXPORTED_RUNTIME_METHODS=["PROXYFS"] leads to ReferenceError at Module["PROXYFS"]=PROXYFS; at module initialization time

I'm not sure how https://github.com/emscripten-core/emscripten/blob/d021a984b8909b78b1cdd653c0fb302383a31306/tests/test_other.py#L2527 passes, I don't have any traces of PROXYFS when I use -lproxyfs.js. Do I need to specify some extra arguments in my compilation command?

sbc100 commented 4 years ago

I does look like maybe proxyfs is missing here: https://github.com/emscripten-core/emscripten/blob/d021a984b8909b78b1cdd653c0fb302383a31306/src/library_fs.js#L1467

Perhaps there is a reason for this? @kripken @juj ?

vadimkantorov commented 4 years ago

It's not added to Module.PROXYFS either. Seems even local PROXYFS object is not created, and hence it's not available anywhere

vadimkantorov commented 4 years ago

Is this test enabled?

sbc100 commented 4 years ago

The test does currently pass due to other flags that is uses. However I have a fix not that cleans that up and make it work as expected.

vadimkantorov commented 4 years ago

Cool. BTW, what other flags do make it work at the moment?

vadimkantorov commented 4 years ago

Oh, I see: Remove EXPORT_ALL and MAIN_MODULE from test_proxyfs in favor of being more precise in what we want to export. :0

vadimkantorov commented 4 years ago

After this PR, it will appear on FS.filesystems, right?

sbc100 commented 4 years ago

Yes, please don't copy the MAIN_MODULE + EXPORT_ALL hack.. that seems like missive overkill and misuse of MAIN_MODULE to boot.

sbc100 commented 4 years ago

After this PR, it will appear on FS.filesystems, right?

Yes

vadimkantorov commented 4 years ago

What is emscripten's process for CI? When is this commit landing in tip-of-tree? Is it nightly builds?

sbc100 commented 4 years ago

We build releases continuously here: https://ci.chromium.org/p/emscripten-releases

You can install the latest release using ./emsdk update-tags && ./emdk install tot

vadimkantorov commented 4 years ago

@sbc100 Is there a way to enable tracing of FS calls?

After enabling proxying, I started to get DVI: Invalid argument:

xdvipdfmx | stderr: example.xdv -> example.pdf
xdvipdfmx | stderr: /bin/busytex: DVI: Invalid argument

This must be related to proxied file access.

E.g. I noticed that FS.lookupPath('/some/directory').node.contents breaks or returns null for proxied directory.

vadimkantorov commented 4 years ago

E.g. xdvidpfmx does absolute file seek. Is it supported by PROXYFS?

vadimkantorov commented 4 years ago

I think I identified the problem with PROXYFS+seek and created an issue: https://github.com/emscripten-core/emscripten/issues/12367

Otherwise, does emscripten support piping input to stdout? This would force dvipdfmx into not doing seek.

Can I reset stdin (with FS.init?) without reseting stdout/stderr? Could I just create /dev/stdin as a normal file?