LetMinnow
LetMinnow
LTLeaning Technologies
Created by LetMinnow on 7/11/2023 in #support
File System Emulation
I'm trying to get a file system emulation POC going. https://docs.leaningtech.com/cheerp/Filesystem-emulation The core of my new code for this is as simple as that doc page:
[[cheerp::genericjs]]
void preloadCallback()
{
// Files are ready
//Window *fd = open("assets/tstcweb.scr");
client::console.log("Hello, files loaded.");
//client::console.log(fd);
}

cheerp::FilePreloader files(preloadCallback, "tstcweb.scr");
[[cheerp::genericjs]]
void preloadCallback()
{
// Files are ready
//Window *fd = open("assets/tstcweb.scr");
client::console.log("Hello, files loaded.");
//client::console.log(fd);
}

cheerp::FilePreloader files(preloadCallback, "tstcweb.scr");
I get this in the browser js console:
Uncaught (in promise) Error: this should be unreachable

__dummy http://localhost:8000/xlink_cheerp_wasm.js:271

__start http://localhost:8000/xlink_cheerp_wasm.js:251

promise http://localhost:8000/xlink_cheerp_wasm.js:331

promise callback* http://localhost:8000/xlink_cheerp_wasm.js:302
Uncaught (in promise) Error: this should be unreachable

__dummy http://localhost:8000/xlink_cheerp_wasm.js:271

__start http://localhost:8000/xlink_cheerp_wasm.js:251

promise http://localhost:8000/xlink_cheerp_wasm.js:331

promise callback* http://localhost:8000/xlink_cheerp_wasm.js:302
I'm not sure exactly which version of cheerp I have. It's a windows installer support gave me that includes file system emulation. The `tstcweb.scr' is a plain text file I have at the root of my cheerp project, though I also tried putting it in an assets subfolder. Note that the open() call is commented out -- it's not making it that far. Is there something that needs to be done to include such files in the package given to the browser?
33 replies
LTLeaning Technologies
Created by LetMinnow on 6/19/2023 in #support
Segmentation fault in linking
@ap87no Like someone else in the help-archive, I'm getting a segmentation fault when I try to link the files I've compiled, which are mostly .c, and only one .cpp file which calls into all the .c code. clang-16: error: unable to execute command: Segmentation fault clang-16: error: optimizer command failed due to signal (use -v to see invocation) I've been able to fix this a couple of times as I slowly add in more code, but I am now blocked. Through trial and error, I've found if I comment out a particular function call, it succeeds. But if I call that function from file2.c, I get the seg. fault. Meanwhile, that function is called from file1.c and links just fine. If I give you a copy of the .bc files and the command to link them into the final wasm, is that enough for you to diagnose the problem? Or would you need the source code too? I'm sure the source code would help, but I'd need to obfuscate it so I don't give away my company's code.
10 replies