1.1 Building ECL

Due to its portable nature, ECL works on every (at least) 32-bit architecture which provides a proper C99 compliant compiler.

Operating systems on which ECL is reported to work: Linux, Darwin (Mac OS X), Solaris, FreeBSD, NetBSD, OpenBSD, DragonFly BSD, Windows and Android. On each of them ECL supports native threads.

In the past Juanjo José García-Ripoll maintained a test farm which performed ECL tests for each release on number of platforms and architectures. Due to lack of the resources we can’t afford such doing, however each release is tested by volunteers with an excellent package cl-test-grid created and maintained by Anton Vodonosov.

1.1.1 Autoconf based configuration

ECL, like many other FOSS programs, can be built and installed with a GNU tool called Autoconf. This is a set of automatically generated scripts that detect the features of your machine, such as the compiler type, existing libraries, desired installation path, and configures ECL accordingly. The following procedure describes how to build ECL using this procedure and it applies to all platforms except for the Windows ports using Microsoft Visual Studio compilers (however you may build ECL with cygwin or mingw using the autoconf as described here).

To build Embeddable Common Lisp you need to

  1. Extract the source code and enter it’s directory
    $ tar -xf ecl-xx.x.x.tgz
    $ cd ecl-xx.x.x
    
  2. Run the configuration file, build the program and install it
    $ ./configure --prefix=/usr/local
    $ make                          # -jX if you have X cores
    $ make install
    
  3. Make sure the program is installed and ready to run:
    $ /usr/local/bin/ecl
    
    ECL (Embeddable Common-Lisp) 16.0.0
    Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
    Copyright (C) 1993 Giuseppe Attardi
    Copyright (C) 2000 Juan J. Garcia-Ripoll
    Copyright (C) 2015 Daniel Kochmanski
    ECL is free software, and you are welcome to redistribute it
    under certain conditions; see file 'Copyright' for details.
    Type :h for Help.
    Top level in: #<process TOP-LEVEL>.
    > 
    

1.1.2 Platform specific instructions

1.1.2.1 Android

Cross compiling ECL for Android requires first configuring the cross compilation toolchain. This requires the Android NDK version 22 or higher.

export NDK_PATH=/opt/android-ndk
export ANDROID_API=23
export TOOLCHAIN_PATH=${NDK_PATH}/toolchains/llvm/prebuilt/linux-x86_64 # use darwin instead of linux if compiling on Mac OS host
export TARGET=armv7a-linux-androideabi

Here, ANDROID_API is the minimum Android API version ECL will run on. Moreover, an existing installation ECL is required. This installation has to be the same version as the one you are attempting to build. Assuming you have installed in "/usr/local":

export ECL_TO_RUN=/usr/local/bin/ecl

Finally, we can build and install the target ECL:

export CC="${TOOLCHAIN_PATH}/bin/clang --target=${TARGET}${ANDROID_API}"
export LD=${TOOLCHAIN_PATH}/bin/ld
export AR=${TOOLCHAIN_PATH}/bin/llvm-ar
export RANLIB=${TOOLCHAIN_PATH}/bin/llvm-ranlib
export ECL_TO_RUN=/usr/local/bin/ecl
./configure --host=${TARGET} \
            --prefix=`pwd`/ecl-android \
            --disable-c99complex \
            --with-cross-config=`pwd`/src/util/android-arm.cross_config
make -j9
make install

Library and assets are installed in the "ecl-android" directory and are ready to run on the Android system.

1.1.2.2 iOS

The cross-compilation steps for iOS are similar to those for Android.

export ECL_TO_RUN=/usr/local/bin/ecl

Configure the toolchain:

export IOS_VERSION_MIN="8.0"
export IOS_SDK_DIR="`xcode-select --print-path`/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/"

export CC="clang"
export CXX="clang++"

export CFLAGS="-arch arm64 -miphoneos-version-min=${IOS_VERSION_MIN} -isysroot ${IOS_SDK_DIR}"
export CFLAGS="$CFLAGS -pipe -Wno-trigraphs -Wreturn-type -Wunused-variable"
export CFLAGS="$CFLAGS -fpascal-strings -fasm-blocks -fmessage-length=0 -fvisibility=hidden"
export CFLAGS="$CFLAGS -O2 -DNO_ASM"

export LD="ld"
export LDFLAGS="-arch arm64 -pipe -std=c99 -gdwarf-2 -isysroot ${IOS_SDK_DIR}"
export LIBS="-framework Foundation"

Build and install the target library:

export CFLAGS="$CFLAGS -DGC_DISABLE_INCREMENTAL -DECL_RWLOCK"
export CXXFLAGS="$CFLAGS"
./configure --host=aarch64-apple-darwin \
            --prefix=`pwd`/ecl-iOS \
            --disable-c99complex \
            --disable-shared \
            --with-cross-config=`pwd`/src/util/iOS-arm64.cross_config
make -j9
make install

Library and assets in the "ecl-iOS" directory are ready to run on the iOS system.