Skip to content
Jonathan Chan edited this page Aug 9, 2018 · 59 revisions

How to build an example

The following is a short outline of how to compile one of the examples (see apps/). If you have some experience in building software then this, and a few minutes, should be enough to build and run one of the examples. If you get stuck with something then continue reading this document.

Step 1: Clone the LambdaNative repository:

git clone https://github.com/part-cw/lambdanative.git 

Step 2: Create (and edit as needed) the files SETUP and PROFILE (see the provided *.template files):

cd lambdanative
cp SETUP.template SETUP
cp PROFILE.template PROFILE

Step 3: Configure an example app:

./configure Calculator
==> configured to build Calculator for macosx in normal mode
 == using source in /somewhere/lambdanative/apps/Calculator

Step 4: Start the build:

make

The first build will take a while, as the supporting libraries are downloaded and compiled for the first time. The build may also stop once a while and complain about missing dependencies. If so, just install what is missing and resume. The final executable will be generated in the LambdaNative cache directory, and can be installed to the desktop and launched with make install.

On a suitably configured platform, you can now do:

./configure DemoHelloWorld android
make

./configure DemoHelloWorld ios
make

and binaries for the specified platforms should be built and packaged. On the Mac, the packages will be placed in ~/Library/Caches/lambdanative/packages/.

Required SDKs

The minimum requirement for developing applications is the presence of a working gcc compiler.

Required tools and libraries

A number of tools are needed to support the framework. Please ensure that these are installed on your system:

Libraries

  • libfreetype for rendering vector fonts
  • OpenGL headers and libraries
  • libasound for sound if developing on/for Linux
  • libportaudio from ports if developing on OpenBSD

Tools

  • wget for pulling library code from the net
  • netpbm and ImageMagick for miscellaneous pixmap manipulation
  • ghostscript and ps2eps for converting vector artwork
  • xelatex (the unicode version of latex) for generating string textures (optional, but recommended)
  • cmake for generating XCode projects (only if developing for iOS)
  • tgif for editing vector artwork (optional)
  • fruitstrap for installing iOS apps (optional)

The following command will install all necessary packages on a clean Ubuntu install:

sudo apt install git autoconf build-essential libtool libgl1-mesa-dev libfreetype6-dev libasound2-dev netpbm imagemagick ghostscript ps2eps texlive-xetex
Note on using OSX to host builds

If using MacPorts, xelatex is available under the package texlive-xetex, and LambdaNative requires the tipa tex package, available from MacPorts under the package texlive-fonts-recommended.

Cross-compilation

Cross-compilation requires installation of the appropriate environments:

Android (macOS or Linux)

  1. Install Java (7 or 8).
  2. Download Android SDK Tools revision 25.2.5 from http://dl-ssl.google.com/android/repository/tools_r25.2.5-xxx.zip, where xxx is either macosx or linux.
  3. Download Android NDK revision 13b from here.
  4. Install the Android SDK and NDK under /usr/local and the API that you want to develop for. You will need the "SDK Tools", not the "ADT Bundle". Once SDK and NDK are installed, you should have an android-sdk-* and android-ndk-* directory. Make sure to set proper permissions on the directories to allow your development account full access.
  5. Run android to install the APIs (minimum supported API is 8 (Android 2.2) without real-time audio, and API 10 (Android 2.3.3) with real-time audio) and the SDK Build Tools (revision 23.0.3).
  6. Run android avd to setup an android virtual device with your desired API.
  7. In the SETUP file, set ANDROIDAPI to the lowest API version you have installed or higher.

iOS (macOS)

  1. Install the iOS SDK. The iOS SDK is part of the Xcode distribution. For XCode versions newer than 4.5 you also need to install the matching "Command Line Tools". These downloads can be found under "Downloads for Apple Developers" in the iOS Dev Center.
  2. Follow the standard online procedures to create an iOS Development Certificate, and, optionally, an iOS Distribution Certificate, and register your device(s) for development.
  3. Use XCode to create and sync a Provisioning Profile onto your device(s). The XCode build chain will not work properly if you do this step outside of XCode.
  4. Load the "Keychain Access" app on your Mac, search for iPhone, then copy the full text of the title of iPhone Developer: XXX and iPhone Distribution: YYY into the PROFILE file in the appropriate spots.
  5. In the SETUP file, set IOSVERSION to 6.0 or higher.

BlackBerry 10 (macOS or Linux)

  1. Install the BlackBerry Native SDK.
  2. Register as a BlackBerry developer and generate a BlackBerry ID token.
  3. Use the SDK Wizard to generate certificates and setup a device for development; generating a debug token and installing it on the device.
  4. Update SETUP and PROFILE with the relevant passwords and paths.

Linux cross-compilation (macOS)

Install a linux cross-compiler under /usr/local to create linux binaries.

Windows cross-compiler (macOS or Linux)

Install a windows cross-compiler under /usr/local to create windows binaries. For macOS CrossGCC works quite well.

OpenWrt cross-compilers (Linux)

Install the OpenWrt SDK for your target embedded platform and the system tools needed by the SDK. Note that only stand-alone (non-gui) applications can be built with OpenWrt. The OpenWrt SDK toolchains contain 32bit applications, so support for 32bit binaries are required on the host.

Windows development environment

If you are developing on a windows machine (not recommended) you have two options: MinGW and the MSYS development environment, or the Cygwin development environment.

Cygwin caution: Please note that the PATH environment can cause weird behaviour of the Cygwin system. This is especially true if a MinGW installation is present on the system. The best option to ensure that the environment is sane, is to limit PATH to cygwin directories only by editing /etc/profile.

Clone this wiki locally