Greetings, I am a new comer to nim and first time poster. I am trying to cross compile to linux from osx using the following command
$nim c --cpu:i386 --os:linux hello.nim
This is the error i am seeing ------------------------------ start ---------------- Error: execution of an external compiler program 'gcc -c -w -I/Users/skota/.choosenim/toolchains/nim-0.19.4/lib -o /Users/skota/.cache/nim/hello_d/hello.c.o /Users/skota/.cache/nim/hello_d/hello.c' failed with exit code: 1
In file included from /Users/skota/.cache/nim/hello_d/hello.c:10:
1 error generated. --------------- end ---------------------------
uname output from linux target server Linux xxx-xx 3.10.0-957.5.1.el7.x86_64 #1 SMP Tue Jan 29 11:37:46 PST 2019 x86_64 x86_64 x86_64 GNU/Linux
From the error message, it appears i am missing some depenedencies for compilation. Not sure what i could be missing.
Any advice is appreciated.
Regards Skota
Posted on reddit as well.
https://www.reddit.com/r/nim/comments/avtq1u/nim_cross_compile_osx_to_linux_how_to/
You want to cross compile which means you need a cross-compiling toolchain. While Nim can cross-compile, it generates C/C++ which then needs to be further cross-compiled to the target arch.
Is the gcc you are using a 64-bit Linux compiler that runs on OSX?
You might also want to check out https://github.com/dockcross/dockcross if a native OSX to Linux cross-compiler doesn't exist.