Nim cross compilation to C -
i wrote nim program,
echo("hello.") and tried cross compile linux machine,
nim c --cpu:i386 --os:linux -c hello.nim this produced following output:
config/nim.cfg(45, 2) hint: added path: '/users/connor/.babel/pkgs/' [path] config/nim.cfg(46, 2) hint: added path: '/users/connor/.nimble/pkgs/' [path] hint: used config file '/usr/local/lib/nim-0.10.2/config/nim.cfg' [conf] hint: system [processing] hint: hello [processing] hint: operation successful (8753 lines compiled; 0.140 sec total; 14.148mb)[successx] at point changed nimcache/ directory , tried execute:
gcc hello.c -o hello.o but gave me error:
hello.c:5:10: fatal error: 'nimbase.h' file not found #include "nimbase.h" ^ 1 error generated. i thought, "no biggie, i'll find nimbase.h , drop in nimcache directory there," after got new error,
in file included hello.c:5: ./nimbase.h:385:28: error: 'assert_numbits' declared array negative size ...sizeof(ni) == sizeof(void*) && nim_intbits == sizeof(ni)*8 ? 1 : -1]; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. i'm not sure i'm supposed that. had tried use --genscript option, resulted in similar errors. i'm running os x yosemite.
thanks!
update:
i wasn't sure how many architectures supported --cpu: option, found (partial?) list on what makes nim practical blog post. ended calling,
nim c --cpu:amd64 --os:linux -c hello.nim this prevented error saw when compiling on linux box. if you're using linux or os x not sure cpu architecture can call,
less /proc/cpuinfo
the last problem because you're running gcc x86_64 arch, while sources generated i386 arch.
Comments
Post a Comment