Prefix/libc

This is a project to support libc inside a Prefix, codenamed 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.

Synchronize with the RAP repository
The RAP repository is meant to hold the patches that will be quickly merged into the main gentoo repository. There is no need to update it. However, in reality some patches that are not yet accepted by the main gentoo lands in RAP. To synchronize with the RAP repository,

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.

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.

Username becomes invalid inside RAP
RAP has its own glibc, which performs independent name service from the host. The bootstrap script first tries to generate passwd and group from getent and links host /etc/{passwd,group} as fallback,

If usernames are provided by LDAP, sometimes it is configured so that a normal user cannot query the entire passwd or group by getent. In that case portage breaks, will not be able to resolve the username and group. An quick fix is to show yourself to Prefix by specifying who you are,

But other uses on the host cannot be resolved. To get a fair sample of all users on the system, enumerate the /home directory,

Another solution is to use host nss_ldap library. (nss is part of glibc, which resolves uid/gid.)

Then set nsswitch to query ldap.