Revision as of 09:49, 30 April 2014 by Craig Peacock (Talk | contribs)


Prerequisites

zlib

zlib is a compression library and a prerequisite for building GLib.

Download, cross compile and install the zlib compression libraries. Configure doesn't accept the --host parameter (reports unknown option), so you need to hack the makefile.

wget http://zlib.net/zlib-1.2.8.tar.gz
tar -xzf zlib-1.2.8.tar.gz
cd zlib-1.2.8/
./configure --prefix=/usr/arm-linux-gnueabi 

Edit the makefile and prefix the build tools with arm-linux-gnueabi-.

CC=arm-linux-gnueabi-gcc
LDSHARED=arm-linux-gnueabi-gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map
CPP=arm-linux-gnueabi-gcc -E
AR=arm-linux-gnueabi-ar
RANLIB=arm-linux-gnueabi-ranlib

Make and install:

make
make install

libffi

libffi is the Portable Foreign Function Interface Library and is a prerequisite for building GLib. It is an interface that allows code written in one language to call code written in another language.

Download, build and install:

wget ftp://sourceware.org/pub/libffi/libffi-3.0.13.tar.gz
tar -xzf libffi-3.0.13.tar.gz
cd libffi-3.0.13/
./configure --host=arm-linux-gnueabi --prefix=/usr/arm-linux-gnueabi  
make
make install

GLib

GLib is part of the GTK+ Project

GLib requires zlib, libffi and glibc >= 2.18 to successfully build. If you are building on ubuntu 14.04, the arm-linux-gnueabi should come installed with glibc 2.19 hence we don't rebuild it.

GLib requires the glib-genmarshal tool installed on your build system otherwise the following error is likey to result:

checking for glib-genmarshal... no
configure: error: Could not find a glib-genmarshal in your PATH

An easy way to resolve this is to install libglib2.0-dev:

sudo apt-get install libglib2.0-dev

To build Glib, download, build and install:

wget http://ftp.gnome.org/pub/gnome/sources/glib/2.40/glib-2.40.0.tar.xz
tar -xJf glib-2.40.0.tar.xz
cd glib-2.40.0
./configure --host=arm-linux-gnueabi --prefix=/usr/arm-linux-gnueabi PKG_CONFIG_PATH=/usr/arm-linux-gnueabi/lib/pkgconfig  glib_cv_stack_grows=no glib_cv_uscore=yes ac_cv_func_posix_getpwuid_r=yes ac_cv_func_posix_getgrgid_r=yes 
make
make install

The Expat XML Parser

Expat is an XML parser library written in C and is the only required dependency for the D-Bus daemon.

Download, build and install:

wget http://sourceforge.net/projects/expat/files/expat/2.1.0/expat-2.1.0.tar.gz
tar -xzf expat-2.1.0.tar.gz 
cd expat-2.1.0/
./configure --host=arm-linux-gnueabi --prefix=/usr/arm-linux-gnueabi
make
make install

D-Bus

D-Bus is a message bus system. It requires the expat library to successfully build otherwise the following error may result:

checking for XML_ParserCreate_MM in -lexpat... no
configure: error: Explicitly requested expat but expat not found

Download, build and install:

wget http://dbus.freedesktop.org/releases/dbus/dbus-1.8.0.tar.gz
tar -xzf dbus-1.8.0.tar.gz
cd dbus-1.8.0/
./configure --host=arm-linux-gnueabi --prefix=/usr/arm-linux-gnueabi
make
make install

Attr

The attr package contains commands for manipulating the extended attributes on filesystem objects.

It is a prerequisite for libcap. Download, build and install the library:

http://download.savannah.gnu.org/releases/attr/attr-2.4.47.src.tar.gz
tar -xzf attr-2.4.47.src.tar.gz
cd attr-2.4.47/
./configure --host=arm-linux-gnueabi --prefix=/usr/arm-linux-gnueabi
make
make install-lib install-dev

Install-lib installs the library, while install-dev (development) installs the C header files.

Finally, create a symbolic link for libattr:

ln -s /usr/arm-linux-gnueabi/lib/libattr.so.1.1.0 /usr/arm-linux-gnueabi/lib/libattr.so

libcap

Libcap is a library for getting and setting POSIX.1e capabilities.

