» | Kernel Trees | |||||
» | Tebecai | |||||
frodo.looijaard.name | » | Documentation | » | Glibc-2 (libc6) | » | Preliminaries |
» | Copyrights | |||||
» | Introduction | |||||
» | Other docs | |||||
» | Overview | |||||
» | Downloads | |||||
» | gcc | |||||
» | ld.so | |||||
» | binutils | |||||
» | libc6 | |||||
» | gcc (cross) | |||||
» | libc5 | |||||
» | libc++ | |||||
» | Cleaning up | |||||
» | Examples | |||||
» | Going on | |||||
» | Known problems | |||||
» | Essay | |||||
» | Changelog |
Note that this documentation is historic. It may no longer be very relevant. There will be no updates or further releases.
⇐ Previous | ⇑ Parent |
Next ⇒ |
Before starting to compile, you must determine your host system, your target system and the aliases you want to use for the last two. It is also useful to determine the object file format you use. Of course you must also download the sources.
If you have GCC installed (and if not, you should read another document altogether), you have a default target installed, which is very probable the same as your current system. One way to find it, is to call gcc
with the -v
flag. On my system, the output was as follows:
(bash) gcc -v
Reading specs from /usr/lib/gcc-lib/i486-linux/2.7.2.1/specs
gcc version 2.7.2.1
This tells you that you use version 2.7.2.1 of gcc, and your system is called i486-linux. But, for the newer versions of gcc, the name has probably changed. A better way is to unpack the gcc source you want to install (remember, version 2.7.2.3 or better!) and to run config.guess
(which can be found in the main directory of the package):
(bash) ./config.guess
i486-unknown-linux-gnulibc1
This is also known as the canonical configuration name. There are several aliases for it, and one way to translate an abbreviation to a canonical name is to run config.sub
with the alias:
(bash) ./config.sub i486-linux
i486-unknown-linux
Note that the above configuration, as of gcc 2.7.2.3, is a linux system with glibc-2 installed; which will be our target system, but is not our host system!
A canonical name consists of several parts, separated by dashes. The first part is the cpu type, the second part is the company which made the system (we will use pc for that), and the third part is the system. A fourth part can be present to differentiate setups in a way the first three can not.
One of the things we will do is update your compiler to the newest version. If you have a version older than gcc 2.7.0 installed, this is very important (it may contain some nasty bugs).
When we are going to recompile gcc, we must know for what default target we will configure it. This is the target that will be used if we do not cross-compile, but want to compile applications with old libc-5. The target you should choose is very probable that which config.guess
returns. You can safely change the i?86
part; all ix86 targets are compatible, the only difference is the way code is optimised. Write this target (which corresponds to your host system) down somewhere now. Note that it must end with -gnulibc1
.
Now we want to find the name of the libc-6 target. If you have determined the new host system name in the previous paragraph, all you have to do is remove the -gnulibc1
part and replace it with -gnu
. After all, your host and target system are the same, and only differ in the use of libc-5 or libc-6. Write this name down, too.
Personally, I find the names gcc recognizes not very nice. They can be confusing, too, as for example the alias i486-linux has changed its meaning between versions 2.7.2.2 and 2.7.2.3. Fortunately, it is relatively easy to choose your own names. I will show you a method of compiling gcc and other programs that allows you to freely choose these names. It is of course sensible to use names that are easy to recognize. Choose now your alias names for both host and target systems.
These are the canonical names and their aliases used throughout this document. You should decide upon your own names before progressing.
Host | Target | |
---|---|---|
Canonical Name | i486-pc-linux-gnulibc1 | i486-pc-linux-gnu |
Alias name | i486-linux-libc5 | i486-linux-libc6 |
⇐ Previous | ⇑ Parent |
Next ⇒ |