Why can I not build a lower version compiler

2019-07-27 01:44发布

问题:

I am currently trying to build a gcc 4.4 on a newly updated ubuntu 11.10. However building the compiler always fails with some problems, when trying to bootstrap.

First crti.o and crtn.o could not be found. I symlinked them into another directory within the search path, and so I could get a bootstrap compiler. However now it fails with the message:

configure: error: C compiler cannot create executables

I tried out to use the intermediate compiler on a simple test program, and I get the message:

$ ./host-x86_64-unknown-linux-gnu/prev-gcc/xgcc test.c
xgcc: error trying to exec 'cc1': execvp: File or directory not found

So something is seriously messed up with the paths of my intermediate compiler it seems. When I did the same thing on ubuntu 11.04 everything just worked fine.

I used the following command line to configure:

./configure --prefix=/opt --program-suffix=44

I also tried both a VPATH-built, as well as an in source build, but both have the same problem. I still have the gcc44 from before the update lying around within /opt, but it has become unusable since the update.

Is there any easy way to get gcc 4.4 working under Ubuntu 11.10? I does not have to be a self build compiler, if I can just download a package and install that, it would be fine as well.

回答1:

This is caused by Ubuntu's switch to multi-arch. Basically all the "standard" paths have been changed so you can install libraries for multiple architectures on the same machine without any clashes.

Ubuntu GCC has been patched to fix the problem, of course, but the upstream compiler still wasn't fixed last time I checked.

See here: https://askubuntu.com/questions/69365/cant-build-gcc-anymore-since-upgrade-to-11-10