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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello!
Over the last few days I cannot succeed building an android toolchain.

Initial data:
Ubuntu 11.10 (11.04 also tried)
gcc 4.6.1
binutils-2.21.1
glibc-2.14 with glibc-ports-2.13, linuxthreads and linuxthreads_db plugins

TARGET=arm-linux-androideabi
PREFIX=/opt/android-9-toolchain/ndk/ #(not original ndk)
SYSROOT=/opt/android-9-toolchain/sysroot

SYSROOT has three symlinks to android ndk includes:
$SYSROOT/usr/include/asm -> $NDK/platforms/android-9/arch-arm/usr/include/asm
$SYSROOT/usr/include/asm-generic ->
$NDK/platforms/android-9/arch-arm/usr/include/asm-generic/
$SYSROOT/usr/include/linux ->
$NDK/platforms/android-9/arch-arm/usr/include/linux/
So, it seems like all requirements are satisfied...

Ok.

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

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

But I encountered a problem building 1st gcc. It has been configured as follows:
../configure --prefix=$PREFIX --target=$TARGET --enable-languages=c
--disable-threads
Also, "-Dinhibit_libc -D__gthr_posix_h" has been appended to the
variable TARGET_LIBGCC2_CFLAGS located in
GCC_DIR/gcc/config/arm/t-linux-androideabi. I read it would inhibit
all libc-related code during compilation...

And it ends up with following:
[............]
 the static library.  */"; echo "GROUP ( libgcc_s.so.1 libgcc.a )" ) >
armv7-a/libgcc_s.so
/opt/android-9-toolchain/ndk/arm-linux-androideabi/bin/ld: cannot find -lc
collect2: ld returned 1 exit status
make[4]: *** [libgcc_s.so] Error 1
[............]

As I understand the compilation (at least of some part) has been
succeeded, but linkage failed. Strange that linker tries to link
something with libc. There mustn't be any libc-code because of
"inhibit_libc" hack...

Have I missed something?

ANY helpful links related to building android (or even any arm)
toolchain are welcome as well.

Thank you in advance!
______________________
Alexey Umnov
umnoff@xxxxxxxxx



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux