Toolchain

From Openmoko

(Difference between revisions)
Jump to: navigation, search
(Undo revision 59972 by Zub (Talk) WTF happened? :-/)
(Fixed whatever I broke. At least so I hope.)
Line 29: Line 29:
  
 
* For Ubuntu 8.04 ( Previous versions don't support libmokoui2 ) the following is required:
 
* For Ubuntu 8.04 ( Previous versions don't support libmokoui2 ) the following is required:
sudo apt-get install gcc g++ autoconf automake binutils libtool libglib2.0-dev \
+
sudo apt-get install gcc g++ autoconf automake binutils libtool libglib2.0-dev \
ccache libxrender-dev intltool libmokoui2-dev libgconf2-dev mtools fakeroot alien check
+
ccache libxrender-dev intltool libmokoui2-dev libgconf2-dev mtools fakeroot alien check
  
 
* For Ubuntu 8.10 the following is additionally required, install also those above:
 
* For Ubuntu 8.10 the following is additionally required, install also those above:
sudo apt-get install uboot-mkimage
+
sudo apt-get install uboot-mkimage
  
 
* For Fedora-Core the following is required, while logged in as <tt>root</tt>:
 
* For Fedora-Core the following is required, while logged in as <tt>root</tt>:
yum install gcc gcc-c++ autoconf automake binutils libtool glib2-devel \
+
yum install gcc gcc-c++ autoconf automake binutils libtool glib2-devel \
ccache libXrender-devel intltool GConf2-devel mtools gettext-devel
+
ccache libXrender-devel intltool GConf2-devel mtools gettext-devel
 
Fedora-Core does not appear to have <tt>libmokoui2</tt> available.
 
Fedora-Core does not appear to have <tt>libmokoui2</tt> available.
  
* For Debian (Sid) do (as root):
+
* For Debian (Sid) do (as root):  
apt-get install build-essential ccache autoconf automake autotools-dev libtool gettext intltool curl uboot-mkimage mtools fakeroot alien check libglib2.0-dev libxrender-dev libgconf2-dev
+
apt-get install build-essential ccache autoconf automake autotools-dev libtool \
 +
gettext intltool curl uboot-mkimage mtools fakeroot alien check libglib2.0-dev \
 +
libxrender-dev libgconf2-dev
  
 
==Downloading and installing==
 
==Downloading and installing==
Line 52: Line 54:
 
* Creating a destination directory can be anywhere, but for example:
 
* Creating a destination directory can be anywhere, but for example:
  
mkdir ~/sources
+
  mkdir ~/sources
cd ~/sources
+
  cd ~/sources
  
 
* Depending on your CPU type (x86_64 or i686) download the proper package:
 
* Depending on your CPU type (x86_64 or i686) download the proper package:
  
wget http://downloads.openmoko.org/toolchains/openmoko-x86_64-arm-linux-gnueabi-toolchain.tar.bz2
+
  wget http://downloads.openmoko.org/toolchains/openmoko-x86_64-arm-linux-gnueabi-toolchain.tar.bz2
or
+
or
wget http://downloads.openmoko.org/toolchains/openmoko-i686-arm-linux-gnueabi-toolchain.tar.bz2
+
  wget http://downloads.openmoko.org/toolchains/openmoko-i686-arm-linux-gnueabi-toolchain.tar.bz2
  
 
{{Note|Several people have had problems with the latest toolchain built 20080521.  If you experience errors, try an older version. (as of July 23, 2008)}}
 
{{Note|Several people have had problems with the latest toolchain built 20080521.  If you experience errors, try an older version. (as of July 23, 2008)}}
Line 68: Line 70:
 
* Extract it directly as root, so use command "su" first (or prefix the tar command with "sudo" when you are using Debian/Ubuntu):
 
* Extract it directly as root, so use command "su" first (or prefix the tar command with "sudo" when you are using Debian/Ubuntu):
  
cd /
+
  cd /
tar -xjvf ~/sources/openmoko-XYZ-arm-linux-gnueabi-toolchain.tar.bz2
+
  tar -xjvf ~/sources/openmoko-XYZ-arm-linux-gnueabi-toolchain.tar.bz2
  
 
* On Debian-based systems (e.g. Ubuntu), you can use alien(+fakeroot) to create an easy-to-uninstall package from this .tar.bz2:
 
* On Debian-based systems (e.g. Ubuntu), you can use alien(+fakeroot) to create an easy-to-uninstall package from this .tar.bz2:
  
bunzip2 openmoko-*-arm-linux-gnueabi-toolchain.tar.bz2
+
  bunzip2 openmoko-*-arm-linux-gnueabi-toolchain.tar.bz2
gzip openmoko-*-arm-linux-gnueabi-toolchain.tar
+
  gzip openmoko-*-arm-linux-gnueabi-toolchain.tar
fakeroot alien -d openmoko-*-arm-linux-gnueabi-toolchain.tar.gz
+
  fakeroot alien -d openmoko-*-arm-linux-gnueabi-toolchain.tar.gz
sudo dpkg -i openmoko_*-arm-linux-gnueabi-toolchain*.deb
+
  sudo dpkg -i openmoko_*-arm-linux-gnueabi-toolchain*.deb
  
 
* The prebuilt toolchain is for x86_64 or i686. If you wanted, you could build it on your own with OE:
 
* The prebuilt toolchain is for x86_64 or i686. If you wanted, you could build it on your own with OE:
  
bitbake meta-toolchain-openmoko
+
  bitbake meta-toolchain-openmoko
  
 
Finally, everytime you want to use this toolchain, you need to alter some environment variables, so that your tools will be found. The toolchain provides a script to do that, so the only thing you need to do is to [http://learnlinux.tsf.org.za/courses/build/shell-scripting/ch10s02.html source] it.
 
Finally, everytime you want to use this toolchain, you need to alter some environment variables, so that your tools will be found. The toolchain provides a script to do that, so the only thing you need to do is to [http://learnlinux.tsf.org.za/courses/build/shell-scripting/ch10s02.html source] it.
Line 86: Line 88:
 
to start "sh" or "bash" first.
 
to start "sh" or "bash" first.
  
. /usr/local/openmoko/arm/setup-env
+
. /usr/local/openmoko/arm/setup-env
  
* At least, you should add /usr/local/openmoko/arm/bin to your $PATH variable, otherwise the next steps won't work (om-conf and make).
+
* At least, you should add /usr/local/openmoko/arm/bin to your $PATH variable, otherwise the next steps won't work (om-conf and make).  
export PATH=$PATH:/usr/local/openmoko/arm/bin
+
export PATH=$PATH:/usr/local/openmoko/arm/bin  
 
Note: This is will only last for your current session. Add it to your shell startup scripts to make it permenant (~/.bashrc for instance).
 
Note: This is will only last for your current session. Add it to your shell startup scripts to make it permenant (~/.bashrc for instance).
  
Line 97: Line 99:
  
 
*You need to alter some environment variables before you download libraries.
 
*You need to alter some environment variables before you download libraries.
. /usr/local/openmoko/arm/environment-setup
+
  . /usr/local/openmoko/arm/environment-setup
  
 
*First, update the opkg database (Notice, you should use alias '''opkg-target''' but not '''opkg''')
 
*First, update the opkg database (Notice, you should use alias '''opkg-target''' but not '''opkg''')
opkg-target update
+
opkg-target update
  
 
*Second, select a package what you want. Let's use edje as an example. If you want develop an project which use edje of Enlightenment, you can use '''opkg-target list''' to print out how many packages you can have. Of course, command '''grep''' will help you a lot.(Remember, you should install -dev package but not only libedje.)
 
*Second, select a package what you want. Let's use edje as an example. If you want develop an project which use edje of Enlightenment, you can use '''opkg-target list''' to print out how many packages you can have. Of course, command '''grep''' will help you a lot.(Remember, you should install -dev package but not only libedje.)
opkg-target list |grep edje-dev
+
opkg-target list |grep edje-dev
  
 
*Third, install it
 
*Third, install it
opkg-target install libedje-dev
+
opkg-target install libedje-dev
 
*Fourth, have a cup of coffee and wait.
 
*Fourth, have a cup of coffee and wait.
  
Line 115: Line 117:
 
* copy the downloaded sample application source:
 
* copy the downloaded sample application source:
  
cp -r /usr/local/openmoko/source/openmoko-sample2 ~/
+
cp -r /usr/local/openmoko/source/openmoko-sample2 ~/
  
 
* Remember to set the proper environment variables (again with "sh" or "bash") for openmoko:
 
* Remember to set the proper environment variables (again with "sh" or "bash") for openmoko:
  
. /usr/local/openmoko/arm/setup-env
+
. /usr/local/openmoko/arm/setup-env
  
 
* You need to create a build configuration for this application. This also checks if all needed libraries, tools, etc.. is available on your system. If this fails see the notes about the needed packages in the section "Prerequisites" mentioned earlier.
 
* You need to create a build configuration for this application. This also checks if all needed libraries, tools, etc.. is available on your system. If this fails see the notes about the needed packages in the section "Prerequisites" mentioned earlier.
  
om-conf openmoko-sample2
+
om-conf openmoko-sample2
  
 
* Optionally now you can modify the source code in openmoko-sample2/src.  Before the next step, go into the sample directory.
 
* Optionally now you can modify the source code in openmoko-sample2/src.  Before the next step, go into the sample directory.
  
cd openmoko-sample2
+
cd openmoko-sample2
  
 
* If you are using an older version of the toolchain, you may have to create the makefile by running "./autogen.sh".  Otherwise, to build the application from the source code just type:
 
* If you are using an older version of the toolchain, you may have to create the makefile by running "./autogen.sh".  Otherwise, to build the application from the source code just type:
  
make
+
make
  
 
* If there are errors (i.e. "You need to install gnome-common from the GNOME CVS") deal with them.  Also see "Troubleshooting" section at the end of this page for known issues.
 
* If there are errors (i.e. "You need to install gnome-common from the GNOME CVS") deal with them.  Also see "Troubleshooting" section at the end of this page for known issues.
Line 137: Line 139:
  
 
If you want to install this project on host for staging usage later, a shared library, for example, you can do the following to install it into a given configured prefix.
 
If you want to install this project on host for staging usage later, a shared library, for example, you can do the following to install it into a given configured prefix.
om-conf --prefix=/usr/local/openmoko openmoko-sample2
+
om-conf --prefix=/usr/local/openmoko openmoko-sample2
cd openmoko-sample2
+
cd openmoko-sample2
make install
+
make install
  
 
==How to create your own project from the sample project==
 
==How to create your own project from the sample project==
Line 147: Line 149:
 
* copy the downloaded sample application source
 
* copy the downloaded sample application source
  
cp -r /usr/local/openmoko/source/openmoko-sample2 ~/
+
cp -r /usr/local/openmoko/source/openmoko-sample2 ~/
 +
 +
* rename the folder with the name of your project (in this example your-project-name) and delete old sample files
  
* rename the folder with the name of your project (in this example your-project-name) and delete old sample files
+
mv openmoko-sample2 your-project-name
 
+
cd your-project-name
mv openmoko-sample2 your-project-name
+
cd src
cd your-project-name
+
rm *.c
cd src
+
rm *.c
+
  
 
* copy your sources (in this example your-sources) into src/
 
* copy your sources (in this example your-sources) into src/
  
cp your-sources .
+
cp your-sources .
cd ..
+
cd ..
  
 
* now in the main folder modify autogen.sh by updating the following lines
 
* now in the main folder modify autogen.sh by updating the following lines
  
PKG_NAME="your-project-name"
+
PKG_NAME="your-project-name"
  
 
* modify configure.ac by updating the following lines ('main.c' should be the main file in your project)
 
* modify configure.ac by updating the following lines ('main.c' should be the main file in your project)
  
AC_INIT(your-project-name, 0.0.1, http://www.openmoko.org/)
+
AC_INIT(your-project-name, 0.0.1, http://www.openmoko.org/)  
AC_CONFIG_SRCDIR(src/main.c)
+
AC_CONFIG_SRCDIR(src/main.c)
  
 
* go into data/ folder and rename these files with the name of your project
 
* go into data/ folder and rename these files with the name of your project
  
cd data
+
cd data
mv openmoko-sample.png your-project-name.png
+
mv openmoko-sample.png your-project-name.png
mv openmoko-sample.desktop your-project-name.desktop
+
mv openmoko-sample.desktop your-project-name.desktop
  
 
* modify Makefile.am inside data/ by updating the following lines
 
* modify Makefile.am inside data/ by updating the following lines
  
dist_desktop_DATA = your-project-name.desktop
+
dist_desktop_DATA = your-project-name.desktop
dist_appicon_DATA = your-project-name.png
+
dist_appicon_DATA = your-project-name.png
  
 
* modify Makefile.in inside data/ by updating the following lines
 
* modify Makefile.in inside data/ by updating the following lines
 
+
dist_desktop_DATA = your-project-name.desktop
+
dist_desktop_DATA = your-project-name.desktop
dist_appicon_DATA = your-project-name.png
+
dist_appicon_DATA = your-project-name.png
  
 
* modify your-project-name.desktop by updating the following lines
 
* modify your-project-name.desktop by updating the following lines
  
Name=your-project-name
+
Name=your-project-name
Encoding=UTF-8
+
Encoding=UTF-8
Version=0.0.1
+
Version=0.0.1
Type=Application
+
Type=Application
Exec=your-project-name
+
Exec=your-project-name
  
 
* and by adding the following line
 
* and by adding the following line
  
Icon=your-project-name
+
Icon=your-project-name
  
 
* move into src/ folder
 
* move into src/ folder
  
cd ..
+
cd ..
cd src
+
cd src
  
 
* modify Makefile.am by updating the following lines
 
* modify Makefile.am by updating the following lines
  
bin_PROGRAMS = your-project-name
+
bin_PROGRAMS = your-project-name
your_project_name_SOURCES = \
+
your_project_name_SOURCES = \
main.c
+
  main.c  
your_project_name_LDADD  = @DEPENDENCIES_LIBS@
+
your_project_name_LDADD  = @DEPENDENCIES_LIBS@
  
 
* be sure to put instead of main.c all your .c and .h files and modify all the '-' characters with '_' in the variable names
 
* be sure to put instead of main.c all your .c and .h files and modify all the '-' characters with '_' in the variable names
Line 216: Line 218:
 
We have included a script to make an ipkg out of your application. Note that this is not needed to test your application on the Neo (for that you can just scp the resulting binary and data over), however it's very handy if you want to distribute your application to others.
 
We have included a script to make an ipkg out of your application. Note that this is not needed to test your application on the Neo (for that you can just scp the resulting binary and data over), however it's very handy if you want to distribute your application to others.
  
om-make-ipkg openmoko-sample2
+
om-make-ipkg openmoko-sample2
  
 
Now you got openmoko-sample2_0.1_armv4t.ipk , you can `scp' it to your
 
Now you got openmoko-sample2_0.1_armv4t.ipk , you can `scp' it to your
 
Neo and install it:
 
Neo and install it:
  
scp openmoko-sample2_0.1_armv4t.ipk root@192.168.0.202:
+
scp openmoko-sample2_0.1_armv4t.ipk root@192.168.0.202:
ssh root@192.168.0.202 opkg install openmoko-sample2_0.1_armv4t.ipk
+
ssh root@192.168.0.202 opkg install openmoko-sample2_0.1_armv4t.ipk
  
 
Note that while you can redistribute the generated ipkg, be aware that this is a bare-bones ipk that contains no further information, i.e. you will lack library dependencies. See below how to fix this.
 
Note that while you can redistribute the generated ipkg, be aware that this is a bare-bones ipk that contains no further information, i.e. you will lack library dependencies. See below how to fix this.
Line 228: Line 230:
 
You can also supply the version number, a description, and an author / contacts string in a control file:
 
You can also supply the version number, a description, and an author / contacts string in a control file:
  
om-make-ipkg myapp myapp_control
+
om-make-ipkg myapp myapp_control
  
 
A template of myapp_control:
 
A template of myapp_control:
  
Package: $appname
+
Package: $appname
Version: 0.1
+
Version: 0.1
Description: package built by openmoko toolchain
+
Description: package built by openmoko toolchain
Section: openmoko/applications
+
Section: openmoko/applications
Priority: optional
+
Priority: optional
Maintainer: $USER
+
Maintainer: $USER
Architecture: armv4t
+
Architecture: armv4t
Homepage: http://www.openmoko.org/
+
Homepage: http://www.openmoko.org/
Depends:
+
Depends:  
Source: ${SRC}
+
Source: ${SRC}
  
 
==Where to go from here==
 
==Where to go from here==
Line 254: Line 256:
 
==Building Openmoko Kernel from git repo using Toolchain==
 
==Building Openmoko Kernel from git repo using Toolchain==
  
git clone git://git.openmoko.org/git/kernel.git linux-2.6
+
git clone git://git.openmoko.org/git/kernel.git linux-2.6
cd linux-2.6
+
cd linux-2.6
git checkout -b mystable origin/stable
+
git checkout -b mystable origin/stable
cp defconfig-gta02 .config
+
cp defconfig-gta02 .config
./build
+
./build
  
 
Will fail with error message "arm-angstrom-linux-gnueabi-ld: unrecognized option '-Wl,-rpath-link,/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/lib'" until /usr/local/openmoko/arm/setup-env is modified. LDFLAGS should be changed from:
 
Will fail with error message "arm-angstrom-linux-gnueabi-ld: unrecognized option '-Wl,-rpath-link,/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/lib'" until /usr/local/openmoko/arm/setup-env is modified. LDFLAGS should be changed from:
  
export LDFLAGS="-L${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib -Wl,-rpath-link,${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib -Wl,-O1"
+
export LDFLAGS="-L${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib -Wl,-rpath-link,${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib -Wl,-O1"
  
 
to:
 
to:
  
export LDFLAGS="-L${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib -rpath-link ${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib -O1"
+
export LDFLAGS="-L${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib -rpath-link ${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib -O1"
  
 
I also had to change the 'build' script to hardcode the path to the compiler.
 
I also had to change the 'build' script to hardcode the path to the compiler.
Line 272: Line 274:
 
==Using toolchain provided libraries==
 
==Using toolchain provided libraries==
 
Add the necessary libraries to the _LDADD field in src/Makefile.am, for example:
 
Add the necessary libraries to the _LDADD field in src/Makefile.am, for example:
openmoko_sample2_LDADD  = @DEPENDENCIES_LIBS@ -lmokogsmd2
+
openmoko_sample2_LDADD  = @DEPENDENCIES_LIBS@ -lmokogsmd2
  
 
make sure to run om-conf again after this.
 
make sure to run om-conf again after this.
Line 282: Line 284:
 
In that case, feel free to request the inclusion of additional libraries into the next release of the Openmoko toolchain. Until then, here is how you enhance your already installed toolchain. Say, we want to add the library called liburiparse:
 
In that case, feel free to request the inclusion of additional libraries into the next release of the Openmoko toolchain. Until then, here is how you enhance your already installed toolchain. Say, we want to add the library called liburiparse:
  
cd ~/source
+
cd ~/source
wget http://downloads.sourceforge.net/uriparser/uriparser-0.6.0.tar.bz2
+
wget http://downloads.sourceforge.net/uriparser/uriparser-0.6.0.tar.bz2
tar xjf uriparser-0.6.0.tar.bz2
+
tar xjf uriparser-0.6.0.tar.bz2
cd uriparser-0.6.0
+
cd uriparser-0.6.0
./configure --host=arm-angstrom-linux-gnueabi \
+
./configure --host=arm-angstrom-linux-gnueabi \
--prefix=/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr
+
--prefix=/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr
make
+
make
make install
+
make install
  
 
That's it.
 
That's it.
Line 308: Line 310:
 
Attached is a beta fix for the .la problem. Untar the .tar.bz2 as root, and execute the following bash script as root:
 
Attached is a beta fix for the .la problem. Untar the .tar.bz2 as root, and execute the following bash script as root:
  
#!/bin/sh
+
        #!/bin/sh
DIR=/usr/local/openmoko/arm
+
        DIR=/usr/local/openmoko/arm
for la in `find $DIR -iname \*.la`; do
+
        for la in `find $DIR -iname \*.la`; do
dependency_libs=
+
        dependency_libs=
. $la
+
        . $la
for lib in $dependency_libs ; do
+
        for lib in $dependency_libs ; do
delib=`echo $lib | grep -E .la$`
+
        delib=`echo $lib | grep -E .la$`
if [ -z $delib ] ; then
+
        if [ -z $delib ] ; then
echo -n
+
          echo -n
elif [ -f $delib ]; then
+
        elif [ -f $delib ]; then
echo -n
+
          echo -n
else
+
        else
basedelib=`basename $delib`
+
          basedelib=`basename $delib`
replacedelibs=`find $DIR -iname $basedelib`
+
          replacedelibs=`find $DIR -iname $basedelib`
found=0
+
          found=0
for replacedelib in $replacedelibs ; do
+
          for replacedelib in $replacedelibs ; do
if [ $replacedelib == $delib ]; then
+
          if [ $replacedelib == $delib ]; then
found=1
+
          found=1
fi
+
          fi
done
+
          done
if [ $found -gt 0 ] ; then
+
          if [ $found -gt 0 ] ; then
echo -n
+
          echo -n
else
+
          else
sed_delib=`echo $delib | sed 's/\//\\\\\//g'`
+
            sed_delib=`echo $delib | sed 's/\//\\\\\//g'`
sed_replacedelib=`echo $replacedelib | sed 's/\//\\\\\//g'`
+
            sed_replacedelib=`echo $replacedelib | sed 's/\//\\\\\//g'`
# A bit slow, we could chain expressions for speed. :)
+
            # A bit slow, we could chain expressions for speed. :)
cp $la $la.old
+
            cp $la $la.old
cat $la | sed "s/$sed_delib/$sed_replacedelib/g" > $la.new
+
            cat $la | sed "s/$sed_delib/$sed_replacedelib/g" > $la.new
mv $la.new $la
+
            mv $la.new $la
rm $la.old
+
            rm $la.old
fi
+
          fi
fi
+
        fi
done
+
        done
done
+
        done
 +
 
 +
* If you can't get the toolchain working in your distro (for example if you keep bumping into strange autotools issues), you can set up the toolchain inside a Debian chroot, which should provide reasonably standard environment. There's a guide for it: http://linux.fjfi.cvut.cz/~zub/debian-chroot-toolchain.txt
  
 
* Please use the [http://lists.openmoko.org/mailman/listinfo/openmoko-devel Openmoko-Devel] mailing list.
 
* Please use the [http://lists.openmoko.org/mailman/listinfo/openmoko-devel Openmoko-Devel] mailing list.
 +
 +
[[Category:Application Developer]]
  
 
[[Category:Application Developer]]
 
[[Category:Application Developer]]

Revision as of 01:28, 18 November 2008


Contents

Introduction

A toolchain is a set of tools that allows you to compile code. For Openmoko, we have to differentiate between the following use-cases:

(a) Developing a single application
For this, you should use a prebuilt toolchain from the Openmoko project. On this page you can find a recipe to get started with this toolchain leading you through a series of steps to compile a project and run it on your target device. (You might have heard about OpenEmbedded, however as an application programmer, you should not be using OpenEmbedded.)
(b) System Integration and customizing a distribution
For this task, you should use OpenEmbedded which builds its own cross compiler during the bootstrapping/build process. System Integration and customizing a distribution is out of scope of this page.

Basic toolchain usage

Prerequisites

You should be reasonably familiar with Linux and its command line tools, have an x86-compatible computer with at least 1G of free disk space. You should have experience with compiling programs from source using your local compiler. The remainder of this document will also assume you have write access in your home directory (~) and /usr/local/ (becoming root if needed). If any of this is not the case, please call your local administrator for help.

Last but not least you should have a working setup that allows you to compile native software packages using the autotools build system (the triade of ./configure, make, make install).

A (partial) list of required packages -- please append as necessary:

  • For most Linux version you might only need to install the packages
    • autoconf, automake
    • binutils, gcc, gcc-c++
    • libtool
    • ccache
    • intltool
  • For Ubuntu 8.04 ( Previous versions don't support libmokoui2 ) the following is required:
sudo apt-get install gcc g++ autoconf automake binutils libtool libglib2.0-dev \
ccache libxrender-dev intltool libmokoui2-dev libgconf2-dev mtools fakeroot alien check
  • For Ubuntu 8.10 the following is additionally required, install also those above:
sudo apt-get install uboot-mkimage
  • For Fedora-Core the following is required, while logged in as root:
yum install gcc gcc-c++ autoconf automake binutils libtool glib2-devel \
ccache libXrender-devel intltool GConf2-devel mtools gettext-devel

Fedora-Core does not appear to have libmokoui2 available.

  • For Debian (Sid) do (as root):
apt-get install build-essential ccache autoconf automake autotools-dev libtool \
gettext intltool curl uboot-mkimage mtools fakeroot alien check libglib2.0-dev \
libxrender-dev libgconf2-dev

Downloading and installing

NOTE: If you wish to improve an existing Openmoko application and you are running Debian or Ubuntu i386 (i.e. you can install a .deb), you may wish to skip the below and instead use:

Openmoko application development in 5 minutes by Andreas Dalsgaard. (based on the 2007.2 stack)


The prebuilt toolchain can be downloaded from downloads.openmoko.org:

  • Creating a destination directory can be anywhere, but for example:
 mkdir ~/sources
 cd ~/sources
  • Depending on your CPU type (x86_64 or i686) download the proper package:
 wget http://downloads.openmoko.org/toolchains/openmoko-x86_64-arm-linux-gnueabi-toolchain.tar.bz2
or
 wget http://downloads.openmoko.org/toolchains/openmoko-i686-arm-linux-gnueabi-toolchain.tar.bz2
NOTE: Several people have had problems with the latest toolchain built 20080521. If you experience errors, try an older version. (as of July 23, 2008)


Next, you want to extract it on your filesystem. This toolchain is not relocatable, it needs to be installed into /usr/local/openmoko/. Now you have the following options:

  • Extract it directly as root, so use command "su" first (or prefix the tar command with "sudo" when you are using Debian/Ubuntu):
  cd /
  tar -xjvf ~/sources/openmoko-XYZ-arm-linux-gnueabi-toolchain.tar.bz2
  • On Debian-based systems (e.g. Ubuntu), you can use alien(+fakeroot) to create an easy-to-uninstall package from this .tar.bz2:
  bunzip2 openmoko-*-arm-linux-gnueabi-toolchain.tar.bz2
  gzip openmoko-*-arm-linux-gnueabi-toolchain.tar
  fakeroot alien -d openmoko-*-arm-linux-gnueabi-toolchain.tar.gz
  sudo dpkg -i openmoko_*-arm-linux-gnueabi-toolchain*.deb
  • The prebuilt toolchain is for x86_64 or i686. If you wanted, you could build it on your own with OE:
  bitbake meta-toolchain-openmoko

Finally, everytime you want to use this toolchain, you need to alter some environment variables, so that your tools will be found. The toolchain provides a script to do that, so the only thing you need to do is to source it. Note that if you are not using a "sh" or "bash" shell (check with "echo $SHELL") that you need to start "sh" or "bash" first.

. /usr/local/openmoko/arm/setup-env
  • At least, you should add /usr/local/openmoko/arm/bin to your $PATH variable, otherwise the next steps won't work (om-conf and make).
export PATH=$PATH:/usr/local/openmoko/arm/bin 

Note: This is will only last for your current session. Add it to your shell startup scripts to make it permenant (~/.bashrc for instance).

Installing New Libraries

Openmoko toolchain didn't include many libraries in default. However, it can download and install library what has already existed in Openmoko repository. (It refer to Testing Repository by default.)

  • You need to alter some environment variables before you download libraries.
 . /usr/local/openmoko/arm/environment-setup
  • First, update the opkg database (Notice, you should use alias opkg-target but not opkg)
opkg-target update
  • Second, select a package what you want. Let's use edje as an example. If you want develop an project which use edje of Enlightenment, you can use opkg-target list to print out how many packages you can have. Of course, command grep will help you a lot.(Remember, you should install -dev package but not only libedje.)
opkg-target list |grep edje-dev
  • Third, install it
opkg-target install libedje-dev
  • Fourth, have a cup of coffee and wait.

Building a sample project

In a chosen destination directory (in this example ~/):

  • copy the downloaded sample application source:
cp -r /usr/local/openmoko/source/openmoko-sample2 ~/
  • Remember to set the proper environment variables (again with "sh" or "bash") for openmoko:
. /usr/local/openmoko/arm/setup-env
  • You need to create a build configuration for this application. This also checks if all needed libraries, tools, etc.. is available on your system. If this fails see the notes about the needed packages in the section "Prerequisites" mentioned earlier.
om-conf openmoko-sample2
  • Optionally now you can modify the source code in openmoko-sample2/src. Before the next step, go into the sample directory.
cd openmoko-sample2
  • If you are using an older version of the toolchain, you may have to create the makefile by running "./autogen.sh". Otherwise, to build the application from the source code just type:
make
  • If there are errors (i.e. "You need to install gnome-common from the GNOME CVS") deal with them. Also see "Troubleshooting" section at the end of this page for known issues.


If you want to install this project on host for staging usage later, a shared library, for example, you can do the following to install it into a given configured prefix.

om-conf --prefix=/usr/local/openmoko openmoko-sample2
cd openmoko-sample2
make install

How to create your own project from the sample project

In order to build your own project by using openmoko-sample2 files, some changes are needed:

  • copy the downloaded sample application source
cp -r /usr/local/openmoko/source/openmoko-sample2 ~/

  • rename the folder with the name of your project (in this example your-project-name) and delete old sample files
mv openmoko-sample2 your-project-name
cd your-project-name
cd src
rm *.c
  • copy your sources (in this example your-sources) into src/
cp your-sources .
cd ..
  • now in the main folder modify autogen.sh by updating the following lines
PKG_NAME="your-project-name"
  • modify configure.ac by updating the following lines ('main.c' should be the main file in your project)
AC_INIT(your-project-name, 0.0.1, http://www.openmoko.org/)    
AC_CONFIG_SRCDIR(src/main.c)
  • go into data/ folder and rename these files with the name of your project
cd data
mv openmoko-sample.png your-project-name.png
mv openmoko-sample.desktop your-project-name.desktop
  • modify Makefile.am inside data/ by updating the following lines
dist_desktop_DATA = your-project-name.desktop
dist_appicon_DATA = your-project-name.png
  • modify Makefile.in inside data/ by updating the following lines
dist_desktop_DATA = your-project-name.desktop
dist_appicon_DATA = your-project-name.png
  • modify your-project-name.desktop by updating the following lines
Name=your-project-name
Encoding=UTF-8
Version=0.0.1
Type=Application
Exec=your-project-name
  • and by adding the following line
Icon=your-project-name
  • move into src/ folder
cd ..
cd src
  • modify Makefile.am by updating the following lines
bin_PROGRAMS = your-project-name	
your_project_name_SOURCES = \				
 		main.c 
your_project_name_LDADD  = @DEPENDENCIES_LIBS@
  • be sure to put instead of main.c all your .c and .h files and modify all the '-' characters with '_' in the variable names

Packaging your application

We have included a script to make an ipkg out of your application. Note that this is not needed to test your application on the Neo (for that you can just scp the resulting binary and data over), however it's very handy if you want to distribute your application to others.

om-make-ipkg openmoko-sample2

Now you got openmoko-sample2_0.1_armv4t.ipk , you can `scp' it to your Neo and install it:

scp openmoko-sample2_0.1_armv4t.ipk root@192.168.0.202:
ssh root@192.168.0.202 opkg install openmoko-sample2_0.1_armv4t.ipk

Note that while you can redistribute the generated ipkg, be aware that this is a bare-bones ipk that contains no further information, i.e. you will lack library dependencies. See below how to fix this.

You can also supply the version number, a description, and an author / contacts string in a control file:

om-make-ipkg myapp myapp_control

A template of myapp_control:

Package: $appname
Version: 0.1
Description: package built by openmoko toolchain
Section: openmoko/applications
Priority: optional
Maintainer: $USER
Architecture: armv4t
Homepage: http://www.openmoko.org/
Depends: 
Source: ${SRC}

Where to go from here

Using the external toolchain is an easy way to build applications for your Neo. If you are familiar with this procedure, you might also want to look into

Advanced topics

Building Openmoko Kernel from git repo using Toolchain

git clone git://git.openmoko.org/git/kernel.git linux-2.6
cd linux-2.6
git checkout -b mystable origin/stable
cp defconfig-gta02 .config
./build

Will fail with error message "arm-angstrom-linux-gnueabi-ld: unrecognized option '-Wl,-rpath-link,/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/lib'" until /usr/local/openmoko/arm/setup-env is modified. LDFLAGS should be changed from:

export LDFLAGS="-L${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib -Wl,-rpath-link,${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib -Wl,-O1"

to:

export LDFLAGS="-L${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib -rpath-link ${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib -O1"

I also had to change the 'build' script to hardcode the path to the compiler.

Using toolchain provided libraries

Add the necessary libraries to the _LDADD field in src/Makefile.am, for example:

openmoko_sample2_LDADD  = @DEPENDENCIES_LIBS@ -lmokogsmd2

make sure to run om-conf again after this.

Installing additional libraries into the toolchain

Sooner or later you will want to compile an application that has dependencies which can't be fulfilled by the precompiled toolchain, e.g. some obscure libraries.

In that case, feel free to request the inclusion of additional libraries into the next release of the Openmoko toolchain. Until then, here is how you enhance your already installed toolchain. Say, we want to add the library called liburiparse:

cd ~/source
wget http://downloads.sourceforge.net/uriparser/uriparser-0.6.0.tar.bz2
tar xjf uriparser-0.6.0.tar.bz2
cd uriparser-0.6.0
./configure --host=arm-angstrom-linux-gnueabi \
--prefix=/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr
make
make install

That's it.

Getting your application packaged by OE

If you have written a cool application which you want to share with others, the best way to do that is to

  1. upload your application source code to a public location
  2. submit a BitBake recipe to OpenEmbedded, preferably via the OpenEmbedded bugtracker.

See also Customizing the Openmoko Distribution.

Troubleshooting

  • Some Versions of the Toolchain have corrupt .la files. If you compile an application using the Toolchain and you receive a '/space/fic/openmoko-daily/neo1973/work/armv4t-angstrom-linux-gnueabi/pango-1.18.3-r0/pango-1.18.3/pango/libpangoft2-1.0.la' error, you are affected. To fix that you should go to your "/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/lib" directory and open the affected .la files and change "/space/fic..." to "/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/lib". You have to fix more than one .la file. For the pango error you have to change "libpangocairo-1.0.la", but there are more corrupt .la files.

Attached is a beta fix for the .la problem. Untar the .tar.bz2 as root, and execute the following bash script as root:

       #!/bin/sh
       DIR=/usr/local/openmoko/arm
       for la in `find $DIR -iname \*.la`; do
        dependency_libs=
        . $la
        for lib in $dependency_libs ; do
        delib=`echo $lib | grep -E .la$`
        if [ -z $delib ] ; then
         echo -n
        elif [ -f $delib ]; then
         echo -n
        else
         basedelib=`basename $delib`
         replacedelibs=`find $DIR -iname $basedelib`
         found=0
         for replacedelib in $replacedelibs ; do
         if [ $replacedelib == $delib ]; then
          found=1
         fi
         done
         if [ $found -gt 0 ] ; then
          echo -n
         else
           sed_delib=`echo $delib | sed 's/\//\\\\\//g'`
           sed_replacedelib=`echo $replacedelib | sed 's/\//\\\\\//g'`
           # A bit slow, we could chain expressions for speed. :)
           cp $la $la.old
           cat $la | sed "s/$sed_delib/$sed_replacedelib/g" > $la.new
           mv $la.new $la
           rm $la.old
         fi
        fi
        done
       done
  • If you can't get the toolchain working in your distro (for example if you keep bumping into strange autotools issues), you can set up the toolchain inside a Debian chroot, which should provide reasonably standard environment. There's a guide for it: http://linux.fjfi.cvut.cz/~zub/debian-chroot-toolchain.txt
Personal tools


Introduction

A toolchain is a set of tools that allows you to compile code. For Openmoko, we have to differentiate between the following use-cases:

(a) Developing a single application
For this, you should use a prebuilt toolchain from the Openmoko project. On this page you can find a recipe to get started with this toolchain leading you through a series of steps to compile a project and run it on your target device. (You might have heard about OpenEmbedded, however as an application programmer, you should not be using OpenEmbedded.)
(b) System Integration and customizing a distribution
For this task, you should use OpenEmbedded which builds its own cross compiler during the bootstrapping/build process. System Integration and customizing a distribution is out of scope of this page.

Basic toolchain usage

Prerequisites

You should be reasonably familiar with Linux and its command line tools, have an x86-compatible computer with at least 1G of free disk space. You should have experience with compiling programs from source using your local compiler. The remainder of this document will also assume you have write access in your home directory (~) and /usr/local/ (becoming root if needed). If any of this is not the case, please call your local administrator for help.

Last but not least you should have a working setup that allows you to compile native software packages using the autotools build system (the triade of ./configure, make, make install).

A (partial) list of required packages -- please append as necessary:

  • For most Linux version you might only need to install the packages
    • autoconf, automake
    • binutils, gcc, gcc-c++
    • libtool
    • ccache
    • intltool
  • For Ubuntu 8.04 ( Previous versions don't support libmokoui2 ) the following is required:

sudo apt-get install gcc g++ autoconf automake binutils libtool libglib2.0-dev \ ccache libxrender-dev intltool libmokoui2-dev libgconf2-dev mtools fakeroot alien check

  • For Ubuntu 8.10 the following is additionally required, install also those above:

sudo apt-get install uboot-mkimage

  • For Fedora-Core the following is required, while logged in as root:

yum install gcc gcc-c++ autoconf automake binutils libtool glib2-devel \ ccache libXrender-devel intltool GConf2-devel mtools gettext-devel Fedora-Core does not appear to have libmokoui2 available.

  • For Debian (Sid) do (as root):

apt-get install build-essential ccache autoconf automake autotools-dev libtool gettext intltool curl uboot-mkimage mtools fakeroot alien check libglib2.0-dev libxrender-dev libgconf2-dev

Downloading and installing

NOTE: If you wish to improve an existing Openmoko application and you are running Debian or Ubuntu i386 (i.e. you can install a .deb), you may wish to skip the below and instead use:

Openmoko application development in 5 minutes by Andreas Dalsgaard. (based on the 2007.2 stack)


The prebuilt toolchain can be downloaded from downloads.openmoko.org:

  • Creating a destination directory can be anywhere, but for example:

mkdir ~/sources cd ~/sources

  • Depending on your CPU type (x86_64 or i686) download the proper package:

wget http://downloads.openmoko.org/toolchains/openmoko-x86_64-arm-linux-gnueabi-toolchain.tar.bz2 or wget http://downloads.openmoko.org/toolchains/openmoko-i686-arm-linux-gnueabi-toolchain.tar.bz2

NOTE: Several people have had problems with the latest toolchain built 20080521. If you experience errors, try an older version. (as of July 23, 2008)


Next, you want to extract it on your filesystem. This toolchain is not relocatable, it needs to be installed into /usr/local/openmoko/. Now you have the following options:

  • Extract it directly as root, so use command "su" first (or prefix the tar command with "sudo" when you are using Debian/Ubuntu):

cd / tar -xjvf ~/sources/openmoko-XYZ-arm-linux-gnueabi-toolchain.tar.bz2

  • On Debian-based systems (e.g. Ubuntu), you can use alien(+fakeroot) to create an easy-to-uninstall package from this .tar.bz2:

bunzip2 openmoko-*-arm-linux-gnueabi-toolchain.tar.bz2 gzip openmoko-*-arm-linux-gnueabi-toolchain.tar fakeroot alien -d openmoko-*-arm-linux-gnueabi-toolchain.tar.gz sudo dpkg -i openmoko_*-arm-linux-gnueabi-toolchain*.deb

  • The prebuilt toolchain is for x86_64 or i686. If you wanted, you could build it on your own with OE:

bitbake meta-toolchain-openmoko

Finally, everytime you want to use this toolchain, you need to alter some environment variables, so that your tools will be found. The toolchain provides a script to do that, so the only thing you need to do is to source it. Note that if you are not using a "sh" or "bash" shell (check with "echo $SHELL") that you need to start "sh" or "bash" first.

. /usr/local/openmoko/arm/setup-env

  • At least, you should add /usr/local/openmoko/arm/bin to your $PATH variable, otherwise the next steps won't work (om-conf and make).

export PATH=$PATH:/usr/local/openmoko/arm/bin Note: This is will only last for your current session. Add it to your shell startup scripts to make it permenant (~/.bashrc for instance).

Installing New Libraries

Openmoko toolchain didn't include many libraries in default. However, it can download and install library what has already existed in Openmoko repository. (It refer to Testing Repository by default.)

  • You need to alter some environment variables before you download libraries.

. /usr/local/openmoko/arm/environment-setup

  • First, update the opkg database (Notice, you should use alias opkg-target but not opkg)

opkg-target update

  • Second, select a package what you want. Let's use edje as an example. If you want develop an project which use edje of Enlightenment, you can use opkg-target list to print out how many packages you can have. Of course, command grep will help you a lot.(Remember, you should install -dev package but not only libedje.)

opkg-target list |grep edje-dev

  • Third, install it

opkg-target install libedje-dev

  • Fourth, have a cup of coffee and wait.

Building a sample project

In a chosen destination directory (in this example ~/):

  • copy the downloaded sample application source:

cp -r /usr/local/openmoko/source/openmoko-sample2 ~/

  • Remember to set the proper environment variables (again with "sh" or "bash") for openmoko:

. /usr/local/openmoko/arm/setup-env

  • You need to create a build configuration for this application. This also checks if all needed libraries, tools, etc.. is available on your system. If this fails see the notes about the needed packages in the section "Prerequisites" mentioned earlier.

om-conf openmoko-sample2

  • Optionally now you can modify the source code in openmoko-sample2/src. Before the next step, go into the sample directory.

cd openmoko-sample2

  • If you are using an older version of the toolchain, you may have to create the makefile by running "./autogen.sh". Otherwise, to build the application from the source code just type:

make

  • If there are errors (i.e. "You need to install gnome-common from the GNOME CVS") deal with them. Also see "Troubleshooting" section at the end of this page for known issues.


If you want to install this project on host for staging usage later, a shared library, for example, you can do the following to install it into a given configured prefix. om-conf --prefix=/usr/local/openmoko openmoko-sample2 cd openmoko-sample2 make install

How to create your own project from the sample project

In order to build your own project by using openmoko-sample2 files, some changes are needed:

  • copy the downloaded sample application source

cp -r /usr/local/openmoko/source/openmoko-sample2 ~/

  • rename the folder with the name of your project (in this example your-project-name) and delete old sample files

mv openmoko-sample2 your-project-name cd your-project-name cd src rm *.c

  • copy your sources (in this example your-sources) into src/

cp your-sources . cd ..

  • now in the main folder modify autogen.sh by updating the following lines

PKG_NAME="your-project-name"

  • modify configure.ac by updating the following lines ('main.c' should be the main file in your project)

AC_INIT(your-project-name, 0.0.1, http://www.openmoko.org/) AC_CONFIG_SRCDIR(src/main.c)

  • go into data/ folder and rename these files with the name of your project

cd data mv openmoko-sample.png your-project-name.png mv openmoko-sample.desktop your-project-name.desktop

  • modify Makefile.am inside data/ by updating the following lines

dist_desktop_DATA = your-project-name.desktop dist_appicon_DATA = your-project-name.png

  • modify Makefile.in inside data/ by updating the following lines

dist_desktop_DATA = your-project-name.desktop dist_appicon_DATA = your-project-name.png

  • modify your-project-name.desktop by updating the following lines

Name=your-project-name Encoding=UTF-8 Version=0.0.1 Type=Application Exec=your-project-name

  • and by adding the following line

Icon=your-project-name

  • move into src/ folder

cd .. cd src

  • modify Makefile.am by updating the following lines

bin_PROGRAMS = your-project-name your_project_name_SOURCES = \ main.c your_project_name_LDADD = @DEPENDENCIES_LIBS@

  • be sure to put instead of main.c all your .c and .h files and modify all the '-' characters with '_' in the variable names

Packaging your application

We have included a script to make an ipkg out of your application. Note that this is not needed to test your application on the Neo (for that you can just scp the resulting binary and data over), however it's very handy if you want to distribute your application to others.

om-make-ipkg openmoko-sample2

Now you got openmoko-sample2_0.1_armv4t.ipk , you can `scp' it to your Neo and install it:

scp openmoko-sample2_0.1_armv4t.ipk root@192.168.0.202: ssh root@192.168.0.202 opkg install openmoko-sample2_0.1_armv4t.ipk

Note that while you can redistribute the generated ipkg, be aware that this is a bare-bones ipk that contains no further information, i.e. you will lack library dependencies. See below how to fix this.

You can also supply the version number, a description, and an author / contacts string in a control file:

om-make-ipkg myapp myapp_control

A template of myapp_control:

Package: $appname Version: 0.1 Description: package built by openmoko toolchain Section: openmoko/applications Priority: optional Maintainer: $USER Architecture: armv4t Homepage: http://www.openmoko.org/ Depends: Source: ${SRC}

Where to go from here

Using the external toolchain is an easy way to build applications for your Neo. If you are familiar with this procedure, you might also want to look into

Advanced topics

Building Openmoko Kernel from git repo using Toolchain

git clone git://git.openmoko.org/git/kernel.git linux-2.6 cd linux-2.6 git checkout -b mystable origin/stable cp defconfig-gta02 .config ./build

Will fail with error message "arm-angstrom-linux-gnueabi-ld: unrecognized option '-Wl,-rpath-link,/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/lib'" until /usr/local/openmoko/arm/setup-env is modified. LDFLAGS should be changed from:

export LDFLAGS="-L${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib -Wl,-rpath-link,${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib -Wl,-O1"

to:

export LDFLAGS="-L${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib -rpath-link ${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib -O1"

I also had to change the 'build' script to hardcode the path to the compiler.

Using toolchain provided libraries

Add the necessary libraries to the _LDADD field in src/Makefile.am, for example: openmoko_sample2_LDADD = @DEPENDENCIES_LIBS@ -lmokogsmd2

make sure to run om-conf again after this.

Installing additional libraries into the toolchain

Sooner or later you will want to compile an application that has dependencies which can't be fulfilled by the precompiled toolchain, e.g. some obscure libraries.

In that case, feel free to request the inclusion of additional libraries into the next release of the Openmoko toolchain. Until then, here is how you enhance your already installed toolchain. Say, we want to add the library called liburiparse:

cd ~/source wget http://downloads.sourceforge.net/uriparser/uriparser-0.6.0.tar.bz2 tar xjf uriparser-0.6.0.tar.bz2 cd uriparser-0.6.0 ./configure --host=arm-angstrom-linux-gnueabi \ --prefix=/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr make make install

That's it.

Getting your application packaged by OE

If you have written a cool application which you want to share with others, the best way to do that is to

  1. upload your application source code to a public location
  2. submit a BitBake recipe to OpenEmbedded, preferably via the OpenEmbedded bugtracker.

See also Customizing the Openmoko Distribution.

Troubleshooting

  • Some Versions of the Toolchain have corrupt .la files. If you compile an application using the Toolchain and you receive a '/space/fic/openmoko-daily/neo1973/work/armv4t-angstrom-linux-gnueabi/pango-1.18.3-r0/pango-1.18.3/pango/libpangoft2-1.0.la' error, you are affected. To fix that you should go to your "/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/lib" directory and open the affected .la files and change "/space/fic..." to "/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/lib". You have to fix more than one .la file. For the pango error you have to change "libpangocairo-1.0.la", but there are more corrupt .la files.

Attached is a beta fix for the .la problem. Untar the .tar.bz2 as root, and execute the following bash script as root:

  1. !/bin/sh

DIR=/usr/local/openmoko/arm for la in `find $DIR -iname \*.la`; do dependency_libs= . $la for lib in $dependency_libs ; do delib=`echo $lib | grep -E .la$` if [ -z $delib ] ; then echo -n elif [ -f $delib ]; then echo -n else basedelib=`basename $delib` replacedelibs=`find $DIR -iname $basedelib` found=0 for replacedelib in $replacedelibs ; do if [ $replacedelib == $delib ]; then found=1 fi done if [ $found -gt 0 ] ; then echo -n else sed_delib=`echo $delib | sed 's/\//\\\\\//g'` sed_replacedelib=`echo $replacedelib | sed 's/\//\\\\\//g'`

  1. A bit slow, we could chain expressions for speed. :)

cp $la $la.old cat $la | sed "s/$sed_delib/$sed_replacedelib/g" > $la.new mv $la.new $la rm $la.old fi fi done done