I try to compile a new gcc, including binutils and glibc. Since I can not be root, I want to install it all in ~/local. I set these variables:

PREFIX=~/local && export PREFIX
PATH=~/local/bin:$PATH && export PATH

I built binutis, gcc and glibc (in exactly this order), with this configuration:

../binutils-2.22/configure --prefix=$PREFIX --with-sysroot
../gcc-4.7.3/configure --prefix=$PREFIX
CC='gcc --sysroot=~/local' ../glibc-2.15/configure  --prefix=$PREFIX

My idea was that I'd first compile binutils, then compile a gcc which is linked with the new binutils, and finally, the two compile glibc (without need of my system's glibc of /usr/lib).

However, after binutils and gcc were compiled and installed correctly, gcc fails to compile a simple program while configuring glibc:

int main() { return 0; }

Output (shortened):

> gcc --sysroot=~/local/ test.cpp -o test
ld: cannot find crt1.o: No such file or directory
ld: cannot find crti.o: No such file or directory
ld: cannot find -lc
ld: cannot find crtn.o: No such file or directory

However, this displays no files:

find ~/local -name crti.o

Did I configure anything wrong?

My system is a server running a 64 bit Ubuntu 12.04 ("precise"), but I think it is not system related. The versions of the three toolchain components should fit each other, since openSuSE 12.2 has this combination.

  • 2
    Once I had almost the same issue except only I had to use the latest clang and the latest glibc. This post was quite useful for me: stackoverflow.com/a/851229/184968.
    – user17530
    Nov 25, 2013 at 14:33
  • @skwllsp I think setting the paths or something similar is not going to help, because a crti.o is not existing (I've updated this in my post).
    – Johannes
    Nov 25, 2013 at 16:00
  • Don't use ~ but $HOME in your PREFIX and PATH, e.g. export PATH=$HOME/local/bin:$PATH Sep 5, 2017 at 23:24

1 Answer 1


You must add libc_cv_forced_unwind=yes libc_cv_c_cleanup=yes to the glibc's configure command to avoid configure trying to build and run test programs and choking on that. The problem is that the files crt1.o, crti.o, libc.{a,so} and crtn.o are all part of the glibc library that you haven't installed yet.

Learned from Linux From Scratch: article on glibc

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .