[Scratchbox-users] How to compile glibc for ARM inside scratchbox
Stuart Winter
m-lists@biscuit.org.uk
Mon, 2 Feb 2004 18:13:05 +0000 (GMT)
Hi
If anybody is trying to compile glibc inside scratchbox but is
finding that it does not work, here's how to fix it.
You can cross compile glibc outside of scratchbox, but the problem is
that the timezone data and sunrpc header files do not get built.
What I do is to patch a few files to use the local x86 versions of the
rpcgen and localedef programs, rather than try and run them on the
ARM box over sbrsh.
I am using:
* scratchbox 0.9.7.
* Debian's glibc 2.3.2 '.orig' source with version 11 of their diff.
* Linux 2.6.1 Kernel headers that I have configured for
an ARM target.
Firstly we need to copy our existing rpcgen and localedef binaries
into scratchbox so that they can be found and executed when
inside scratchbox.
Scratchbox does have its own rpcgen but you'll find that it segfaults.
# As root on your x86 system:
( cd /usr/bin
cp -fa rpcgen localedef /scratchbox/alien_tools/
/scratchbox/tools/bin/alien_tool_links )
Now the build script.
You should run this inside scratchbox.
#!/bin/sh
ORIGPATH=/path/to/glibcdir
PKG=$HOME/glibc-package # location where we'll install the new glibc
VERSION=2.3.2 # version of glibc
# Extract & patch glibc
tar zxf ${ORIGPATH}/source/glibc_*orig*
cd glibc*
# Use the Debian script to extract glibc and overlay linuxthreads
/bin/bash prep.sh
# Install the debian directory
zcat ${ORIGPATH}/source/glibc_*diff* | patch -p1
# Patch in the Debian patches:
DPATCHES="$( grep -v '^#' debian/patches/00list )"
for pf in ${DPATCHES}; do
patchf=debian/patches/${pf}.dpatch
if [ -s ${patchf} ]; then
chmod 755 ${patchf}
${patchf} -patch glibc-${VERSION}
fi
done
cd glibc-${VERSION}
mkdir build_dir
cd build_dir
CFLAGS="-g -O2" ../configure --prefix=/usr \
--enable-add-ons=linuxthreads \
--without-cvs \
--with-headers=/${HOME}/linux-2.6.1/include
# If we use Scratchbox's rpcgen/cpp then we can build the sunrpc header
# files:
perl -pi -e 's?\$\(built-program-cmd\)?/scratchbox/tools/bin/rpcgen?;' \
sunrpc/Makefile
perl -pi -e 's?-Y ../scripts?-Y /scratchbox/compilers/bin/?;' \
sunrpc/Makefile
# Run our local x86 copy of localedef instead of the ARM version we just
# compiled:
( cd ../localedata
perl -pi -e s'?localedef=.*?localedef=/scratchbox/tools/bin/localedef;shift?;' \
gen-locale.sh tst-locale.sh
perl -pi -e s'?\${common_objpfx}locale/localedef?/scratchbox/tools/bin/localedef?;' \
tst-fmon.sh tst-trans.sh
)
make
make install install_root=${PKG}
make localedata/install-locales install_root=${PKG}
That's all you need to do. It works for me.
--
Stuart Winter
www.interlude.org.uk & www.biscuit.org.uk
| Washing machines live longer with Calgon