gcc <-> glibc circular dependency? FAQ for embedded systems

Apr 27, 2005 3 Replies

Hi all,


I've googled this topic and found numerous people in my circumstance but did not find a clear concise answer on how to develop the toolchain for cross-compiling when gcc seems to depend on glibc and glibc depends on gcc.


Sorry, that was clear as mud. Here's what I am trying to do, following Karim Yaghmour's book. I am trying to compile gcc-4.0.0 and glibc-2.3.5. The _bootstrap_ gcc that I create cannot compile any C program (such as "main() {return 0;}") because it does not find crt1.o.



I believe crt1.o is part of glibc, which I would compile next, except that during its configuration, it invokes my recently built gcc and fails to configure.



Here's how I configure gcc (I've also tried --with-newlib, without



--enable-bootstrap, without enable-cross and recompiled gcc in each case). I am sure I've to change the confiure options somehow so that the newly built gcc does not look for crt1.o, but how do I do that?



./i386-linux-gcc -v Using built-in specs. Target: i386-linux Configured with: /build-tools/gcc-4.0.0/configure --target=i386-linux



--prefix=/mypath/tools --disable-shared --enable-cross



--with-headers=/mypath/tools/i386-linux/include --without-newlib



--without-glibc --enable-languages=c --enable-bootstrap Thread model: posix gcc version 4.0.0


gcc compilation and install goes through fine (commands were 'make all-gcc ; make install-gcc' - should I be using something else here?). Next I try to configure glibc:


../glibc-2.3.5/configure --host=$TARGET --prefix="/usr"



--enable-add-ons --enable-static-nss



--with-headers=$TARGET_PREFIX/include


This fails, config.log shows


configure:7072: test -s conftest.o configure:7075: $? = 0 configure:7086: result: yes configure:7089: checking size of long double configure:7408: i386-linux-gcc -o conftest -g -O2 conftest.c >&5 /mypath/tools/lib/gcc/i386-linux/4.0.0/../../../../i386-linux/bin/ld: crt1.o: No such file: No such file or directory collect2: ld returned 1 exit status configure:7411: $? = 1 configure: program exited with status 1


And sure enough, there's no crt1.o in the entire toolchain yet. How do I configure/compile glibc or anything else using my new gcc?


- Knight.



Knight,

Have you seen this?

formatting link

The webpage should answer all your questions, and the cross-tool should solve your build problems.

-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Damion de Soto - Software Engineer email: snipped-for-privacy@snapgear.com SnapGear - A CyberGuard Company --- ph: +61 7 3435 2809 | Custom Embedded Solutions fax: +61 7 3891 3630 | and Security Appliances web:

formatting link
--- Free Embedded Linux Distro at
formatting link
---

See

formatting link

-- Cecil

Thanks for the link. I ended up using Dan Kegel's crosstool

formatting link
- an enormous timesaver. So now, I am at gcc v 3.4.3, glibc v 2.3.5, binutils v 2.16 and the cross-compiler toolchain seems to be working. Alas, the linux-2.6.10 kernel I builld has 'unresolved symbols' in vmlinux, namely - sys_add_key and 2 others. I take it that the final build of vmlinux is not supposed to have any unresolved symbols, right?

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required