Next Previous Contents

6. Installing the GNU C and C++ Libraries

6.1 Preparing the system for the GNU C Library installation

In this section we're going to install Glibc. But before we'll be able to install these libraries, we need to have a bunch of other software installed on the LFS system. Therefore all these programs need to be linked statically. This means quite a bit of extra work, because after Glibc and the GNU CC compilers are installed, we're going to re-install all these programs so they'll be linked dynamically. If somebody knows of a better way to accomplish this, without first building all the software statically and then rebuild them dynamically, please let me know.

I know of one other way and that's by installing Glibc using pre-compiled binaries. But that would be directly against what we're doing here. So that's not an option.

All software that is being installed in this section will be compiled on our normal working Linux system and then copied to the LFS system.

You'll notice that the installation of this software is very straightforward is most cases. I also won't explain what this software does, since it's all trivial software and if you don't know what some program does, you can always read the README file and other documentation.

Installing Make

Installing Sed

There is a possibility you will experience compilation problems. If this is the case, you can download a fixed version of this package from the following URL: http://tts.ookhoi.dds.nl/lfs-howto/download/sed-3.02-lfs.tar.gz

Installing Shell Utils

Installing File Utils

Installing Util Linux

Installing Text Utils

Installing Tar

After compiling the programs in the src directory you will have two programs: tar and rmt. Tar is obvious. Rmt stands for ReMote Tapeserver. If you don't need this program (ie; you don't have a tapestreamer in your network or on your machine) then you don't need to copy this program.

Installing Gzip

There is a possibility you will experience compilation problems. If this is the case, you can download a fixed version of this package from the following URL: http://tts.ookhoi.dds.nl/lfs-howto/download/gzip-1.2.4-lfs.tar.gz

Installing Binutils

Installing Grep

There is a possibility you will experience compilation problems. If this is the case, you can download a fixed version of this package from the following URL: http://tts.ookhoi.dds.nl/lfs-howto/download/grep-2.2-lfs.tar.gz

Installing Bison

Installing Mawk

Installing Find Utils

There is a possibility you will experience compilation problems. If this is the case, you can download a fixed version of this package from the following URL: http://tts.ookhoi.dds.nl/lfs-howto/download/findutils-4.1-lfs.tar.gz

Installing Diff Utils

There is a possibility you will experience compilation problems. If this is the case, you can download a fixed version of this package from the following URL: http://tts.ookhoi.dds.nl/lfs-howto/download/diffutils-2.7-lfs.tar.gz

Installing Ld.so

Installing Perl

You can stick to all the default questions, except to the following.

When asked What is the file extension used for shared libraries? [so]

Answer with: none

When asked Any additional ld flags (NOT including libraries)? [-L/usr/local/lib]

Answer with: -L/usr/local/lib -static

When asked Do you wish to use dynamic loading? [y]

Answer with: n

Installing M4

There is a possibility you will experience compilation problems. If this is the case, you can download a fixed version of this package from the following URL: http://tts.ookhoi.dds.nl/lfs-howto/download/m4-1.4-lfs.tar.gz

Installing Texinfo

Installing Automake

Installing Autoconf

6.2 Installing the GNU C Library

We're not going to installed the latest Glibc version, 2.1.2, but version 2.0.7pre6. The reason is that glibc 2.1.2 requires at least gcc 2.8 (or egcs 1.1). My system has gcc 2.7.2.3 thus I can't compile the glibc2.1.2 library. And I also don't want to upgrade my working Linux system to gcc 2.95.2 (which is the latest version at the time of writing this document). Upgrading a compiler isn't as easy as it sounds and I don't want to break things on this working system.

So therefore I have to install glibc 2.0.7pre6. However, we are going to install the gcc 2.95.2 compiler. We also need to install the gcc 2.7.2.3 compiler because certain software can't be compiled with gcc 2.95.2 (due to bugs in the programs that aren't really bugs but the gcc 2.95.2 compiler defines them as bugs. This is not a bug in the compiler, but changes in the C standard (if I understood it correctly)).

A note on the glibc-crypt package. The following is quoted from the glibc-crypt-README file on ftp://ftp.gnu.org/gnu/glibc:

-*-*-*-*-*-
The add-on is not included in the main distribution of the GNU 
C library because some governments, mostly notable those of 
France, Russia and the US, have very restrictive rules 
governing the distribution and use of encryption software. 
Please read the node "Legal Problems" in the manual for more 
details.
 
In particular, the US does not allow export of this software 
without a license, including via the Internet. So please do not 
download it from the main FSF FTP site at ftp.gnu.org if you 
are outside of the US. This software was completely developed 
outside the US.
-*-*-*-*-*-

"This software" refers to the glibc-crypt package at ftp://ftp.gwdg.de/pub/linux/glibc/2.0.7pre6/. This law only affects people who don't live in the US. It's not prohibited to import DES software, so if you live in the US you can import it from that German site.

# Begin configparms
prefix=/usr
slibdir=/lib
sysconfdir=/etc
# End configparms

You can check if the GNU C Library seems to be working by running a dynamically linked program that uses this library (like almost every program). A simple test is running the ls program that resides in the bin directory on your normal Linux partition. If you can run this program without any errors, then the GNU C Library seems to be installed correctly.

Please not that if your normal Linux system uses a differnet library version that the one you just installed on your LFS system, that program will most likely crash and reported a 'Segmentation Fault' or something similar. If so, just continue with the installation of the C++ Library and the compilers. After the compilers are done you will compile a small test program and execute it for the sake of testing the compiler. If those two little programs execute without crashing, it means that 1) the compiler works 2) the C Library works too. So don't worry too much right now if programs from your normal Linux system don't work due to C Library incompatibilities.

6.3 Installing the GNU C++ Library

If you have used a previous version of this HOWTO to install an LFS system and you wish to update your LFS system conforming the changes made in this version of the HOWTO, you first need to remove the existing files regarding the previously installed C++ library before continuing with this section.

This HOWTO used to install the C++ library from sources, but that has been changed and is an exception. The C++ library is installed from pre-compiled binaries. The reason is that I have not been able to find the sources for the C++ library version that I prefer to use. So until then we'll use pre-compiled binaries.

Installing the libstdc++2.9_2.91.66-0slink2.deb package

Installing the libstdc++2.9-dev_2.91.66-0slink2.deb package


Next Previous Contents