Details on this package are located in Section 10.8.5, “Contents of EGLIBC.”
The EGLIBC package contains the main C library. This library provides the basic routines for allocating memory, searching directories, opening and closing files, reading and writing files, string handling, pattern matching, arithmetic, and so on.
Some packages outside of CLFS suggest installing GNU libiconv in
order to translate data from one encoding to another. The
project's home page (http://www.gnu.org/software/libiconv/)
says “This library provides an
iconv()
implementation, for use on
systems which don't have one, or whose implementation cannot
convert from/to Unicode.” EGLIBC provides an
iconv()
implementation and can
convert from/to Unicode, therefore libiconv is not required on a
CLFS system.
At the end of the installation, the build system will run a sanity test to make sure everything installed properly. This script will attempt to test for a library that is only used in the test suite and is never installed. Prevent the script from testing for this library with the following command:
sed -i 's/\(&& $name ne\) "db1"/ & \1 "nss_test1"/' scripts/test-installation.pl
This same script performs its tests by attempting to compile test programs against certain libraries. However it does not specify the ld.so, and our toolchain is still configured to use the one in /tools. The following set of commands will force the script to use the complete path of the new ld.so that was just installed:
LINKER=$(readelf -l /tools/bin/bash | sed -n 's@.*interpret.*/tools\(.*\)]$@\1@p') sed -i "s|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=${LINKER} -o|" \ scripts/test-installation.pl unset LINKER
The following patch fixes an issue where EGLIBC will improperly handle a condition where an elf binary has missing dependencies:
patch -Np1 -i ../eglibc-2.13-r13356-dl_dep_fix-1.patch
The EGLIBC build system is self-contained and will install
perfectly, even though the compiler specs file and linker are still
pointing at /tools
. The specs and
linker cannot be adjusted before the EGLIBC install because the
EGLIBC Autoconf tests would give false results and defeat the goal
of achieving a clean build.
The powerpc (32) architecture is expected to fail the check-textrel
tests because it cannot protect some elf segments in shared
libraries from being executable and writable. Using the default
64-bit compiler means the test runs as __powerpc64__
which is not expected to fail. The problem only
exists in 32-bit, the 64-bit ABI allows the segments to be
protected.
Other distributions alter gcc to default to 32-bits and so do not see this failure. Whether they then test correctly on 64-bit libraries is not our problem.
Force the test to use the 32-bit compiler with the following sed :
sed -i "s/\(^check-textrel-CFLAGS = \)/\1 ${BUILD32} /" elf/Makefile
The EGLIBC documentation recommends building EGLIBC outside of the source directory in a dedicated build directory:
mkdir -v ../eglibc-build cd ../eglibc-build
Prepare EGLIBC for compilation:
CC="gcc ${BUILD32}" CXX="g++ ${BUILD32}" \ ../eglibc-2.13/configure --prefix=/usr \ --disable-profile --enable-add-ons --enable-kernel=2.6.0 \ --libexecdir=/usr/lib/eglibc --host=${CLFS_TARGET32}
The meaning of the new configure option:
--libexecdir=/usr/lib/eglibc
This changes the location of the pt_chown program from its
default of /usr/libexec
to
/usr/lib/eglibc
.
Compile the package:
make
The test suite for EGLIBC is considered critical. Do not skip it under any circumstance.
In multilib, we tend to think that compiling for ${CLFS_TARGET32}
is not cross-compiling. EGLIBC takes the
traditional view that if you are building for a different host then
you are cross-compiling, so you won't be running the tests and
therefore you don't need the locale files. When we run the tests,
many will fail if the locale files are missing. The following sed
allows these tests to succeed:
sed -i '/cross-compiling/s@ifeq@ifneq@g' ../eglibc-2.13/localedata/Makefile
Before running the tests, copy a file from the source tree into our build tree to prevent a couple of test failures, then run the tests:
cp -v ../eglibc-2.13/iconvdata/gconv-modules iconvdata make -k check 2>&1 | tee eglibc-check-log; grep Error eglibc-check-log
The EGLIBC test suite is highly dependent on certain functions of
the host system, in particular the kernel. The posix/annexc test
normally fails and you should see Error 1
(ignored)
in the output. Apart from this, the EGLIBC test
suite is always expected to pass. However, in certain
circumstances, some failures are unavoidable. If a test fails
because of a missing program (or missing symbolic link), or a
segfault, you will see an error code greater than 127 and the
details will be in the log. More commonly, tests will fail with
Error 2
- for these, the contents of
the corresponding .out
file, e.g.
posix/annexc.out
may be informative.
Here is a list of the most common issues:
The math tests sometimes fail. Certain optimization settings are known to be a factor here.
If you have mounted the CLFS partition with the noatime
option, the
atime test will fail.
As mentioned in Section 2.4,
“Mounting the New Partition”, do not use the
noatime
option while
building CLFS.
When running on older and slower hardware, some tests can fail because of test timeouts being exceeded.
Though it is a harmless message, the install stage of EGLIBC will
complain about the absence of /etc/ld.so.conf
. Prevent this warning with:
touch /etc/ld.so.conf
Install the package:
make install
Details on this package are located in Section 10.8.5, “Contents of EGLIBC.”