Attempting to build a small janet program for the web with emscripten #1090
-
I'm trying to build a simple program for the web. Given that I started with a simple janet.c
Running
Ok, so use the
Looks like I need to link to a library so I can get those symbols? And, nm reports this symbol exists.
So, add libjanet.so?
That looks weird, try to find that meson export...
Nothing. I don't know what to do now. Any suggestions? By the way:
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
On OSX:
|
Beta Was this translation helpful? Give feedback.
-
It seems like you're trying to get emscripten to link against your system libjanet, which was compiled for your native architecture and not for webassembly. I think you have to first recompile Janet itself with |
Beta Was this translation helpful? Give feedback.
-
Well, I tried the simple case (copying
|
Beta Was this translation helpful? Give feedback.
-
Yes! Upgrading emcc worked. Thanks so much for all your attention on this. |
Beta Was this translation helpful? Give feedback.
Yeah, that's... not a friendly place to start.
I think the only thing you need to do differently is to download the
.c
and.h
files from here: https://github.com/janet-lang/janet/releases/tag/v1.27.0, and put them in a directory calledjanet
. Then run:There's a little more to it afterwards because you need to then import and run the generated wasm from JavaScript, but that's not really Janet-specific.
This might actually be a better place to start:
That's how the repl on https://janet-lang.org is …