Ubuntu – How to build older gcc versions? Errors about crti.o not being found


How can I build an older gcc (specifically, 4.5.2) on Ubuntu 11.10 and avoid errors about "/usr/bin/ld: cannot find crti.o: No such file or directory"?

I've done a bit of digging and found several similar items, but none that actually resolve my issue:

  • I've verified all my packages (libc6-dev and the like) are re-installed per this question
  • I've verified crti.o exists in /usr/lib32 and /usr/lib/x86_64-linux-gnu, and that my ld.so.conf is configured to look in those directories
  • I've verified that prepending my make invocation with LIBRARY_PATH=/usr/lib/x86_64-linux-gnu works, but would like to avoid this (it becomes a diverging point in makefiles)
  • I've tried various things with –with-build-sysroot, but with no success (read: maybe I just don't know the right flag to set)
  • When running with strace (as per this answer), I can see the bare reference to crti.o:

    13240 open("crti.o", O_RDONLY) = -1 ENOENT (No such file or directory)


Best Answer

I had the same problem. Making symbolic links from /usr/libs/crt?.o to /usr/lib/x86_64-linux-gnu/crt?.o solved the problem for me.

Related Question