Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

questions #2

Closed
timotheecour opened this issue Nov 3, 2018 · 3 comments
Closed

questions #2

timotheecour opened this issue Nov 3, 2018 · 3 comments

Comments

@timotheecour
Copy link

  • in https://www.spiria.com/en/blog/web-applications/webassembly-nim what worked for me was
    (for eg) python -m SimpleHTTPServer 9009 && open http://localhost:9009/hello.html instead of open hello.html ( as seems to be suggested in and open it in your browser.)

  • on OSX, with C++, I can run emscripten locally and run a wasm hello world demo without having to use vagrant and ssh to a VM; is there a fundamental reason why we need vagrant for nim ?

@Feneric
Copy link
Owner

Feneric commented Nov 3, 2018

"open it in your browser" wasn't intended to be a literal shell command. The way I tend to do it personally is by typing the URL in my browser's location field.

Not if 1) you already have an environment that's most of the way there, 2) you don't mind changing it, and 3) only don't have any problems on any other machines you use. Different environments can be more or less easy to prepare, and lots of people don't like globally installing things that change their environments. The Vagrant approach keeps the dev environment isolated and exactly replicates it on every work machine, so regardless of whether you're using a Mac desktop, a Linux laptop, or an MS-Win tablet you get something that works the same and is trivial to remove.

@timotheecour
Copy link
Author

thanks!
so the only remaining question is how to setup local environment (eg on OSX) to be able to run the demo; feel free to close (or leave it open if you'd like to follow up at some point here)
I guess the best way would be to port the instructions here https://github.com/Feneric/nim-wasm-helpers/blob/master/Vagrantfile to OSX

@timotheecour
Copy link
Author

ok, all I had to do was add this:

nim.cfg

cc = clang
clang.exe = "emcc"
clang.linkerexe = "emcc"
clang.options.linker = ""
cpu = "i386"
passC = "-s WASM=1 -s 'BINARYEN_METHOD=\"native-wasm\"' -Iemscripten"
passL = "-s WASM=1 -Lemscripten -s TOTAL_MEMORY=335544320"

in Samples/

and then nim c -f -d:emscripten -o:hello.html hello.nim worked!

this fixes #1 as well as this issue (for me...) ; and maybe even #3 /cc @AchalaSB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants