Open Enfis opened 4 years ago
Sounds like a duplicate of #12295
Sounds like a duplicate of #12295
I was using version 2.0.1, now switched to latest 2.0.4 : both give the same problem 😥
Yes, looks like a duplicate of #12295. Hopefully its already been fixed in #12273. You you try emsdk update-tags && emsdk install tot
?
Maybe lets close this in as duplicate?
AFAIK, only the versions 2.0.3 and 2.0.4 are affected of the bug mentioned in #12295. I'm not sure if 2.0.1 also has this issue.
@Enfis Could you try removing the -s WASM_BIGINT
linker flag? Perhaps the combination of Asyncify + WASM_BIGINT causes this issue.
AFAIK, only the versions 2.0.3 and 2.0.4 are affected of the bug mentioned in #12295. I'm not sure if 2.0.1 also has this issue.
@Enfis Could you try removing the
-s WASM_BIGINT
linker flag? Perhaps the combination of Asyncify + WASM_BIGINT causes this issue.
Removed the -s WASMBIGINT and still no luck 😣 Cpp code works just fine, because some milliseconds after the evil ptr: 0_ message returned, in console log I got:
NewDecompressor = 5305040
So a new instance of IDecompress has been allocated correctly with its pointer returned. The problem is on JavaScript side ... NewDecompressor() returns immediately with NULL when invoked.
Anyhow, installed the tot upstream and it doesn't fix:
git pull
emsdk update-tags
emsdk install tot
emsdk activate tot
emsdk_env
And on first compilation:
shared:INFO: (Emscripten: config changed, clearing cache)
shared:INFO: (Emscripten: Running sanity checks)
cache:INFO: generating system library: libc.a... (this will be cached in "E:\emsdk\upstream\emscripten\cache\wasm\libc.a" for subsequent builds)
cache:INFO: - ok
cache:INFO: generating system library: libcompiler_rt.a... (this will be cached in "E:\emsdk\upstream\emscripten\cache\wasm\libcompiler_rt.a" for subsequent builds)
cache:INFO: - ok
cache:INFO: generating system library: libc++-noexcept.a... (this will be cached in "E:\emsdk\upstream\emscripten\cache\wasm\libc++-noexcept.a" for subsequent builds)
cache:INFO: - ok
cache:INFO: generating system library: libc++abi-noexcept.a... (this will be cached in "E:\emsdk\upstream\emscripten\cache\wasm\libc++abi-noexcept.a" for subsequent builds)
cache:INFO: - ok
cache:INFO: generating system library: libdlmalloc.a... (this will be cached in "E:\emsdk\upstream\emscripten\cache\wasm\libdlmalloc.a" for subsequent builds)
cache:INFO: - ok
cache:INFO: generating system library: libpthread_stub.a... (this will be cached in "E:\emsdk\upstream\emscripten\cache\wasm\libpthread_stub.a" for subsequent builds)
cache:INFO: - ok
cache:INFO: generating system library: libc_rt_wasm.a... (this will be cached in "E:\emsdk\upstream\emscripten\cache\wasm\libc_rt_wasm.a" for subsequent builds)
cache:INFO: - ok
cache:INFO: generating system library: libsockets.a... (this will be cached in "E:\emsdk\upstream\emscripten\cache\wasm\libsockets.a" for subsequent builds)
cache:INFO: - ok
cache:INFO: generating system asset: generated_struct_info.json... (this will be cached in "E:\emsdk\upstream\emscripten\cache\wasm\generated_struct_info.json" for subsequent builds)
cache:INFO: - ok
Can you confirm that it was indeed #12150 that broke you? e.g. checkout emscripten from git and sync to the revision right before this and see if that fixes your issue? Then confirm that sync to this revision breaks you?
Can you confirm that it was indeed #12150 that broke you? e.g. checkout emscripten from git and sync to the revision right before this and see if that fixes your issue? Then confirm that sync to this revision breaks you?
Tested with 2.0.2, 2.0.1, 2.0.4 (latest) and tot : none works 🙄 (and fix #12150 is only 12 days old)
I've tried everything: removing WASM_BIGINT, removing almost all function parameters, oversimplifying WebIDL file, now there's only 1 Asyncify function and has been reduced to this one:
EM_JS (void, read_file_chunk, (),
{
Asyncify.handleSleep (function (wakeUp)
{
setTimeout (wakeUp, 500);
});
});
And it is used by this C++ method:
int CppIO::Read (void * pBuffer, unsigned int nBytesToRead, unsigned int * pBytesRead)
{
//
// Uncommenting this line will break the program:
//
// read_file_chunk ();
//
*pBytesRead = fread (pBuffer, 1, nBytesToRead, handle);
return 0;
}
When "_read_filechunk" is called, the program breaks, commenting read_file_chunk(), as above, and everything works perfectly as it should!!!
Ah so this must be different issue then.
@Enfis, did you ever have this working? (under what emsdk version?)
Ah so this must be different issue then.
@Enfis, did you ever have this working? (under what emsdk version?)
It never worked (using Asyncify)
This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant.
Hello, I have some problems with Asyncify, let's go straight to the code:
In Bindings.h:
In Bindings.cpp:
In Bindings.idl:
In index.html/Bindings.js:
CreateDecompressor function strongly uses CppIO class. Inside CppIO class, all the reads are made via Asyncify.handleSleep(). CreateDecompressor works fine, calls are made synchronously the problems is JavaScript that doesn't "wait until" CreateDecompressor() is returned.
Compiled with:
What I'm doing wrong? Thank you (I'm an enscripten newbyte, please have mercy on me 😅)
PS - "read_file_chunk" is the Asyncify function, the project doesn't work (js code invoked from index.html returns immediately) even with the simplest form: