ld: cannot find -lc (Building gcc for Android toolchain)

Kai Ruottu kai.ruottu@wippies.com
Mon Oct 17 11:21:00 GMT 2011


17.10.2011 13:41, Alexey Umnov kirjoitti:

> Over the last few days I cannot succeed building an android toolchain.
>
> As far as I know the usual strategy of building toolchain is following:
> 1. build binutils
> 2. build 1st gcc
> 3. build libc by means of 1st gcc
> 4. build final gcc by means of 1st gcc

Not at all!

The usual strategy with already existing targets like with an installed
Android is :

1. build binutils using '--with-sysroot=$sysroot' in configure
2. copy/install/unpack the target's own C library into the chosen
    $sysroot
3. build GCC using '--with-sysroot=$sysroot' in configure

If the target's standard C library already exists, there is no sanity
in trying to replace it with something self-made. With the traditional
proprietary/custom targets like the Unices (Solaris, Ultrix, AIX, HP-UX,
Irix,...) there were no sources for their C libraries and the custom
Linux distros like Red Hat, SuSE, Debian always had their own patched
glibc...

Android is AFAIK quite a "custom" Linux and has its own patched C
library, patched GUI libraries etc. Just use them with your own
crosstoolchain, building only binutils and GCC for your cross-host!

>
> Binutils has been configured as follows:
> ../configure --prefix=$PREFIX --target=$TARGET
> , built fine and installed to $PREFIX

The '--with-sysroot=$sysroot' to point to the target C libraries was
forgotten!

Please check that in this maillist is just now another thread for
just your problem!  What I wrote, was "how things should succeed"
but the Android case seems to be harder, like giving :

configure: error: No support for this host/target combination.
make[1]: *** [configure-target-libstdc++-v3] Erreur 1

during the libstdc++-v3 configure for the target in gcc-4.6.1
sources :(



More information about the Gcc-help mailing list