Using the cross-compiler
Initial steps
Mounting the proc filesystem
If you have chrooted inside the environment, you need the /proc filesystem to be mounted there as well:
# mount /proc
Configuring the network
It may be necessary to configure /etc/resolv.conf with your own DNS servers, to ensure good connectivity, even within the chrooted environment. You may simply copy it from your native system:
# cp /etc/resolv.conf cross/etc/resolv.conf
In a virtual machine, you will have to configure the environment like a regular Debian system. Please refer to the official Debian documentation for this.
File your name and email in
in /root/.bashrc, you can specify your name and your email. the following lines are already in it, commented:
export DEBFULLNAME="Foo Bar" export DEBEMAIL="foo@bar.org"
These will be used by some helpers and debian scripts.
Obtaining sources
You should then be able to fetch hackable:1's sources as usual:
# svn co svn://svn.hackable1.org/hackable1
Next steps
Now you can look at the CrossCompiler/Compiling and CrossCompiler/DebianPackage parts.
Known problems
After this basic setup is done, some fixes are to be applied:
The package database is not stable
It seems some dependencies are not fully fulfilled during the image generation. It is therefore recommended to run this before upgrading:
# apt-get update # apt-get -f install
If installing texlive-doc-base fails and complains about /etc/texmf/updmap.d/00updmap.cfg missing, reinstall tex-common, as it contains this file: # apt-get --reinstall install tex-common (see #356)
usb0 is configured at boot
The /etc/network/interfaces file should be tweaked to configure eth0 only, with a DHCP client by default.
pkg-config is too old
The version of pkg-config available in Debian (0.22) is too old to support the PKG_CONFIG_SYSROOT_DIR environment variable (introduced in 0.23). A bug report was already filed in the Debian database: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=476947
As mentioned there, we have packaged and patched it in hackable:1, it is found in the daily builds:
deb http://build.hackable1.org/debian wip main
Otherwise, it is possible to install it from source:
$ wget http://pkg-config.freedesktop.org/releases/pkg-config-0.23.tar.gz $ tar -xzvf pkg-config-0.23.tar.gz $ cd pkg-config-0.23 $ wget -O - http://lists.freedesktop.org/archives/pkg-config/attachments/20080122/424351fe/attachment.ksh | patch -p1 $ ./configure $ make install
The patch applied was posted here: http://lists.freedesktop.org/archives/pkg-config/2008-January/000255.html
No easy way to update the cross-compilation environment
This will bite us soon enough: it is not possible to use apt-get to update the target cross-compilation environment. The easiest work-around for now is to uncompress a newer developer archive there, eg for the Openmoko Freerunner:
# wget http://build.hackable1.org/Hackable1-Openmoko-Freerunner-developer-daily.tar.gz # tar -xzvpf Hackable1-Openmoko-Freerunner-developer-daily.tar.gz -C /usr/arm-linux-gnueabi
You can also fetch the armel packages at http://packages.debian.org and uncompress them with:
dpkg -X package.deb /usr/arm-linux-gnueabi
Alternatively, you can cross-compile missing packages with package.sh, as they are automatically installed within the cross-compilation environment after a successful build. This is done with dpkg -X, but it doesn't populate /var/lib/dpkg/info or run post-installation scripts as required.
gtk-doc-tools doesn't work
First, make sure you have used the --enable-gtk-doc option to ./configure if supported (eg libmokoui2).
On the daily builds /etc/xml is not handled correctly yet. Please refer to /var/lib/dpkg/info/docbook-x{m,s}l.postinst for more information as to what to do.
Quick and dirty fix:
# apt-get remove --purge docbook-xml docbook-xsl # apt-get install gtk-doc-tools
IOError: [Errno 2] No such file or directory: '/gdk-types.defs' while generating python bindings
This means python-gtk2-dev armel cross version is not properly installed in the environment.
# apt-cross -a armel -i python-gtk2-dev
will fix this issue.
The cross compiler environment build via latest ./build.sh use unavailable gcc-4.4-base-armel-cross
(Solved by now, kept for reference.)
# apt-get update # apt-get -f install
will remove : g++-4.3-arm-linux-gnueabi gcc-4.3-arm-linux-gnueabi libc6-armel-cross libgcc1-armel-cross libstdc++6-4.3-dev-armel-cross libstdc++6-armel-cross
The workaround is to install apt-cross and use it to reinstall proper cross compiler toolchain:
# apt-get install apt-cross # apt-cross -a armel -v -i gcc g++
Then install emdebian-tools and configure it :
# apt-get install emdebian-tools # dpkg-reconfigure dpkg-cross
choose "armel" as architecture
# dpkg-reconfigure emdebian-tools # dpkg-reconfigure emdebian-rootfs
choose "stable" at stage 4 of the reconfigure process. Add the lenny source repository to /etc/apt/sources.list "deb-src http://ftp2.de.debian.org/debian lenny main" Then update apt lists:
# apt-get update
Then rebuild the toolchain via emchain:
# cd # mkdir toolchain # emchain -w toolchain -v -l -f
Install the dependencies for to build gcc-4.3:
# apt-get install gcc-multilib libc6-dev-amd64 lib64gcc1 autogen gawk dejagnu gperf libmpfr-dev sharutils realpath chrpath doxygen graphviz gsfonts-x11 texlive-latex-base # apt-cross -a armel -i libgcc1-dbg libobjc2 libdb1-compat
After it completes building and installing binutils, run it again to get gcc and g++ for the root of the chroot.
# emchain -w toolchain -v -l -f
this is needed because the detection of the gcc directory is not perfect yet and the workaround is run at the start of the script. Thus it needs the source of gcc to be downloaded which happens too late in the process. A second run get around this shortcoming.
