Trying to emcc the generated c file, got:
./nimbase.h:382:28: error: 'assert_numbits' declared as an array with a negative size"
typedef int assert_numbits[sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(NI)*8 ? 1 : -1];
See in nimbase.h comment that it is because nimrod and the C compiler disagree on the size of a pointer.
So how would I go about fixing this?
(on, osx Mavericks)
Just tried --cpu:i386 option during nimrod compile, it just generates the same error in the nimrod compilation instead.
FYI, I am using the JS backend, but wanted to see how big of a difference the emscripten code performs vs. the nimrod version.
Edit: Not a big deal if you don't think emscripten can handle nimrod's GC anyways.
Just tried --cpu:i386 option during nimrod compile, it just generates the same error in the nimrod compilation instead.
Well you don't have to bootstrap with this switch if that's what you mean by "in the nimrod compilation".
Edit: Not a big deal if you don't think emscripten can handle nimrod's GC anyways.
Well it surely is an interesting experiment. :-)
Your "don't have to bootstrap with this switch" makes me think I may be doing something wrong. Anyways, here's what I have:
my hello.nim is just: echo("hello")
I did: nimrod c --cpu:i386 --os:linux --compile_only hello.nim
emcc hello.c (in nimcache, after copying Nimrod/lib/nimbase.h in nimcache) gives:
warning: unresolved symbol: setStackBottom
warning: unresolved symbol: systemDatInit
warning: unresolved symbol: systemInit
warning: unresolved symbol: frameptr_14842
warning: unresolved symbol: nim_program_result
node a.out.js gives:
missing function: systemDatInit
-1
-1
/Users/john/dev/asmjs/nimcache/a.out.js:5973
throw e;
^
abort() at Error
at stackTrace (/Users/john/dev/asmjs/nimcache/a.out.js:1050:15)
at abort (/Users/john/dev/asmjs/nimcache/a.out.js:6063:25)
at _systemDatInit (/Users/john/dev/asmjs/nimcache/a.out.js:5488:58)
at _PreMain (/Users/john/dev/asmjs/nimcache/a.out.js:5703:2)
at _NimMain (/Users/john/dev/asmjs/nimcache/a.out.js:5728:2)
at Object._main (/Users/john/dev/asmjs/nimcache/a.out.js:5773:2)
at Object.callMain (/Users/john/dev/asmjs/nimcache/a.out.js:5954:30)
at doRun (/Users/john/dev/asmjs/nimcache/a.out.js:6011:25)
at run (/Users/john/dev/asmjs/nimcache/a.out.js:6026:5)
at Object.<anonymous> (/Users/john/dev/asmjs/nimcache/a.out.js:6083:1)
Please let me know if I'm doing anything wrong.