OnWorks Linux and Windows Online WorkStations

Logo

Free Hosting Online for WorkStations

< Previous | Contents | Next >

6.9.1. Installation of Glibc


Note

The Glibc build system is self-contained and will install perfectly, even though the compiler specs file and linker are still pointing to /tools. The specs and linker cannot be adjusted before the Glibc install because the Glibc autoconf tests would give false results and defeat the goal of achieving a clean build.

Note

The Glibc build system is self-contained and will install perfectly, even though the compiler specs file and linker are still pointing to /tools. The specs and linker cannot be adjusted before the Glibc install because the Glibc autoconf tests would give false results and defeat the goal of achieving a clean build.

Some of the Glibc programs use the non-FHS compilant /var/db directory to store their runtime data. Apply the following patch to make such programs store their runtime data in the FHS-compliant locations:


patch -Np1 -i ../glibc-2.30-fhs-1.patch

patch -Np1 -i ../glibc-2.30-fhs-1.patch


Fix a problem introduced with the linux-5.2 kernel:


sed -i '/asm.socket.h/a# include <linux/sockios.h>' \ sysdeps/unix/sysv/linux/bits/socket.h

sed -i '/asm.socket.h/a# include <linux/sockios.h>' \ sysdeps/unix/sysv/linux/bits/socket.h


image

-sfv

-sfv

-sfv

-sfv

../lib/ld-linux-x86-64.so.2 /lib64

../lib/ld-linux-x86-64.so.2 /lib64/ld-lsb-x86-64.so.3

../lib/ld-linux-x86-64.so.2 /lib64

../lib/ld-linux-x86-64.so.2 /lib64/ld-lsb-x86-64.so.3

Create a symlink for LSB compliance. Additionally, for x86_64, create a compatibility symlink required for the dynamic loader to function correctly:


case $(uname -m) in

case $(uname -m) in


i?86) ln

;;

x86_64) ln

ln

;;

esac

-sfv

ld-linux.so.2 /lib/ld-lsb.so.3

i?86) ln

;;

x86_64) ln

ln

;;

esac

The Glibc documentation recommends building Glibc in a dedicated build directory:


mkdir -v build cd build

mkdir -v build cd build


image

Prepare Glibc for compilation:


CC="gcc -ffile-prefix-map=/tools=/usr" \

../configure --prefix=/usr

--disable-werror

--enable-kernel=3.2

--enable-stack-protector=strong

--with-headers=/usr/include libc_cv_slibdir=/lib

\

\

\

\

\

CC="gcc -ffile-prefix-map=/tools=/usr" \

../configure --prefix=/usr

--disable-werror

--enable-kernel=3.2

--enable-stack-protector=strong

--with-headers=/usr/include libc_cv_slibdir=/lib


The meaning of the options and new configure parameters:


CC="gcc -ffile-prefix-map=/tools=/usr"

Make GCC record any references to files in /tools in result of the compilation as if the files resided in /usr. This avoids introduction of invalid paths in debugging symbols.

--disable-werror

This option disables the -Werror option passed to GCC. This is necessary for running the test suite.

--enable-stack-protector=strong

This option increases system security by adding extra code to check for buffer overflows, such as stack smashing attacks.

--with-headers=/usr/include

This option tells the build system where to find the kernel API headers. By default, those headers are sought in

/tools/include.

libc_cv_slibdir=/lib

This variable sets the correct library for all systems. We do not want lib64 to be used.

Compile the package:


make

make


Important

In this section, the test suite for Glibc is considered critical. Do not skip it under any circumstance.

Important

In this section, the test suite for Glibc is considered critical. Do not skip it under any circumstance.


image

image

image

/lib ;;

/lib ;;

-sfnv $PWD/elf/ld-linux-x86-64.so.2 /lib ;;

-sfnv $PWD/elf/ld-linux-x86-64.so.2 /lib ;;

Generally a few tests do not pass. The test failures listed below are usually safe to ignore.


case $(uname i?86) ln x86_64) ln

esac

-m) in

-sfnv $PWD/elf/ld-linux.so.2

case $(uname i?86) ln x86_64) ln

esac


Note

The symbolic link above is needed to run the tests at this stage of building in the chroot envirnment. It will be overwritten in the install phase below.

Note

The symbolic link above is needed to run the tests at this stage of building in the chroot envirnment. It will be overwritten in the install phase below.


