[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Using NPTL on Red Hat



I have been running applications upon NPTL to proof its binary compatibility

with Linuxthreads.  Thanks to the kindly help from the folks here, I
collected
some tips as for the usage of NPTL, which I want to share with other newbies
in this community. I am also looking forward to any corrections on the
draft.

================
Software Preparation
================
1. nptl 0.5:		<ftp://people.redhat.com/drepper/nptl/>
2. linux kernel >= 2.5.43: <ftp://ftp.kernel.org>
3. gcc >= 3.2:		<ftp://people.redhat.com/jakub/gcc/3.2-10/>
4. binutils >= 2.13.90.0.4-1
<ftp://people.redhat.com/jakub/binutils/2.13.90.0.10-2/>
5. glibc >= 2.3:  	<ftp://ftp.gnu.org/gnu/glibc/>
6. glibc-linuxthreads 	<ftp://sources.redhat.com/pub/glibc/snapshots>

========================
Installation and Building of NPTL
========================
1. Install Redhat 8.0
2. Update binutils and gcc to the required version
3. Rebuild the linux kernel (>= 2.5.43) and boot with it
4. Make sure the symbol link /lib/modules/`uname -r`/build is right.
(usually linked to /usr/src/linux-`uname -r`).
5. Uncompress the tarballs and rebuild nptl along with glibc
# mkdir -p /path/to/NPTL	(whatever name you like)
# cd /path/to/NPTL
# cp /from/glibc-2.3.1.tar.gz .
# cp /from/glibc-linuxthreads-2.3.1pre1.tar.bz2 .
# cp /from/nptl-0.4.tar.bz2 .
# tar xzvf glibc-2.3.1.tar.gz
# ln -s glibc-2.3.1 glibc
# tar xjvf glibc-linuxthreads-2.3.1pre1.tar.bz2 -C glibc
# tar xjvf nptl-0.4.tar.bz2 -C glibc
# cd glibc
# ./configure --prefix=/usr --enable-add-ons=nptl --with-tls
# make

===========
Using NPTL
===========
1. Compile programs with NPTL
GLIBCDIR=/path/to/NPTL/glibc; \
gcc -o ex ex.c $GLIBCDIR/nptl/libpthread.so.0 $GLIBCDIR/libc.so.6 \
-Wl,-rpath,$GLIBCDIR:$GLIBCDIR/nptl:$GLIBCDIR/elf,\
-dynamic-linker,$GLIBCDIR/elf/ld-linux.so.2

2. Run compiled-upon-Linuxthreads programs with NPTL
GLIBCDIR=/path/to/NPTL/glibc; \
$GLIBCDIR/elf/ld.so --library-path $GLIBCDIR:$GLIBCDIR/math:\
$GLIBCDIR/elf:$GLIBCDIR/dlfcn:$GLIBCDIR/nss:$GLIBCDIR/nis:\
$GLIBCDIR/rt:$GLIBCDIR/crypt:$GLIBCDIR/nptl $EXECUTABLE_NAME

3. Activate and deactivate NPTL library across the system scope
* Before trying this, make sure you have a correctly built glibc and a 
self-contained shell (eg. sash) for emergency recovery.
 * Then you may be able to run existing programs upon nptl library

-- Activate NPTL across the system scope 
GLIBCDIR=/path/to/NPTL/glibc; \
ln -fs $GLIBCDIR/elf/ld.so /lib/ld-linux.so.2; \
export LD_LIBRARY_PATH=$GLIBCDIR:$GLIBCDIR/math:$GLIBCDIR/elf\
:$GLIBCDIR/dlfcn:$GLIBCDIR/nss:$GLIBCDIR/nis:$GLIBCDIR/rt\
:$GLIBCDIR/crypt:$GLIBCDIR/nptl

-- Deactivate NPTL
cd /lib
ln -fs ld-2.2.93.so ld-linux.so.2
export LD_LIBRARY_PATH=

-- Manual recovery in an emergency
sash	 # Stand-alone shell
 > cd /lib
 > -rm ld-linux.so.2	# inlined commands of sash
 > -ln -s ld-2.2.93.so ld-linux.so.2
 > exit
export LD_LIBRARY_PATH=


Bingwei Liu              
Software Engineer,  Intel Corporation
bing wei liu intel com

This email message solely contains my own personal views, and not
necessarily those of my employer






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]