https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.24.tar.xz
tar -xJf libcap-2.24.tar.xz
cd libcap-2.24/
make prefix=/usr/arm-linux-gnueabi BUILD_CC=gcc CC=arm-linux-gnueabi-gcc AR=arm-linux-gnueabi-ar RANLIB=arm-linux-gnueabi-ranlib

libkmod

Kmod contains programs for loading, inserting and removing kernel modules for Linux.

It is a prerequisite for systemd. Download, build and install the library:

https://www.kernel.org/pub/linux/utils/kernel/kmod/kmod-17.tar.gz
tar -xzf kmod-17.tar.gz 
cd kmod-17/
./configure --host=arm-linux-gnueabi --prefix=/usr/arm-linux-gnueabi
make
make install

systemd

http://www.freedesktop.org/software/systemd/systemd-212.tar.xz
tar -xJf systemd-212.tar.xz
cd systemd-212/
./configure --host=arm-linux-gnueabi --prefix=/usr/arm-linux-gnueabi PKG_CONFIG_PATH=/usr/arm-linux-gnueabi/lib/pkgconfig ac_cv_func_malloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes
make src/libudev
make install src/libudev

libical

libical provides a library for the iCal standard. It is a prerequisite of BlueZ.

libical requires cmake and g++ cross compilers to be installed:

sudo apt-get install cmake
sudo apt-get install g++-arm-linux-gnueabi

Download, build and install the library:

wget http://downloads.sourceforge.net/freeassociation/libical-1.0.tar.gz
tar -xzf libical-1.0.tar.gz
cd libical-1.0/
export CC=arm-linux-gnueabi-gcc
export CXX=arm-linux-gnueabi-g++
cmake -DCMAKE_INSTALL_PREFIX=/usr/arm-linux-gnueabi
make
make install

Readline

wget ftp://ftp.cwru.edu/pub/bash/readline-6.3.tar.gz
tar -xzf readline-6.3.tar.gz
cd readline-6.3/
./configure --host=arm-linux-gnueabi --prefix=/usr/arm-linux-gnueabi bash_cv_wcwidth_broken=yes
make
make install

The bash_cv_wcwidth_broken=yes parameter avoids the following error when cross-compiling:

checking for wcwidth broken with unicode combining characters... 
configure: error: in `/.../readline-6.3':
configure: error: cannot run test program while cross compiling

Readline references functions in ncurses. If ncurses is not available, the following errors are likely to result when building BlueZ:

/usr/arm-linux-gnueabi/lib/libreadline.so: undefined reference to `PC'
/usr/arm-linux-gnueabi/lib/libreadline.so: undefined reference to `tgetflag'
/usr/arm-linux-gnueabi/lib/libreadline.so: undefined reference to `tgetent'
/usr/arm-linux-gnueabi/lib/libreadline.so: undefined reference to `UP'
/usr/arm-linux-gnueabi/lib/libreadline.so: undefined reference to `tputs'
/usr/arm-linux-gnueabi/lib/libreadline.so: undefined reference to `tgoto'
/usr/arm-linux-gnueabi/lib/libreadline.so: undefined reference to `tgetnum'
/usr/arm-linux-gnueabi/lib/libreadline.so: undefined reference to `BC'
/usr/arm-linux-gnueabi/lib/libreadline.so: undefined reference to `tgetstr'

ncurses

wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz
tar -xzf ncurses-5.9.tar.gz
cd ncurses-5.9
./configure --host=arm-linux-gnueabi --prefix=/usr/arm-linux-gnueabi CXX="arm-linux-gnueabi-g++"
make
make install

BlueZ

BlueZ is the official Bluetooth protocol stack for Linux and include tools such as hciattach, hciconfig, hcitool and rfcomm.

BlueZ 5.18 requires GLib >= 2.28, D-Bus >= 1.6 and libudev >= 143. When these prerequisites are meet, you can download, build and install BlueZ using:

wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.18.tar.xz
tar -xJf bluez-5.18.tar.xz
cd bluez-5.18
./configure --host=arm-linux-gnueabi --prefix= PKG_CONFIG_PATH=/usr/arm-linux-gnueabi/lib/pkgconfig --with-systemdsystemunitdir=/lib/systemd/system --with-systemduserunitdir=/usr/lib/systemd
make
make install