make check

make check

You may see some test failures. The Glibc test suite is somewhat dependent on the host system. This is a list of the most common issues seen for some versions of LFS:

misc/tst-ttyname is known to fail in the LFS chroot environment.

inet/tst-idna_name_classify is known to fail in the LFS chroot environment.

posix/tst-getaddrinfo4 and posix/tst-getaddrinfo5 may fail on some architectures.

• The nss/tst-nss-files-hosts-multi test may fail for reasons that have not been determined.


• The rt/tst-cputimer{1,2,3} tests depend on the host system kernel. Kernels 4.14.91–4.14.96, 4.19.13–4.19.18, and 4.20.0–4.20.5 are known to cause these tests to fail.

• The math tests sometimes fail when running on systems where the CPU is not a relatively new Intel or AMD processor.

Though it is a harmless message, the install stage of Glibc will complain about the absence of /etc/ld.so.conf. Prevent this warning with:


touch /etc/ld.so.conf

touch /etc/ld.so.conf


Fix the generated Makefile to skip an unneeded sanity check that fails in the LFS partial environment:


sed '/test-installation/s@$(PERL)@echo not running@' -i ../Makefile

sed '/test-installation/s@$(PERL)@echo not running@' -i ../Makefile


Install the package:


make install

make install


Install the configuration file and runtime directory for nscd:


cp -v ../nscd/nscd.conf /etc/nscd.conf mkdir -pv /var/cache/nscd

cp -v ../nscd/nscd.conf /etc/nscd.conf mkdir -pv /var/cache/nscd


Next, install the locales that can make the system respond in a different language. None of the locales are required, but if some of them are missing, the test suites of future packages would skip important testcases.


Individual locales can be installed using the localedef program. E.g., the first localedef command below combines the /usr/share/i18n/locales/cs_CZ charset-independent locale definition with the /usr/share/i18n/ charmaps/UTF-8.gz charmap definition and appends the result to the /usr/lib/locale/locale- archive file. The following instructions will install the minimum set of locales necessary for the optimal coverage of tests:


image

mkdir -pv /usr/lib/locale

localedef -i POSIX -f UTF-8 C.UTF-8 2> /dev/null || true localedef -i cs_CZ -f UTF-8 cs_CZ.UTF-8

localedef -i de_DE -f ISO-8859-1 de_DE

localedef -i de_DE@euro -f ISO-8859-15 de_DE@euro localedef -i de_DE -f UTF-8 de_DE.UTF-8

localedef -i el_GR -f ISO-8859-7 el_GR localedef -i en_GB -f UTF-8 en_GB.UTF-8 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 en_US -f UTF-8 en_US.UTF-8 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 fr_FR -f UTF-8 fr_FR.UTF-8

localedef -i it_IT -f ISO-8859-1 it_IT localedef -i it_IT -f UTF-8 it_IT.UTF-8 localedef -i ja_JP -f EUC-JP ja_JP

localedef -i ja_JP -f SHIFT_JIS ja_JP.SIJS 2> /dev/null || true localedef -i ja_JP -f UTF-8 ja_JP.UTF-8

localedef -i ru_RU -f KOI8-R ru_RU.KOI8-R localedef -i ru_RU -f UTF-8 ru_RU.UTF-8 localedef -i tr_TR -f UTF-8 tr_TR.UTF-8 localedef -i zh_CN -f GB18030 zh_CN.GB18030

localedef -i zh_HK -f BIG5-HKSCS zh_HK.BIG5-HKSCS


In addition, install the locale for your own country, language and character set.

Alternatively, install all locales listed in the glibc-2.30/localedata/SUPPORTED file (it includes every locale listed above and many more) at once with the following time-consuming command:


make localedata/install-locales

make localedata/install-locales


image

Then use the localedef command to create and install locales not listed in the glibc-2.30/localedata/ SUPPORTED file in the unlikely case you need them.


Note

Glibc now uses libidn2 when resolving internationalized domain names. This is a run time dependency. If this capability is needed, the instructions for installing libidn2 are in the BLFS libidn2 page.

Note

Glibc now uses libidn2 when resolving internationalized domain names. This is a run time dependency. If this capability is needed, the instructions for installing libidn2 are in the BLFS libidn2 page.


Top OS Cloud Computing at OnWorks: