Prefix/libc

This is a project to support libc inside a Prefix, so called "RAP" (Rap Ain't Prefix). See also Project:Android. A general use case is for Prefix on RHEL 5 (CentOS 5 ans SL 5), where the host glibc-2.5 is too old to support modern features as fortify.

Classical Prefix is based on rpath. The differences are summerized in this table.

Installation
Download the Gentoo RAP bootstrap-rap.sh. You can use various ways to obtain the script and get it to a place where you can execute it. Once in position, preform the following commands:

That's all! The script will guide you through the full process, and tells you how to start your freshly bootstrapped Gentoo RAP system if it successfully runs up till the end. In normal cases, you don't need any more than just this.

Tested Distributions
At the moment, RAP supports Linux distributions only. The following tables tracks the tested distributions with the script. Feel free to add your own.

Compile Inside Memory
On a cluster node with large memory and shared network filesystem, compiling in a memory tmpfs can be significantly faster. /dev/shm is mounted as tmpfs by many distributions. For example:

Before calling bootstrap-rap.sh, it can be done with

Add an en_US.UTF-8 locale
We are having our own libc, the locales should be generated in Prefix. Add an entry to EPREFIX/etc/locale.gen

Then generate the locale by

For more details, refer to the handbook.

Use a nearby mirror
The bootstrap script needs to download quite a bit. It can be accelerated by using a Gentoo mirror nearby. To use a mirror, GENTOO_MIRRORS should be set both in the environment

and make.conf:

Replace http://mirrors.tuna.tsinghua.edu.cn/gentoo with your favorite mirror. For more details, refer to GENTOO_MIRRORS.

The rsync mirror is set in repos.conf

Replace rsync://mirrors.tuna.tsinghua.edu.cn/gentoo-portage with your favorite mirror. Refer to repos.conf for details.

In stage3, why should binutils be installed before glibc?
glibc has strict version dependence on binutils. Otherwise we get this error:

Why is there no binutils installed in stage2?
Debian multiarch gcc require binutils to support sysroot. By default, binutils of gentoo is not built with sysroot. And we do not need it. stage3 builds binutils very early.

Trouble Shooting
RAP is expected to run on a wild variety of environments. Let's document here the problems met during the bootstrap and the solutions made. It is very funny to see how many host systems are badly crewed.

/bin/tar exists but does not work. The working one is in /usr/local/bin
Solution: edit the script to prepend /usr/local/bin to PATH.

glibc in stage3 cannot be compiled
gcc-4.7.4 built in stage2 is bogus. It does not generate cfi assembly correctly.

No fix to this bug is known.