LetMinnow
LTLeaning Technologies
•Created by LetMinnow on 7/11/2023 in #support
File System Emulation
First off, a big thank you for all your help in getting this going for me. (Just a quick note for posterity: file reading has to use 'readv()', not 'read()').
Next item: we have extensive debug/trace capability which I have currently adapted to send its output to the js console with 'printf()'. Normally, it just goes to a file descriptor. From the js console we can save to a file if needed -- and doing so will be needed so we can share the sometimes very large output with other and more easily search it, etc. Is there any way cheerp can facilitate saving this output more directly to a file? I understand browsers not allowing write access in general, but they do allow one to download a file to the downloads folder (or elsewhere). If we could get a file descriptor for that, or have a char buffer, or...?
33 replies
LTLeaning Technologies
•Created by LetMinnow on 7/11/2023 in #support
File System Emulation
Is there an include or namespace needed to help the compiler find the posix open()?
33 replies
LTLeaning Technologies
•Created by LetMinnow on 7/11/2023 in #support
File System Emulation
Ok, I made the wasm function into a wrapper that calls a genericjs function and that worked. The open() function results in the file getting downloaded into the browser's downloads folder, which is not what I expected. Where do I find more documentation about the open/read/close? Ultimately, I just need to read the contents of the file for the rest of the code to use. I tried looking for the mentioned
libposixcompat
library or documentation on it, but I can't find anything.33 replies
LTLeaning Technologies
•Created by LetMinnow on 7/11/2023 in #support
File System Emulation
I threw that
genericjs
in trying to get compile error to resolve. Using wasm
gives me the below errors (which seems to be the default because I get the same errors without any attribute at all).
The example on the page has int fd = open()
but then it complains it's not Window *
. Then using Window *
gives me:
xlink_cheerp_cpp.cpp:38:13: error: Cheerp: Type 'Window *' of local variable 'fd' is incompatible with attribute 'wasm' of function 'preloadCallback'
Window *fd = open("tstcweb.scr");
^
xlink_cheerp_cpp.cpp:38:23: error: Cheerp: Attribute 'genericjs' of constructor 'String' is incompatible with attribute 'wasm' of caller function 'preloadCallback'
Window *fd = open("tstcweb.scr");
^
xlink_cheerp_cpp.cpp:38:36: error: Cheerp: Attribute 'genericjs' of function parameter 'url' is incompatible with attribute 'wasm' of caller 'preloadCallback'
Window *fd = open("tstcweb.scr");
^
xlink_cheerp_cpp.cpp:38:36: error: Cheerp: Attribute 'genericjs' of function return 'open' is incompatible with attribute 'wasm' of caller 'preloadCallback'
33 replies
LTLeaning Technologies
•Created by LetMinnow on 7/11/2023 in #support
File System Emulation
Please see your DMs for the compiled code.
33 replies
LTLeaning Technologies
•Created by LetMinnow on 7/11/2023 in #support
File System Emulation
no error message in the console. no failures in the network tab -- it found my
tstcweb.scr
file ok.33 replies
LTLeaning Technologies
•Created by LetMinnow on 7/11/2023 in #support
File System Emulation
Ok, added
-lposixcompat
to the command line, now I get this:
Uncaught Error: Cheerp: Signal raised
__ZN12_GLOBAL__N_111raiseSignalEv http://localhost:8000/xlink_cheerp_wasm.js:159
__ZN6cheerp13FilePreloader14finishDownloadEii ...wasm.js:339
__ZN6cheerp12InvokeHelperIvE6invokeINS_13FilePreloader16DownloadCallbackEJEEEvPT_DpT0_ ...wasm.js:287
cheerpCreateClosure ...wasm.js:352
__ZN6cheerp13FilePreloader8downloadEv ...wasm.js:277
__start ...wasm.js:342
promise ...wasm.js:437
promise callback* ...wasm.js:402
xlink_cheerp_wasm.js:159:8
__ZN12_GLOBAL__N_111raiseSignalEv ...wasm.js:159
abort ...wasm.js line 393 > WebAssembly.instantiate:14566
_ZSt25__throw_bad_function_callB7v160000v_icf ...wasm.js line 393 > WebAssembly.instantiate:10582
_ZN6cheerp13FilePreloader10commitFileERNS0_11PendingFileE ...wasm.js line 393 > WebAssembly.instantiate:22329
__ZN6cheerp13FilePreloader14finishDownloadEii ...wasm.js:339
_ZN6cheerp13FilePreloader16DownloadCallbackclEv ...wasm.js line 393 > WebAssembly.instantiate:23438
__ZN6cheerp12InvokeHelperIvE6invokeINS_13FilePreloader16DownloadCallbackEJEEEvPT_DpT0_ ...wasm.js:287
cheerpCreateClosure ...wasm.js:352
(Async: EventHandlerNonNull) __ZN6cheerp13FilePreloader8downloadEv ...wasm.js:277
_ZN6cheerp13FilePreloaderC2IJPKcEEEOKSt8functionIFvvEEDpT_ ...wasm.js line 393 > WebAssembly.instantiate:34018
__cxx_global_var_init ...wasm.js line 393 > WebAssembly.instantiate:34086
__start ...wasm.js:342
promise ...wasm.js:437
(Async: promise callback) <anonymous> ...wasm.js:402
33 replies
LTLeaning Technologies
•Created by LetMinnow on 7/11/2023 in #support
File System Emulation
I had commented out the
-cheerp-strict-linking=warning
that I had there before. Restoring that gives me
c:\cheerp\bin\clang++ -target cheerp-wasm obj/arg.bc ...<several more files> ... obj/xlink_cheerp_cpp.bc -o xlink_cheerp_wasm.js -cheerp-linear-heap-size=128 -cheerp-pretty-code -cheerp-strict-linking=warning
That gives me warning: symbol not defined _ZN6cheerp13FilePreloader8downloadEv
Commenting out the code from my first post (void preloadCallback()... files(preloadCallback,...
) results in a successful compile/run33 replies
LTLeaning Technologies
•Created by LetMinnow on 6/19/2023 in #support
Segmentation fault in linking
Thank you! I think the strict linking param will help. That gives me several others in addition to Ctype
10 replies
LTLeaning Technologies
•Created by LetMinnow on 6/19/2023 in #support
Segmentation fault in linking
@ap87no see your DMs for the .bc and build.sh files
10 replies
LTLeaning Technologies
•Created by LetMinnow on 6/19/2023 in #support
Segmentation fault in linking
Here is everything I get back including the stacktrace:
10 replies