[gambit-list] compiling for arm android on linux

Sonny To son.c.to at gmail.com
Tue May 25 15:55:51 EDT 2021


I managed to build gambit for arm but now I have a problem with
compling C code using the android provided tool-chain

export NDK=$ANDROID_SDK_ROOT/ndk-bundle
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64
export TARGET=aarch64-linux-android
export API=30
export AR=$TOOLCHAIN/bin/llvm-ar
export CC=$TOOLCHAIN/bin/$TARGET$API-clang
export AS=$CC
export CXX=$TOOLCHAIN/bin/$TARGET$API-clang++
export LD=$TOOLCHAIN/bin/ld
export RANLIB=$TOOLCHAIN/bin/llvm-ranlib
export STRIP=$TOOLCHAIN/bin/llvm-strip

./configure --prefix=/home/sto/gambit-arm  --build=x86_64 --host=$TARGET

the build-ambit-android.sh as pointed out by Francoi Magan is obsolete
https://developer.android.com/ndk/guides/standalone_toolchain

this is how I tried to compile hello.c

sto at gambit:~/workspace/hello$ clang --target=aarch64-linux-android-30
hello.c hello_.c -I$GAMBIT/include $GAMBIT/lib/libgambit.a
--sysroot=$TOOLCHAIN/llvm/prebuilt/linux-x86_64/sysroot/
In file included from hello.c:40:
/home/sto/gambit/include/gambit.h:866:10: fatal error: 'wchar.h' file
not found
#include <wchar.h>
         ^~~~~~~~~
1 error generated.
In file included from hello_.c:9499:
/home/sto/gambit/include/gambit.h:866:10: fatal error: 'wchar.h' file
not found
#include <wchar.h>
         ^~~~~~~~~
1 error generated.
sto at gambit:~/workspace/hello$

sto at gambit:~/android$ find . -name wchar.h
./ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/wchar.h
./ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/wchar.h
./ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/support/solaris/wchar.h
./ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/local/include/wchar.h
./ndk-bundle/sources/cxx-stl/llvm-libc++/include/wchar.h
./ndk-bundle/sources/cxx-stl/llvm-libc++/include/support/solaris/wchar.h
./ndk-bundle/sources/android/support/include/wchar.h

sto at gambit:~/workspace/hello$ ls
$TOOLCHAIN/sysroot/usr/include/wchar.h
/home/sto/android/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/wchar.h

 clang --target=aarch64-linux-android-30  hello.c hello_.c
-I$GAMBIT/include $GAMBIT/lib/libgambit.a
--sysroot=$TOOLCHAIN/llvm/prebuilt/linux-x86_64/sysroot/
-I$TOOLCHAIN/sysroot/usr/include
In file included from hello.c:40:
/home/sto/gambit/include/gambit.h:866:10: fatal error: 'wchar.h' file
not found
#include <wchar.h>
         ^~~~~~~~~
1 error generated.
In file included from hello_.c:9499:
/home/sto/gambit/include/gambit.h:866:10: fatal error: 'wchar.h' file
not found

I am not sure how to fix this. I've explicitly added
-I$TOOLCHAIN/sysroot/usr/include      which is where wchar.h is
located but its still complaining that it cannot find that file

On Thu, May 13, 2021 at 2:15 AM Francois Magnan <fmagnan at me.com> wrote:
>
> Yes and there a script for that in `misc` folder named `build-ambit-android.sh`. Didn't try it yet,
> Francois
>
> > On May 12, 2021, at 3:11 PM, Jörg F. Wittenberger <Joerg.Wittenberger at softeyes.net> wrote:
> >
> > Am Wed, 12 May 2021 00:23:11 +0700
> > schrieb Sonny To <son.c.to at gmail.com>:
> >
> >> Thanks Alexander! that was helpful.
> > ...
> >> This error probably means I need  to build libgambit.a for ARM.
> >
> > probably yes.
> >
> > _______________________________________________
> > Gambit-list mailing list
> > Gambit-list at iro.umontreal.ca
> > https://mailman.iro.umontreal.ca/cgi-bin/mailman/listinfo/gambit-list
> >
>
>
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://mailman.iro.umontreal.ca/cgi-bin/mailman/listinfo/gambit-list



More information about the Gambit-list mailing list