2012年10月5日 星期五

Build glibc for arm linux (not finish yet)


Just a simple memo for what I am doing now.....

Host OS: Ubuntu 11.10
Download "Sourcery CodeBench Lite Edition for ARM GNU/Linux" from Mentor Graphics® and follow these steps to build toolchain for arm-linux.
1. Untar every package from "Sourcery CodeBench Lite Edition for ARM GNU/Linux".

2. Environment setting
# obj - build directory
# tools - toolchain
# utils - libraries needed by host environment
# sysroot - the files to be installed to target system

obj=$top/obj
tools=$top/tools
sysroot=$top/sysroot
utils=$top/utils
build=i686-linux-gnu

3. Build gmp
configure \
    ABI="32" --build=$build --prefix=$utils \
    --disable-shared
make check
make install

4. Build mpfr
configure \
    --prefix=$utils --with-gmp=$utils --disable-shared
make check
make install

5. Build mpc
configure \
    --prefix=$utils --with-gmp=$utils \
    --with-mpfr=$utils --disable-shared
make check
make install

6. Build binutils
configure \
    --build=$build --host=$host --target=$target \
    --prefix=$tools --enable-shared \
    --with-sysroot=$sysroot --disable-nls \
    --disable-poison-system-directories
make configure-host
make LDFLAGS="all-static"
make install

7. Build first gcc
configure \
LDFLAGS=-static \
    --build=$build --host=$host --target=$target \
    --prefix=$tools --disable-shared \
    --disable-threads --disable-libssp \
    --disable-libgomp --disable-libmudflap \
    --enable-poison-system-directories \
    --enable-add-ons=ports \
    --with-gmp=$utils \
    --with-mpfr=$utils \
    --with-mpc=$utils \
    --without-headers --with-newlib \
    --enable-languages=c \
    --disable-libquadmath
PATH=$tools/bin:$PATH make
PATH=$tools/bin:$PATH make install

There is a configure error when "libquadmath" was enabled. I found some discussions and workaround[1-2] about this issue, but none of them work on my environment. And I  have no idea how to fix this issue, so I just disable it, lol.

Then, there is another problem,
checking sysdep dirs... configure: error: The arm is not supported.
if you issue this problem, just link glibc-ports into glibc directory as ports and add "--enable-add-ons=ports" into configure parameter.[3]

TO BE CONTINUE...




[1] Problem Building cross GCC 4.6.0
[2] GCC_NO_EXECUTABLES vs. libtool
[3] Re: checking sysdep dirs... configure: error: The arm is not supported