public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alexey Umnov <umnoff@gmail.com>
To: gcc-help@gcc.gnu.org
Subject: ld: cannot find -lc (Building gcc for Android toolchain)
Date: Mon, 17 Oct 2011 10:42:00 -0000	[thread overview]
Message-ID: <CAL2H9vDQGV5riPYkPi0NvtBYAytrePR7TBXywXwZmb9ViuiPng@mail.gmail.com> (raw)

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@gmail.com

             reply	other threads:[~2011-10-17 10:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-17 10:42 Alexey Umnov [this message]
2011-10-17 11:21 ` Kai Ruottu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAL2H9vDQGV5riPYkPi0NvtBYAytrePR7TBXywXwZmb9ViuiPng@mail.gmail.com \
    --to=umnoff@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).