My Beagle Bone Black (BBB) has just arrived YEY, and now I am trying to cross compile some hello world application.
1st I tried to cross compile directly on the host machine: config file:
cpu:arm
os:linux
#compile_only
#gen_script
## setup compiler
arm.linux.gcc.path = "/usr/bin/"
arm.linux.gcc.exe = "arm-linux-gnu-gcc"
arm.linux.gcc.linkerexe = "arm-linux-gnu-gcc"
and the output of nim c --parallelBuild:1 BBBtest.nim
config/nim.cfg(45, 2) Hint: added path: '/home/xyz/.babel/pkgs/' [Path]
config/nim.cfg(46, 2) Hint: added path: '/home/xyz/.nimble/pkgs/' [Path]
Hint: used config file '/media/data/xyz/programare/nim/compiler/Nim/config/nim.cfg' [Conf]
Hint: used config file '/home/xyz/projects/BBBtest/nim.cfg' [Conf]
Hint: used config file '/home/xyz/projects/BBBtest/src/BBBtest.nim.cfg' [Conf]
Hint: system [Processing]
Hint: BBBtest [Processing]
/home/xyz/projects/BBBtest/src/nimcache/BBBtest_BBBtest.c:10:19: fatal error: stdio.h: No such file or directory
#include <stdio.h>
^
compilation terminated.
/home/xyz/projects/BBBtest/src/nimcache/stdlib_system.c:10:20: fatal error: setjmp.h: No such file or directory
#include <setjmp.h>
^
compilation terminated.
Error: execution of an external program failed
Looks like I do not have the libc for the arm architecture so... I tried method 2 "--compile_only --gen_script" got the bash script and c files and moved them to the BBB and executed the script there, and now:
./compile_BBBtest.sh
BBBtest_BBBtest.c:5:21: fatal error: nimbase.h: No such file or directory
compilation terminated.
stdlib_system.c:5:21: fatal error: nimbase.h: No such file or directory
compilation terminated.
gcc: error: stdlib_system.o: No such file or directory
gcc: error: BBBtest_BBBtest.o: No such file or directory
Anyone has any hints on cross compiling nim?
Thanks.
Yes, that works, although it might be a good idea for the compiler to copy that file as well into the cache folder?
And now I have to see how I can automate this process.
Yes, that's a reported bug: https://github.com/Araq/Nim/issues/803 and https://github.com/Araq/Nim/issues/1992
One way to automate would be genScript or niminst: http://hookrace.net/blog/what-makes-nim-practical/#source-distribution