%general-entities; ]> Glibc-&glibc-version; Glibc <para>The Glibc package contains the main C library. This library provides all the basic routines for allocating memory, searching directories, opening and closing files, reading and writing them, string handling, pattern matching, arithmetic, and so on.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem><seg>12.3 SBU</seg><seg>784 MB</seg></seglistitem> </segmentedlist> <segmentedlist> <segtitle>Glibc installation depends on</segtitle> <seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, Gawk, GCC, Gettext, Grep, Make, Perl, Sed, Texinfo</seg></seglistitem> </segmentedlist> </sect2> <sect2 role="installation"> <title>Installation of Glibc The Glibc build system is very well self-contained and will install perfectly, even though our compiler specs file and linker are still pointing at /tools. We cannot adjust the specs and linker before the Glibc install, because the Glibc autoconf tests would then give bogus results and thus defeat our goal of achieving a clean build. Before starting to build Glibc, remember to unset any environment variables that override the default optimization flags. The Glibc documentation recommends building Glibc outside of the source directory in a dedicated build directory: mkdir ../glibc-build cd ../glibc-build Now prepare Glibc for compilation: ../glibc-&glibc-version;/configure --prefix=/usr \ --disable-profile --enable-add-ons=nptl --with-tls \ --libexecdir=/tmp/pt_chown --without-cvs \ --with-headers=/tools/glibc-kernheaders The meaning of the new configure options: --libexecdir=/tmp/pt_chown This changes the location of the pt_chown program from its default of /usr/libexec to /tmp/pt_chown. This program isn't required on modern systems, so we install it in a place from which we will delete it later. Compile the package: make The test suite for Glibc in this section is considered critical. Our advice is to not skip it under any circumstance. Test the results: make check The test suite notes from are still very much appropriate here. Be sure to refer back there should you have any doubts. Though it is a harmless message, the install stage of Glibc will complain about the absence of /etc/ld.so.conf. Fix this annoying little warning with: touch /etc/ld.so.conf And install the package: make install The locales that can make your system respond in a different language weren't installed by the above command. Do it with this: make localedata/install-locales An alternative to running the previous command is to install only those locales which you need or want. This can be achieved by using the localedef command. Information on this can be found in the INSTALL file in the Glibc source. However, there are a number of locales that are essential for the tests of future packages to pass, in particular, the libstdc++ tests from GCC. The following instructions, instead of the install-locales target above, will install the minimum set of locales necessary for the tests to run successfully: mkdir -p /usr/lib/locale localedef -i de_DE -f ISO-8859-1 de_DE localedef -i de_DE@euro -f ISO-8859-15 de_DE@euro localedef -i en_HK -f ISO-8859-1 en_HK localedef -i en_PH -f ISO-8859-1 en_PH localedef -i en_US -f ISO-8859-1 en_US localedef -i es_MX -f ISO-8859-1 es_MX localedef -i fa_IR -f UTF-8 fa_IR localedef -i fr_FR -f ISO-8859-1 fr_FR localedef -i fr_FR@euro -f ISO-8859-15 fr_FR@euro localedef -i it_IT -f ISO-8859-1 it_IT localedef -i ja_JP -f EUC-JP ja_JP In fact, some locales installed by the make localedata/install-locales command above are not properly supported by some applications that are in LFS and BLFS books. Because of various problems that arise due to application programmers making assumptions that break in such locales, LFS should not be used in locales that utilize multibyte character sets (including UTF-8) or right-to-left writing order. Numerous unofficial and unstable patches are required to fix these problems, and it has been decided not to support such complex locales. This applies to the ja_JP and fa_IR locales as well: they have been installed only for gcc and gettext tests to pass, and e.g. the watch program (part of Procps) compiled according to this book doesn't work properly in them. Various attempts to circumvent these restrictions are documented in internationalization-related hints. Finally, build the linuxthreads man pages, which are a great reference on the threading API (applicable to NPTL as well): make -C ../glibc-&glibc-version;/linuxthreads/man And install these pages: make -C ../glibc-&glibc-version;/linuxthreads/man install Configuring Glibc /etc/nsswitch.conf /etc/localtime We need to create the /etc/nsswitch.conf file, because, although Glibc provides defaults when this file is missing or corrupt, the Glibc defaults don't work well with networking. Also, our time zone needs to be set up. Create a new file /etc/nsswitch.conf by running the following: cat > /etc/nsswitch.conf << "EOF" # Begin /etc/nsswitch.conf passwd: files group: files shadow: files hosts: files dns networks: files protocols: files services: files ethers: files rpc: files # End /etc/nsswitch.conf EOF To find out what time zone you're in, run the following script: tzselect When you've answered a few questions about your location, the script will output the name of your time zone, something like EST5EDT or Canada/Eastern. Then create the /etc/localtime file by running: cp --remove-destination /usr/share/zoneinfo/Canada/Eastern /etc/localtime The meaning of the option: --remove-destination This is needed to force removal of the already existing symbolic link. The reason why we copy instead of symlink is to cover the situation where /usr is on a separate partition. This could matter, for example, when booted into single user mode. Of course, instead of Canada/Eastern, fill in the name of the time zone that the tzselect script gave you. Configuring Dynamic Loader /etc/ld.so.conf By default, the dynamic loader (/lib/ld-linux.so.2) searches through /lib and /usr/lib for dynamic libraries that are needed by programs when you run them. However, if there are libraries in directories other than /lib and /usr/lib, you need to add them to the /etc/ld.so.conf file for the dynamic loader to find them. Two directories that are commonly known to contain additional libraries are /usr/local/lib and /opt/lib, so we add those directories to the dynamic loader's search path. Create a new file /etc/ld.so.conf by running the following: cat > /etc/ld.so.conf << "EOF" # Begin /etc/ld.so.conf /usr/local/lib /opt/lib # End /etc/ld.so.conf EOF Contents of Glibc Installed programs Installed libraries catchsegv, gencat, getconf, getent, glibcbug, iconv, iconvconfig, ldconfig, ldd, lddlibc4, locale, localedef, mtrace, nscd, nscd_nischeck, pcprofiledump, pt_chown, rpcgen, rpcinfo, sln, sprof, tzselect, xtrace, zdump and zic ld.so, libBrokenLocale.[a,so], libSegFault.so, libanl.[a,so], libbsd-compat.a, libc.[a,so], libc_nonshared.a, libcrypt.[a,so], libdl.[a,so], libg.a, libieee.a, libm.[a,so], libmcheck.a, libmemusage.so, libnsl.a, libnss_compat.so, libnss_dns.so, libnss_files.so, libnss_hesiod.so, libnss_nis.so, libnss_nisplus.so, libpcprofile.so, libpthread.[a,so], libresolv.[a,so], librpcsvc.a, librt.[a,so], libthread_db.so and libutil.[a,so] Short descriptions catchsegv catchsegv can be used to create a stack trace when a program terminates with a segmentation fault. gencat gencat generates message catalogues. getconf getconf displays the system configuration values for file system specific variables. getent getent gets entries from an administrative database. glibcbug glibcbug creates a bug report and mails it to the bug email address. iconv iconv performs character set conversion. iconvconfig iconvconfig creates fastloading iconv module configuration file. ldconfig ldconfig configures the dynamic linker runtime bindings. ldd ldd reports which shared libraries are required by each given program or shared library. lddlibc4 lddlibc4 assists ldd with object files. locale locale is a Perl program that tells the compiler to enable or disable the use of POSIX locales for built-in operations. localedef localedef compiles locale specifications. mtrace mtrace ... nscd nscd is a name service cache daemon providing a cache for the most common name service requests. nscd_nischeck nscd_nischeck checks whether or not secure mode is necessary for NIS+ lookup. pcprofiledump pcprofiledump dumps information generated by PC profiling. pt_chown pt_chown is a helper program for grantpt to set the owner, group and access permissions of a slave pseudo terminal. rpcgen rpcgen generates C code to implement the RPC protocol. rpcinfo rpcinfo makes an RPC call to an RPC server. sln sln is used to make symbolic links. The program is statically linked, so it is useful for making symbolic links to dynamic libraries if the dynamic linking system for some reason is nonfunctional. sprof sprof reads and displays shared object profiling data. tzselect tzselect asks the user about the location of the system and reports the corresponding time zone description. xtrace xtrace traces the execution of a program by printing the currently executed function. zdump zdump is the time zone dumper. zic zic is the time zone compiler. ld.so ld.so is the helper program for shared library executables. libBrokenLocale libBrokenLocale is used by programs, such as Mozilla, to solve broken locales. libSegFault libSegFault is a segmentation fault signal handler. It tries to catch segfaults. libanl libanl is an asynchronous name lookup library. libbsd-compat libbsd-compat provides the portability needed in order to run certain BSD programs under Linux. libc libc is the main C library -- a collection of commonly used functions. libcrypt libcrypt is the cryptography library. libdl libdl is the dynamic linking interface library. libg libg is a runtime library for g++. libieee libieee is the IEEE floating point library. libm libm is the mathematical library. libmcheck libmcheck contains code run at boot. libmemusage libmemusage is used by memusage to help collect information about the memory usage of a program. libnsl libnsl is the network services library. libnss* libnss* are the Name Service Switch libraries, containing functions for resolving host names, user names, group names, aliases, services, protocols,and the like. libpcprofile libpcprofile contains profiling functions used to track the amount of CPU time spent in which source code lines. libpthread libpthread is the POSIX threads library. libresolv libresolv contains functions for creating, sending, and interpreting packets to the Internet domain name servers. librpcsvc librpcsvc contains functions providing miscellaneous RPC services. librt librt contains functions providing most of the interfaces specified by the POSIX.1b Realtime Extension. libthread_db libthread_db contains functions useful for building debuggers for multi-threaded programs. libutil libutil contains code for "standard" functions used in many different Unix utilities.