mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2025-12-06 02:40:26 -08:00
update installation instructions for recent Android NDKs and support ARM64
Works for Android NDKs with unified headers (see https://android.googlesource.com/platform/ndk/+/ndk-release-r16/docs/UnifiedHeaders.md). Separate step of configuring a standalone toolchain is recommended by the Android docs. Explicitely setting CC to clang is useful, since gcc in Android NDK is deprecated and outright broken in NDK version 18. Using the bfd linker is needed for bdwgc to work correctly (see also https://github.com/ivmai/bdwgc/issues/259).
This commit is contained in:
parent
06d6ffe158
commit
6090d9d201
6 changed files with 88 additions and 18 deletions
22
INSTALL
22
INSTALL
|
|
@ -31,23 +31,25 @@ If you do not have access to the online version, follow the following recipies.
|
|||
rm -r build
|
||||
export ECL_TO_RUN=`pwd`/ecl-android-host/bin/ecl
|
||||
#+END_SRC
|
||||
2. Configure the toolchain (requires android-ndk) and export the
|
||||
necessary paths:
|
||||
2. Configure the toolchain (requires android-ndk version 15 or higher, known to work with version 17c)
|
||||
and export the necessary paths:
|
||||
#+BEGIN_SRC shell-script
|
||||
# android-ndk r13b is known to be broken, tested with r9b available at:
|
||||
# http://dl.google.com/android/ndk/android-ndk-r9b-linux-x86_64.tar.bz2
|
||||
# http://dl.google.com/android/ndk/android-ndk-r9b-darwin-x86_64.tar.bz2
|
||||
export NDK_PATH=/opt/android-ndk
|
||||
export SYSROOT=${NDK_PATH}/platforms/android-9/arch-arm
|
||||
export PATH=${NDK_PATH}/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin:$PATH
|
||||
export ANDROID_API=23
|
||||
export TOOLCHAIN_PATH=`pwd`/android-toolchain
|
||||
${NDK_PATH}/build/tools/make_standalone_toolchain.py --arch arm --install-dir ${TOOLCHAIN_PATH} --api ${ANDROID_API}
|
||||
export SYSROOT=${TOOLCHAIN_PATH}/sysroot
|
||||
export PATH=${TOOLCHAIN_PATH}/bin:$PATH
|
||||
#+END_SRC
|
||||
3. Build and install the target library
|
||||
#+BEGIN_SRC shell-script
|
||||
export LDFLAGS="--sysroot=${SYSROOT}"
|
||||
export CPPFLAGS="--sysroot=${SYSROOT}"
|
||||
# boehm GC is not compatible with ld.gold linker, force use of ld.bfd
|
||||
export LDFLAGS="--sysroot=${SYSROOT} -D__ANDROID_API__=${ANDROID_API} -fuse-ld=bfd"
|
||||
export CPPFLAGS="--sysroot=${SYSROOT} -D__ANDROID_API__=${ANDROID_API} -isystem ${SYSROOT}/usr/include/arm-linux-androideabi"
|
||||
export CC=arm-linux-androideabi-clang
|
||||
./configure --host=arm-linux-androideabi \
|
||||
--prefix=`pwd`/ecl-android \
|
||||
--with-cross-config=`pwd`/src/util/android.cross_config
|
||||
--with-cross-config=`pwd`/src/util/android-arm.cross_config
|
||||
make -j9
|
||||
make install
|
||||
#+END_SRC
|
||||
|
|
|
|||
2
src/aclocal.m4
vendored
2
src/aclocal.m4
vendored
|
|
@ -252,7 +252,7 @@ clibs='-lm'
|
|||
SONAME=''
|
||||
SONAME_LDFLAGS=''
|
||||
case "${host_os}" in
|
||||
linux-androideabi)
|
||||
linux-android*)
|
||||
thehost='android'
|
||||
THREAD_CFLAGS='-D_THREAD_SAFE'
|
||||
# THREAD_LIBS='-lpthread'
|
||||
|
|
|
|||
2
src/configure
vendored
2
src/configure
vendored
|
|
@ -4911,7 +4911,7 @@ clibs='-lm'
|
|||
SONAME=''
|
||||
SONAME_LDFLAGS=''
|
||||
case "${host_os}" in
|
||||
linux-androideabi)
|
||||
linux-android*)
|
||||
thehost='android'
|
||||
THREAD_CFLAGS='-D_THREAD_SAFE'
|
||||
# THREAD_LIBS='-lpthread'
|
||||
|
|
|
|||
|
|
@ -101,5 +101,52 @@ and environment variables.
|
|||
@c @node BSD systems
|
||||
@c @subsubsection BSD systems
|
||||
|
||||
@c @node Android
|
||||
@c @subsubsection Android
|
||||
@subsubsection Android
|
||||
|
||||
Cross compiling ECL for Android requires first building the host ECL
|
||||
program. At present this host ECL needs to have the same word size and
|
||||
long double capabilities as the target system. Therefore, to build the
|
||||
host ECL for a 32 bit ARM system, use the following commands:
|
||||
|
||||
@example
|
||||
./configure ABI=32 CFLAGS="-m32 -g -O2" LDFLAGS="-m32 -g -O2"\
|
||||
--prefix=`pwd`/ecl-android-host --disable-longdouble
|
||||
make -j9
|
||||
make install
|
||||
rm -r build
|
||||
export ECL_TO_RUN=`pwd`/ecl-android-host/bin/ecl
|
||||
@end example
|
||||
|
||||
The next step is to configure the cross compilation toolchain. This
|
||||
requires the Android NDK version 15 or higher.
|
||||
|
||||
@example
|
||||
@verbatim
|
||||
export NDK_PATH=/opt/android-ndk
|
||||
export ANDROID_API=23
|
||||
export TOOLCHAIN_PATH=`pwd`/android-toolchain
|
||||
${NDK_PATH}/build/tools/make_standalone_toolchain.py --arch arm --install-dir ${TOOLCHAIN_PATH} --api ${ANDROID_API}
|
||||
export SYSROOT=${TOOLCHAIN_PATH}/sysroot
|
||||
export PATH=${TOOLCHAIN_PATH}/bin:$PATH
|
||||
@end verbatim
|
||||
@end example
|
||||
|
||||
Here, @code{ANDROID_API} is the minimum Android API version ECL will
|
||||
run on. Finally, we can build and install the target ECL:
|
||||
|
||||
@example
|
||||
@verbatim
|
||||
# boehm GC is not compatible with ld.gold linker, force use of ld.bfd
|
||||
export LDFLAGS="--sysroot=${SYSROOT} -D__ANDROID_API__=${ANDROID_API} -fuse-ld=bfd"
|
||||
export CPPFLAGS="--sysroot=${SYSROOT} -D__ANDROID_API__=${ANDROID_API} -isystem ${SYSROOT}/usr/include/arm-linux-androideabi"
|
||||
export CC=arm-linux-androideabi-clang
|
||||
./configure --host=arm-linux-androideabi \
|
||||
--prefix=`pwd`/ecl-android \
|
||||
--with-cross-config=`pwd`/src/util/android-arm.cross_config
|
||||
make -j9
|
||||
make install
|
||||
@end verbatim
|
||||
@end example
|
||||
|
||||
Library and assets are installed in the @code{ecl-android} directory
|
||||
and are ready to run on the Android system.
|
||||
|
|
|
|||
|
|
@ -7,15 +7,15 @@ CL_LONG_BITS=32
|
|||
ECL_STACK_DIR=down
|
||||
ECL_BIGENDIAN=no
|
||||
ECL_NEWLINE=LF
|
||||
ECL_FILE_CNT=2
|
||||
ECL_FILE_CNT=0
|
||||
ECL_STDINT_HEADER="#include <stdint.h>"
|
||||
ECL_UINT8_T=uint8_t
|
||||
ECL_UINT16_T=uint16_t
|
||||
ECL_UINT32_T=uint32_t
|
||||
ECL_UINT64_T=no
|
||||
ECL_UINT64_T=uint64_t
|
||||
ECL_INT8_T=int8_t
|
||||
ECL_INT16_T=int16_t
|
||||
ECL_INT32_T=int32_t
|
||||
ECL_INT64_T=no
|
||||
ECL_LONG_LONG_BITS=no
|
||||
ECL_INT64_T=int64_t
|
||||
ECL_LONG_LONG_BITS=64
|
||||
ECL_WORKING_ENVIRON=yes
|
||||
21
src/util/android-arm64.cross_config
Normal file
21
src/util/android-arm64.cross_config
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
CL_FIXNUM_TYPE=long
|
||||
CL_FIXNUM_BITS=64
|
||||
CL_FIXNUM_MAX=2305843009213693951L
|
||||
CL_FIXNUM_MIN=-2305843009213693952L
|
||||
CL_INT_BITS=32
|
||||
CL_LONG_BITS=64
|
||||
ECL_STACK_DIR=down
|
||||
ECL_BIGENDIAN=no
|
||||
ECL_NEWLINE=LF
|
||||
ECL_FILE_CNT=0
|
||||
ECL_STDINT_HEADER="#include <stdint.h>"
|
||||
ECL_UINT8_T=uint8_t
|
||||
ECL_UINT16_T=uint16_t
|
||||
ECL_UINT32_T=uint32_t
|
||||
ECL_UINT64_T=uint64_t
|
||||
ECL_INT8_T=int8_t
|
||||
ECL_INT16_T=int16_t
|
||||
ECL_INT32_T=int32_t
|
||||
ECL_INT64_T=int64_t
|
||||
ECL_LONG_LONG_BITS=64
|
||||
ECL_WORKING_ENVIRON=yes
|
||||
Loading…
Add table
Add a link
Reference in a new issue