[nim-dev] Compile simple Hello NIM program for android with the NDK

  • From: Stagiros <goudaroi@xxxxxxxxx>
  • To: nim-dev@xxxxxxxxxxxxx
  • Date: Fri, 11 Dec 2015 22:54:14 +0000

Hello to all members of the forum.

I have just joined the NIM community and I need some help compiling a simple
Hello program for Android with the NDK.

Here is the background to my problem:
A. I am running Manjaro Linux x86_64 with Openbox

B. I have instaled NDK in
/home/jimmy/Programs/android-ndk-r10e

C. I have installed a standalone NDK toolchain for arm64 in
/home/jimmy/Programs/android-toolchain-arm6

D. I have put in my .bashrc
PATH=/home/jimmy/Programs/android-toolchain-arm64/bin:"$PATH"

SYSROOT=/home/jimmy/Programs/android-ndk-r10e/platforms/android-21/arch-arm64/sysroot

E. In a Hello folder I have created these two nim files
Hello.cfg which contains the lines
arm64.linux.gcc.path =
"/home/jimmy/Programs/android-toolchain-arm64/aarch64-linux-android/bin"
arm64.linux.gcc.exe = "aarch64-linux-android-gcc"
arm64.linux.gcc.linkerexe = "aarch64-linux-android-gcc"

Hello.nim which contains the line
echo "Hello world"

F. I compile from inside the Hello folderwith the command
nim c --cpu:arm64 --os:linux --parallelBuild:1
--passC:--sysroot="$SYSROOT" --passL:--sysroot="$SYSROOT" Hello.nim
and I get the following error

Hint: system [Processing]
Hint: Hello [Processing]
In file included from
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include-fixed/syslimits.h:7:0,
from
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include-fixed/limits.h:34,
from /usr/lib/nim/nimbase.h:183,
from /home/jimmy/Developments/Nim/Hello/nimcache/Hello.c:9:
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include-fixed/limits.h:168:61:
error: no include path in which to search for limits.h
/home/jimmy/Developments/Nim/Hello/nimcache/Hello.c:10:19: fatal error:
stdio.h: No such file or directory
compilation terminated.
Error: execution of an external program failed: 'gcc -c -w
--sysroot=/home/jimmy/Programs/android-ndk-r10e/platforms/android-21/arch-arm64/sysroot
-I/usr/lib/nim -o /home/jimmy/Developments/Nim/Hello/nimcache/Hello.o
/home/jimmy/Developments/Nim/Hello/nimcache/Hello.c'


Other related posts: