Installing GNU Readline PDF
Installing GNU Readline PDF
Installing GNU Readline PDF
Contents
Installing the GNU Readline library ............................................................................................... 1
Introduction ........................................................................................................................................ 2
First Thing First ................................................................................................................................... 2
For Common Linuces .......................................................................................................................... 2
Other Linuces ...................................................................................................................................... 2
Add it to OS Library Search Path ........................................................................................................ 3
Static Linking....................................................................................................................................... 3
Reference ............................................................................................................................................ 3
Introduction
If you wish to compile with Readline support and your unix-like system does not have the
Readline library installed, follow the tips here to help with Readline installation.
(RPM-based systems)
(Debian-based systems)
Other Linuces
If this doesn't work, or you are using another Unix system then proceed as follows:
Download the latest version of GNU readline
from http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html At the time of
writing, this is readline-6.3 (ftp://ftp.cwru.edu/pub/bash/readline-6.3.tar.gz)
Unpack the gzipped tar file under /tmp
cd /tmp
tar -zxvf readline-6.3.tar.gz
If you do not have write access to the /usr/local/ hierarchy, then you can install the files
somewhere else:
./configure --prefix=/home/my-user-name/packages
and install (sudo helps you become superuser if you are devoid of that privilege)
make install
Alternatively, if you have root access, you can edit the file /etc/ld.so.conf to add the
directory in which the library has been installed. Under recent Linux installations, there is another
alternative which is to create a file /etc/ld.so.conf.d/readline.conf just containing a
single line with the directory where the library has been installed. In either case, you must now
(as root) type the command:
/sbin/ldconfig
Now, modify the Makefile, such that this directory is in the linker's library path. Change:
READLINELIB = -lreadline -lcurses
to:
READLINELIB = -L/usr/local/lib -lreadline -lcurses
Now build with make as usual, but ensure that LD_LIBRARY_PATH is set whenever you want to
run the program. Alternatively, install with
./configure --prefix=/usr/lib
to install in the main system directories and then it will be in the default search path. This isn't
recommended unless you know what you are doing!
Static Linking
You can also link the readline library statically to ensure portability to machines with Linux
machines having different versions of the readline library installed. In this case you will not need
the LD_LIBRARY_PATH or changes to /etc/ld.so.conf. To do this, edit the Makefile and
change:
READLINELIB = -lreadline -lcurses
to
READLINELIB = /usr/lib/libreadline.a -lcurses
Reference:
http://acrmwww.biochem.ucl.ac.uk/software/profit/doc/node17.html