Linux上實現Windows的SQL*Plus儲存SQL歷史記錄功能---rlwrap(轉)

landf發表於2012-03-20

1.rlwrap介紹
rlwrap is a 'readline wrapper' that uses the GNU readline library to allow the editing of keyboard input for any other command. Input history is remembered across invocations, separately for each command; history completion and search work as in bash and completion word lists can be specified on the command line.

rlwrap runs the specified command, intercepting user input in order to provide readline’s line editing, persistent history and completion. rlwrap tries to be as transparent as possible, keeping track of command’s terminal settings, so that it can do the right thing when command asks for single keypresses or for a password.

大家應該都知道,在Windows作業系統上可以使用上下鍵來呼叫曾經使用過的SQL命令,這樣可以比較方便的編輯曾經輸入過的命令。因為SQL*Plus只是記錄最近執行的一條sql命令,所以Windows上的這個功能給不少在Windows上操作SQL的朋友帶來了很大的便利。

突然,有一天(早晚有一天),您發現Windows上這個功能在Linux上不復存在,心中不免有些惆悵。
這時,您有兩種選擇,
第一種選擇是:慢慢適應Linux下SQL*Plus的操作習慣,以Vi編輯器與edit命令結合編輯最近一條使用的SQL(This is a good method.);
第二種選擇是:尋找第三方的小工具來滿足這個從Windows上繼承下來的“弊病”,這個小文兒就來介紹這樣一個輔助小工具,它的名字叫做rlwrap=“readline wrapper”。

本人不建議將這些“小把戲”在生產環境上部署,生產環境應該避免一切“花哨”的設定,否則一旦遇到“潛規則”您可能會死的很壯烈:)

下面就來給大家介紹一下這個小工具。

2.下載rlwrap
下載地址:
http://utopia.knoware.nl/%7Ehlub/uck/rlwrap/rlwrap-0.30.tar.gz
http://utopia.knoware.nl/~hlub/uck/rlwrap/
先將這個軟體(我使用的時候版本是0.30)下載到本地電腦上。

3.從本地電腦將安裝介質上傳到待安裝的伺服器
$ scp rlwrap-0.30.tar.gz root@144.194.192.183:~
root@144.194.192.183's password:
rlwrap-0.30.tar.gz                                                100%  180KB 179.7KB/s   00:00

4.解壓該安裝介質
[root@testdb183 ~]# gzip -d rlwrap-0.30.tar.gz
[root@testdb183 ~]# tar -xvf rlwrap-0.30.tar
rlwrap-0.30/
rlwrap-0.30/completions/
rlwrap-0.30/completions/ftp
rlwrap-0.30/completions/testclient
rlwrap-0.30/completions/coqtop
rlwrap-0.30/distribution/
rlwrap-0.30/distribution/rlwrap.spec.in
rlwrap-0.30/doc/
rlwrap-0.30/doc/rlwrap.man.in
rlwrap-0.30/doc/Makefile.am
rlwrap-0.30/doc/Makefile.in
rlwrap-0.30/src/
rlwrap-0.30/src/rlwrap.h
rlwrap-0.30/src/redblack.h
rlwrap-0.30/src/malloc_debug.h
rlwrap-0.30/src/completion.rb
rlwrap-0.30/src/Makefile.am
rlwrap-0.30/src/Makefile.in
rlwrap-0.30/src/main.c
rlwrap-0.30/src/signals.c
rlwrap-0.30/src/readline.c
rlwrap-0.30/src/pty.c
rlwrap-0.30/src/completion.c
rlwrap-0.30/src/term.c
rlwrap-0.30/src/ptytty.c
rlwrap-0.30/src/utils.c
rlwrap-0.30/src/string_utils.c
rlwrap-0.30/src/malloc_debug.c
rlwrap-0.30/test/
rlwrap-0.30/test/testclient
rlwrap-0.30/test/testit
rlwrap-0.30/tools/
rlwrap-0.30/tools/config.guess
rlwrap-0.30/tools/config.sub
rlwrap-0.30/tools/depcomp
rlwrap-0.30/tools/install-sh
rlwrap-0.30/tools/missing
rlwrap-0.30/tools/mkinstalldirs
rlwrap-0.30/README
rlwrap-0.30/configure.ac
rlwrap-0.30/aclocal.m4
rlwrap-0.30/Makefile.am
rlwrap-0.30/Makefile.in
rlwrap-0.30/config.h.in
rlwrap-0.30/configure
rlwrap-0.30/AUTHORS
rlwrap-0.30/COPYING
rlwrap-0.30/ChangeLog
rlwrap-0.30/INSTALL
rlwrap-0.30/NEWS
rlwrap-0.30/TODO
rlwrap-0.30/BUGS
[root@testdb183 ~]#

5.安裝rlwrap
1)使用解壓目錄中的configure檔案進行配置
[root@testdb183 rlwrap-0.30]# ./configure
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether make sets $(MAKE)... (cached) yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style. of include used by make... GNU
checking dependency style. of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for perl... /usr/bin/perl
checking for strip... strip
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sched.h usability... yes
checking sched.h presence... yes
checking for sched.h... yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking for sys/wait.h... (cached) yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking termios.h usability... yes
checking termios.h presence... yes
checking for termios.h... yes
checking for unistd.h... (cached) yes
checking time.h usability... yes
checking time.h presence... yes
checking for time.h... yes
checking getopt.h usability... yes
checking getopt.h presence... yes
checking for getopt.h... yes
checking curses.h usability... yes
checking curses.h presence... yes
checking for curses.h... yes
checking ncurses/term.h usability... yes
checking ncurses/term.h presence... yes
checking for ncurses/term.h... yes
checking whether term.h exists and compiles... yes
checking whether your getopt() correctly understands double colons in option string... yes
checking for an ANSI C-conforming const... yes
checking for pid_t... yes
checking whether time.h and sys/time.h may both be included... yes
checking whether gcc needs -traditional... no
checking return type of signal handlers... void
checking for getopt_long... yes
checking for select... yes
checking for snprintf... yes
checking for strlcpy... no
checking for strlcat... no
checking for strnlen... yes
checking for sched_yield... yes
checking for getopt_long... (cached) yes
checking for setsid... yes
checking for isastream... yes
checking for mkstemp... yes
checking for system... yes
checking for readlink... yes
checking for setenv... yes
checking for putenv... yes
checking for openpty in -lutil... yes
checking for openpty... yes
checking for getpty... no
checking for grantpt... yes
checking for unlockpt... yes
checking for getpt... yes
checking for pty/tty type... checking pty.h usability... yes
checking pty.h presence... yes
checking for pty.h... yes
OPENPTY
configure: checking for pty ranges...
checking for tgetent... no
checking for tgetent in -lcurses... yes
checking for readline in -lreadline... yes
checking whether your readline knows about rl_set_screen_size... yes
checking whether your readline knows about rl_variable_value... yes
checking whether your readline knows about rl_readline_version... yes
Will rlwrap find command's working directory under /proc//cwd? let's see...
checking for /proc/18843/cwd/configure.ac... yes


configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/Makefile
config.status: creating src/Makefile
config.status: creating doc/rlwrap.man
config.status: creating distribution/rlwrap.spec
config.status: creating config.h
config.status: executing depfiles commands

Now do:
    make (or gmake)  to build rlwrap
    make check       for instructions how to test it
    make install     to install it

2)使用make進行編譯
[root@testdb183 rlwrap-0.30]# make
make  all-recursive
make[1]: Entering directory `/root/rlwrap-0.30'
Making all in doc
make[2]: Entering directory `/root/rlwrap-0.30/doc'
sed -e 's#@DATADIR@#/usr/local/share#'  rlwrap.man > rlwrap.1
make[2]: Leaving directory `/root/rlwrap-0.30/doc'
Making all in src
make[2]: Entering directory `/root/rlwrap-0.30/src'
gcc -DHAVE_CONFIG_H -I. -I..    -DDATADIR=\"/usr/local/share\"  -g -O2 -MT main.o -MD -MP -MF .deps/main.Tpo -c -o main.o main.c
mv -f .deps/main.Tpo .deps/main.Po
gcc -DHAVE_CONFIG_H -I. -I..    -DDATADIR=\"/usr/local/share\"  -g -O2 -MT signals.o -MD -MP -MF .deps/signals.Tpo -c -o signals.o signals.c
mv -f .deps/signals.Tpo .deps/signals.Po
gcc -DHAVE_CONFIG_H -I. -I..    -DDATADIR=\"/usr/local/share\"  -g -O2 -MT readline.o -MD -MP -MF .deps/readline.Tpo -c -o readline.o readline.c
mv -f .deps/readline.Tpo .deps/readline.Po
gcc -DHAVE_CONFIG_H -I. -I..    -DDATADIR=\"/usr/local/share\"  -g -O2 -MT pty.o -MD -MP -MF .deps/pty.Tpo -c -o pty.o pty.c
mv -f .deps/pty.Tpo .deps/pty.Po
gcc -DHAVE_CONFIG_H -I. -I..    -DDATADIR=\"/usr/local/share\"  -g -O2 -MT completion.o -MD -MP -MF .deps/completion.Tpo -c -o completion.o completion.c
mv -f .deps/completion.Tpo .deps/completion.Po
gcc -DHAVE_CONFIG_H -I. -I..    -DDATADIR=\"/usr/local/share\"  -g -O2 -MT term.o -MD -MP -MF .deps/term.Tpo -c -o term.o term.c
mv -f .deps/term.Tpo .deps/term.Po
gcc -DHAVE_CONFIG_H -I. -I..    -DDATADIR=\"/usr/local/share\"  -g -O2 -MT ptytty.o -MD -MP -MF .deps/ptytty.Tpo -c -o ptytty.o ptytty.c
mv -f .deps/ptytty.Tpo .deps/ptytty.Po
gcc -DHAVE_CONFIG_H -I. -I..    -DDATADIR=\"/usr/local/share\"  -g -O2 -MT utils.o -MD -MP -MF .deps/utils.Tpo -c -o utils.o utils.c
mv -f .deps/utils.Tpo .deps/utils.Po
gcc -DHAVE_CONFIG_H -I. -I..    -DDATADIR=\"/usr/local/share\"  -g -O2 -MT string_utils.o -MD -MP -MF .deps/string_utils.Tpo -c -o string_utils.o string_utils.c
mv -f .deps/string_utils.Tpo .deps/string_utils.Po
gcc -DHAVE_CONFIG_H -I. -I..    -DDATADIR=\"/usr/local/share\"  -g -O2 -MT malloc_debug.o -MD -MP -MF .deps/malloc_debug.Tpo -c -o malloc_debug.o malloc_debug.c
mv -f .deps/malloc_debug.Tpo .deps/malloc_debug.Po
gcc -DDATADIR=\"/usr/local/share\"  -g -O2   -o rlwrap main.o signals.o readline.o pty.o completion.o term.o ptytty.o utils.o string_utils.o malloc_debug.o  -lutil  -lreadline -lcurses
make[2]: Leaving directory `/root/rlwrap-0.30/src'
make[2]: Entering directory `/root/rlwrap-0.30'
make[2]: Nothing to be done for `all-am'.
make[2]: Leaving directory `/root/rlwrap-0.30'
make[1]: Leaving directory `/root/rlwrap-0.30'

3)使用“make install”進行最後一步的安裝
[root@testdb183 rlwrap-0.30]# make install
Making install in doc
make[1]: Entering directory `/root/rlwrap-0.30/doc'
make[2]: Entering directory `/root/rlwrap-0.30/doc'
make[2]: Nothing to be done for `install-exec-am'.
test -z "/usr/local/share/man/man1" || /bin/mkdir -p "/usr/local/share/man/man1"
 /usr/bin/install -c -m 644 './rlwrap.1' '/usr/local/share/man/man1/rlwrap.1'
make[2]: Leaving directory `/root/rlwrap-0.30/doc'
make[1]: Leaving directory `/root/rlwrap-0.30/doc'
Making install in src
make[1]: Entering directory `/root/rlwrap-0.30/src'
make[2]: Entering directory `/root/rlwrap-0.30/src'
test -z "/usr/local/bin" || /bin/mkdir -p "/usr/local/bin"
  /usr/bin/install -c 'rlwrap' '/usr/local/bin/rlwrap'
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/root/rlwrap-0.30/src'
make[1]: Leaving directory `/root/rlwrap-0.30/src'
make[1]: Entering directory `/root/rlwrap-0.30'
make[2]: Entering directory `/root/rlwrap-0.30'
make[2]: Nothing to be done for `install-exec-am'.
test -z "/usr/local/share/rlwrap" || /bin/mkdir -p "/usr/local/share/rlwrap"
 /usr/bin/install -c -m 644 'completions/ftp' '/usr/local/share/rlwrap/ftp'
 /usr/bin/install -c -m 644 'completions/testclient' '/usr/local/share/rlwrap/testclient'
 /usr/bin/install -c -m 644 'completions/coqtop' '/usr/local/share/rlwrap/coqtop'
make[2]: Leaving directory `/root/rlwrap-0.30'
make[1]: Leaving directory `/root/rlwrap-0.30'

6.使用rlwrap命令方法
可以參考它的man幫助頁:http://utopia.knoware.nl/~hlub/uck/rlwrap/man.html
或使用“-h”選項檢視簡單的幫助資訊
ora10g@testdb183 /home/oracle$ rlwrap -h
Usage: rlwrap [options] command ...

Options:
  -a[password:]              --always-readline[=password:]
  -A                         --ansi-colour-aware
  -b                  --break-chars=
  -c                         --complete-filenames
  -C                 --command-name=
  -D <0|1|2>                 --history-no-dupes=<0|1|2>
  -f        --file=
  -F          --history-format=
  -h                         --help
  -H                   --history-filename=
  -i                         --case-insensitive
  -l                   --logfile=
  -n                         --no-warnings
  -p[ANSI colour spec]       --prompt-colour[=ANSI colour spec]
  -P                  --pre-given=
  -q                  --quote-characters=
  -m[newline substitute]     --multi-line[=newline substitute]
  -r                         --remember
  -v                         --version
  -s                      --histsize= (negative: readonly)
  -t                   --set-term-name=

bug reports, suggestions, updates:
http://utopia.knoware.nl/~hlub/uck/rlwrap/

上面的資訊有點複雜了,其實我們很簡單,只要在輸入sqlplus之前加上rlwrap就可以了。演示如下:
ora10g@testdb183 /home/oracle$ rlwrap sqlplus / as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on Mon Sep 7 14:23:43 2009

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options

sys@ora10g>

OK,到此,已經進入到了sqlplus中,從今往後,在這裡輸入的任何的單行資訊都會被記錄(即使是你輸入錯誤的命令也會被記錄,它的策略很簡單)。
使用上下箭頭就可以呼叫之前曾經輸入過的SQL命令啦。

7.rlwrap工具使用特點
1)即使退出重新登陸到sqlplus或rman中,之前的命令仍然被記錄,仍然可被使用
2)這只是一個按行進行記錄的工具,如果您的SQL是多行組成的,使用這個上下箭頭來檢視歷史命令就不是很方便了。還是要使用edit命令呼叫Vi或Vim來進行編輯來的直接一些。

8.小結
rlwrap工具不但可以記錄sqlplus命令,而且可以記錄rman命令,使設定永久生效的方法是,將下面的同名放入到使用者配置檔案(Linux是~/.bash_profile)中。
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'

Pls enjoy it.


附:
安裝readline步驟
方法一、
1,下載readline
下載地址:http://ftp.gnu.org/gnu/readline/
2,
上傳安裝檔案到待安裝的伺服器
3,解壓該安裝檔案
1),[root@localhost ~]# gzip -d readline-6.2.tar.gz
2),[root@localhost ~]# tar -xvf readline-6.2.tar
readline-6.2/
readline-6.2/doc/
readline-6.2/doc/Makefile.in
readline-6.2/doc/texinfo.tex
readline-6.2/doc/version.texi
readline-6.2/doc/fdl.texi
readline-6.2/doc/rlman.texi
readline-6.2/doc/rltech.texi
readline-6.2/doc/rluser.texi
readline-6.2/doc/rluserman.texi
readline-6.2/doc/history.texi
readline-6.2/doc/hstech.texi
readline-6.2/doc/hsuser.texi
readline-6.2/doc/readline.3
readline-6.2/doc/history.3
readline-6.2/doc/texi2dvi
readline-6.2/doc/texi2html
readline-6.2/doc/readline.ps
readline-6.2/doc/history.ps
readline-6.2/doc/rluserman.ps
readline-6.2/doc/readline.dvi
readline-6.2/doc/history.dvi
readline-6.2/doc/rluserman.dvi
readline-6.2/doc/readline.info
readline-6.2/doc/history.info
readline-6.2/doc/rluserman.info
readline-6.2/doc/readline.html
readline-6.2/doc/history.html
readline-6.2/doc/rluserman.html
readline-6.2/doc/readline.0
readline-6.2/doc/history.0
readline-6.2/doc/readline_3.ps
readline-6.2/doc/history_3.ps
readline-6.2/doc/history.pdf
readline-6.2/doc/readline.pdf
readline-6.2/doc/rluserman.pdf
readline-6.2/examples/
readline-6.2/examples/autoconf/
readline-6.2/examples/autoconf/BASH_CHECK_LIB_TERMCAP
readline-6.2/examples/autoconf/RL_LIB_READLINE_VERSION
readline-6.2/examples/autoconf/wi_LIB_READLINE
readline-6.2/examples/rlfe/
readline-6.2/examples/rlfe/ChangeLog
readline-6.2/examples/rlfe/Makefile.in
readline-6.2/examples/rlfe/README
readline-6.2/examples/rlfe/config.h.in
readline-6.2/examples/rlfe/configure
readline-6.2/examples/rlfe/configure.in
readline-6.2/examples/rlfe/extern.h
readline-6.2/examples/rlfe/os.h
readline-6.2/examples/rlfe/pty.c
readline-6.2/examples/rlfe/rlfe.c
readline-6.2/examples/rlfe/screen.h
readline-6.2/examples/Makefile.in
readline-6.2/examples/excallback.c
readline-6.2/examples/fileman.c
readline-6.2/examples/manexamp.c
readline-6.2/examples/readlinebuf.h
readline-6.2/examples/rl-fgets.c
readline-6.2/examples/rlcat.c
readline-6.2/examples/rlevent.c
readline-6.2/examples/rltest.c
readline-6.2/examples/rl.c
readline-6.2/examples/rlptytest.c
readline-6.2/examples/rlversion.c
readline-6.2/examples/histexamp.c
readline-6.2/examples/Inputrc
readline-6.2/examples/rlwrap-0.30.tar.gz
readline-6.2/support/
readline-6.2/support/config.guess
readline-6.2/support/config.rpath
readline-6.2/support/config.sub
readline-6.2/support/install.sh
readline-6.2/support/mkdirs
readline-6.2/support/mkdist
readline-6.2/support/mkinstalldirs
readline-6.2/support/shobj-conf
readline-6.2/support/shlib-install
readline-6.2/support/wcwidth.c
readline-6.2/shlib/
readline-6.2/shlib/Makefile.in
readline-6.2/COPYING
readline-6.2/README
readline-6.2/MANIFEST
readline-6.2/INSTALL
readline-6.2/CHANGELOG
readline-6.2/CHANGES
readline-6.2/NEWS
readline-6.2/USAGE
readline-6.2/aclocal.m4
readline-6.2/config.h.in
readline-6.2/configure
readline-6.2/configure.in
readline-6.2/Makefile.in
readline-6.2/ansi_stdlib.h
readline-6.2/chardefs.h
readline-6.2/history.h
readline-6.2/histlib.h
readline-6.2/keymaps.h
readline-6.2/posixdir.h
readline-6.2/posixjmp.h
readline-6.2/readline.h
readline-6.2/posixselect.h
readline-6.2/posixstat.h
readline-6.2/rlconf.h
readline-6.2/rldefs.h
readline-6.2/rlmbutil.h
readline-6.2/rlprivate.h
readline-6.2/rlshell.h
readline-6.2/rlstdc.h
readline-6.2/rltty.h
readline-6.2/rltypedefs.h
readline-6.2/rlwinsize.h
readline-6.2/tcap.h
readline-6.2/tilde.h
readline-6.2/xmalloc.h
readline-6.2/bind.c
readline-6.2/callback.c
readline-6.2/compat.c
readline-6.2/complete.c
readline-6.2/display.c
readline-6.2/emacs_keymap.c
readline-6.2/funmap.c
readline-6.2/input.c
readline-6.2/isearch.c
readline-6.2/keymaps.c
readline-6.2/kill.c
readline-6.2/macro.c
readline-6.2/mbutil.c
readline-6.2/misc.c
readline-6.2/nls.c
readline-6.2/parens.c
readline-6.2/readline.c
readline-6.2/rltty.c
readline-6.2/savestring.c
readline-6.2/search.c
readline-6.2/shell.c
readline-6.2/signals.c
readline-6.2/terminal.c
readline-6.2/text.c
readline-6.2/tilde.c
readline-6.2/undo.c
readline-6.2/util.c
readline-6.2/vi_keymap.c
readline-6.2/vi_mode.c
readline-6.2/xfree.c
readline-6.2/xmalloc.c
readline-6.2/history.c
readline-6.2/histexpand.c
readline-6.2/histfile.c
readline-6.2/histsearch.c
readline-6.2/patchlevel

4,安裝readline

1)使用解壓目錄中的configure檔案進行配置
[root@localhost readline-6.2]# ./configure
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu

Beginning configuration for readline-6.2 for i686-pc-linux-gnu

checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether gcc needs -traditional... no
checking for a BSD-compatible install... /usr/bin/install -c
checking for ar... ar
checking for ranlib... ranlib
checking for an ANSI C-conforming const... yes
checking for function prototypes... yes
checking whether char is unsigned... no
checking for working volatile... yes
checking return type of signal handlers... void
checking for size_t... yes
checking for ssize_t... yes
checking for ANSI C header files... (cached) yes
checking whether stat file-mode macros are broken... no
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking for fcntl... yes
checking for kill... yes
checking for lstat... yes
checking for memmove... yes
checking for putenv... yes
checking for select... yes
checking for setenv... yes
checking for setlocale... yes
checking for strcasecmp... yes
checking for strpbrk... yes
checking for tcgetattr... yes
checking for vsnprintf... yes
checking for isascii... yes
checking for isxdigit... yes
checking for getpwent... yes
checking for getpwnam... yes
checking for getpwuid... yes
checking for working strcoll... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking for unistd.h... (cached) yes
checking for stdlib.h... (cached) yes
checking varargs.h usability... no
checking varargs.h presence... no
checking for varargs.h... no
checking stdarg.h usability... yes
checking stdarg.h presence... yes
checking for stdarg.h... yes
checking for string.h... (cached) yes
checking for strings.h... (cached) yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking pwd.h usability... yes
checking pwd.h presence... yes
checking for pwd.h... yes
checking for memory.h... (cached) yes
checking termcap.h usability... no
checking termcap.h presence... no
checking for termcap.h... no
checking termios.h usability... yes
checking termios.h presence... yes
checking for termios.h... yes
checking termio.h usability... yes
checking termio.h presence... yes
checking for termio.h... yes
checking sys/pte.h usability... no
checking sys/pte.h presence... no
checking for sys/pte.h... no
checking sys/stream.h usability... no
checking sys/stream.h presence... no
checking for sys/stream.h... no
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/file.h usability... yes
checking sys/file.h presence... yes
checking for sys/file.h... yes
checking for sys/ptem.h... no
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... 64
checking for type of signal functions... posix
checking if signal handlers must be reinstalled when invoked... no
checking for presence of POSIX-style. sigsetjmp/siglongjmp... present
checking for lstat... yes
checking whether or not strcoll and strcmp differ... no
checking whether the ctype macros accept non-ascii characters... yes
checking whether getpw functions are declared in pwd.h... yes
checking whether termios.h defines TIOCGWINSZ... no
checking whether sys/ioctl.h defines TIOCGWINSZ... yes
checking for sig_atomic_t in signal.h... yes
checking whether signal handlers are of type void... yes
checking for TIOCSTAT in sys/ioctl.h... no
checking for FIONREAD in sys/ioctl.h... yes
checking for speed_t in sys/types.h... no
checking for struct winsize in sys/ioctl.h and termios.h... sys/ioctl.h
checking for struct dirent.d_ino... yes
checking for struct dirent.d_fileno... yes
checking for tgetent... no
checking for tgetent in -ltermcap... no
checking for tgetent in -ltinfo... no
checking for tgetent in -lcurses... no
checking for tgetent in -lncurses... no
checking which library has the termcap functions... using gnutermcap
checking wctype.h usability... yes
checking wctype.h presence... yes
checking for wctype.h... yes
checking wchar.h usability... yes
checking wchar.h presence... yes
checking for wchar.h... yes
checking langinfo.h usability... yes
checking langinfo.h presence... yes
checking for langinfo.h... yes
checking for mbrlen... yes
checking for mbscasecmp... no
checking for mbscmp... no
checking for mbsnrtowcs... yes
checking for mbsrtowcs... yes
checking for mbschr... no
checking for wcrtomb... yes
checking for wcscoll... yes
checking for wcsdup... yes
checking for wcwidth... yes
checking for wctype... yes
checking for wcswidth... yes
checking whether mbrtowc and mbstate_t are properly declared... yes
checking for iswlower... yes
checking for iswupper... yes
checking for towlower... yes
checking for towupper... yes
checking for iswctype... yes
checking for nl_langinfo and CODESET... yes
checking for wchar_t in wchar.h... yes
checking for wctype_t in wctype.h... yes
checking for wint_t in wctype.h... yes
checking configuration for building shared libraries... supported
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/Makefile
config.status: creating examples/Makefile
config.status: creating shlib/Makefile
config.status: creating config.h
config.status: executing default commands

2)使用make進行編譯
[root@localhost readline-6.2]# make
rm -f readline.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O readline.c
rm -f vi_mode.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O vi_mode.c
rm -f funmap.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O funmap.c
rm -f keymaps.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O keymaps.c
rm -f parens.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O parens.c
rm -f search.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O search.c
rm -f rltty.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O rltty.c
rm -f complete.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O complete.c
rm -f bind.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O bind.c
bind.c: In function ‘rl_function_of_keyseq’:
bind.c:710: warning: comparison is always true due to limited range of data type
rm -f isearch.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O isearch.c
rm -f display.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O display.c
display.c: In function ‘rl_character_len’:
display.c:2105: warning: comparison is always true due to limited range of data type
rm -f signals.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O signals.c
rm -f util.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O util.c
rm -f kill.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O kill.c
rm -f undo.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O undo.c
rm -f macro.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O macro.c
rm -f input.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O input.c
rm -f callback.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O callback.c
rm -f terminal.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O terminal.c
rm -f text.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O text.c
rm -f nls.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O nls.c
rm -f misc.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O misc.c
rm -f compat.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O compat.c
rm -f xfree.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O xfree.c
rm -f xmalloc.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O xmalloc.c
rm -f history.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O history.c
rm -f histexpand.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O histexpand.c
rm -f histfile.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O histfile.c
rm -f histsearch.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O histsearch.c
rm -f shell.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O shell.c
rm -f mbutil.o
gcc -c -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O mbutil.c
rm -f tilde.o
gcc -DHAVE_CONFIG_H    -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -g -O -DREADLINE_LIBRARY -c ./tilde.c
rm -f libreadline.a
ar cr libreadline.a readline.o vi_mode.o funmap.o keymaps.o parens.o search.o rltty.o complete.o bind.o isearch.o display.o signals.o util.o kill.o undo.o macro.o input.o callback.o terminal.o text.o nls.o misc.o compat.o xfree.o xmalloc.o history.o histexpand.o histfile.o histsearch.o shell.o mbutil.o tilde.o
test -n "ranlib" && ranlib libreadline.a
rm -f libhistory.a
ar cr libhistory.a history.o histexpand.o histfile.o histsearch.o shell.o mbutil.o xmalloc.o xfree.o
test -n "ranlib" && ranlib libhistory.a
test -d shlib || mkdir shlib
( cd shlib ; make  all )
make[1]: Entering directory `/root/readline-6.2/shlib'
rm -f readline.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o readline.o ../readline.c
mv readline.o readline.so
rm -f vi_mode.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o vi_mode.o ../vi_mode.c
mv vi_mode.o vi_mode.so
rm -f funmap.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o funmap.o ../funmap.c
mv funmap.o funmap.so
rm -f keymaps.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o keymaps.o ../keymaps.c
mv keymaps.o keymaps.so
rm -f parens.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o parens.o ../parens.c
mv parens.o parens.so
rm -f search.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o search.o ../search.c
mv search.o search.so
rm -f rltty.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o rltty.o ../rltty.c
mv rltty.o rltty.so
rm -f complete.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o complete.o ../complete.c
mv complete.o complete.so
rm -f bind.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o bind.o ../bind.c
../bind.c: In function ‘rl_function_of_keyseq’:
../bind.c:710: warning: comparison is always true due to limited range of data type
mv bind.o bind.so
rm -f isearch.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o isearch.o ../isearch.c
mv isearch.o isearch.so
rm -f display.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o display.o ../display.c
../display.c: In function ‘rl_character_len’:
../display.c:2105: warning: comparison is always true due to limited range of data type
mv display.o display.so
rm -f signals.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o signals.o ../signals.c
mv signals.o signals.so
rm -f util.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o util.o ../util.c
mv util.o util.so
rm -f kill.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o kill.o ../kill.c
mv kill.o kill.so
rm -f undo.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o undo.o ../undo.c
mv undo.o undo.so
rm -f macro.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o macro.o ../macro.c
mv macro.o macro.so
rm -f input.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o input.o ../input.c
mv input.o input.so
rm -f callback.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o callback.o ../callback.c
mv callback.o callback.so
rm -f terminal.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o terminal.o ../terminal.c
mv terminal.o terminal.so
rm -f text.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o text.o ../text.c
mv text.o text.so
rm -f nls.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o nls.o ../nls.c
mv nls.o nls.so
rm -f misc.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o misc.o ../misc.c
mv misc.o misc.so
rm -f xmalloc.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o xmalloc.o ../xmalloc.c
mv xmalloc.o xmalloc.so
rm -f xfree.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o xfree.o ../xfree.c
mv xfree.o xfree.so
rm -f history.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o history.o ../history.c
mv history.o history.so
rm -f histexpand.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o histexpand.o ../histexpand.c
mv histexpand.o histexpand.so
rm -f histfile.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o histfile.o ../histfile.c
mv histfile.o histfile.so
rm -f histsearch.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o histsearch.o ../histsearch.c
mv histsearch.o histsearch.so
rm -f shell.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o shell.o ../shell.c
mv shell.o shell.so
rm -f mbutil.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o mbutil.o ../mbutil.c
mv mbutil.o mbutil.so
rm -f tilde.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -DREADLINE_LIBRARY -c -o tilde.o ../tilde.c
mv tilde.o tilde.so
rm -f compat.so
gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.2"' -g -O -fPIC -o compat.o ../compat.c
mv compat.o compat.so
rm -f libreadline.so.6.2
gcc -shared -Wl,-soname,libreadline.so.6.2 -L./lib/termcap -Wl,-rpath,/usr/local/lib -Wl,-soname,`basename libreadline.so.6.2 .2` -o libreadline.so.6.2 readline.so vi_mode.so funmap.so keymaps.so parens.so search.so rltty.so complete.so bind.so isearch.so display.so signals.so util.so kill.so undo.so macro.so input.so callback.so terminal.so text.so nls.so misc.so xmalloc.so xfree.so history.so histexpand.so histfile.so histsearch.so shell.so mbutil.so tilde.so compat.so
rm -f libhistory.so.6.2
gcc -shared -Wl,-soname,libhistory.so.6.2 -L./lib/termcap -Wl,-rpath,/usr/local/lib -Wl,-soname,`basename libhistory.so.6.2 .2` -o libhistory.so.6.2 history.so histexpand.so histfile.so histsearch.so shell.so mbutil.so xmalloc.so xfree.so
make[1]: Leaving directory `/root/readline-6.2/shlib'

3)使用“make install”進行最後一步的安裝
[root@localhost readline-6.2]# make install
/bin/sh ./support/mkinstalldirs /usr/local/include \
                /usr/local/include/readline /usr/local/lib \
                /usr/local/share/info /usr/local/share/man/man3
mkdir -p -- /usr/local/include/readline /usr/local/lib /usr/local/share/info /usr/local/share/man/man3
for f in readline.h chardefs.h keymaps.h history.h tilde.h rlstdc.h rlconf.h rltypedefs.h; do \
                /usr/bin/install -c -m 644 ./$f /usr/local/include/readline ; \
        done
( if test -d doc ; then \
                cd doc && \
                make  infodir=/usr/local/share/info DESTDIR= install; \
          fi )
make[1]: Entering directory `/root/readline-6.2/doc'
/bin/sh ../support/mkdirs /usr/local/share/info /usr/local/share/man/man3
if test -n "" ; then \
                /bin/sh ../support/mkdirs  ; \
        fi
if test -f readline.info; then \
                /usr/bin/install -c -m 644 readline.info /usr/local/share/info/readline.info; \
        else \
                /usr/bin/install -c -m 644 ./readline.info /usr/local/share/info/readline.info; \
        fi
if test -f rluserman.info; then \
                /usr/bin/install -c -m 644 rluserman.info /usr/local/share/info/rluserman.info; \
        else \
                /usr/bin/install -c -m 644 ./rluserman.info /usr/local/share/info/rluserman.info; \
        fi
if test -f history.info; then \
                /usr/bin/install -c -m 644 history.info /usr/local/share/info/history.info; \
        else \
                /usr/bin/install -c -m 644 ./history.info /usr/local/share/info/history.info; \
        fi
if /bin/sh -c 'install-info --version' >/dev/null 2>&1; then \
                install-info --dir-file=/usr/local/share/info/dir \
                        /usr/local/share/info/readline.info ; \
                install-info --dir-file=/usr/local/share/info/dir \
                        /usr/local/share/info/history.info ; \
                install-info --dir-file=/usr/local/share/info/dir \
                        /usr/local/share/info/rluserman.info ; \
        else true; fi
/usr/bin/install -c -m 644 ./readline.3 /usr/local/share/man/man3/readline.3
/usr/bin/install -c -m 644 ./history.3 /usr/local/share/man/man3/history.3
if test -n "" ; then \
                if test -f readline.html; then \
                        /usr/bin/install -c -m 644 readline.html /readline.html; \
                else \
                        /usr/bin/install -c -m 644 ./readline.html /readline.html; \
                fi ; \
                if test -f history.html; then \
                        /usr/bin/install -c -m 644 history.html /history.html; \
                else \
                        /usr/bin/install -c -m 644 ./history.html /history.html; \
                fi ; \
                if test -f rluserman.html; then \
                        /usr/bin/install -c -m 644 rluserman.html /rluserman.html; \
                else \
                        /usr/bin/install -c -m 644 ./rluserman.html /rluserman.html; \
                fi ; \
        fi
make[1]: Leaving directory `/root/readline-6.2/doc'
test -d shlib || mkdir shlib
( cd shlib ; make  all )
make[1]: Entering directory `/root/readline-6.2/shlib'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/root/readline-6.2/shlib'
( cd examples ; make  DESTDIR= install )
make[1]: Entering directory `/root/readline-6.2/examples'
/bin/sh ../support/mkdirs /usr/local/share/readline
mkdir /usr/local/share/readline
make[1]: Leaving directory `/root/readline-6.2/examples'
mv /usr/local/lib/libreadline.a /usr/local/lib/libreadline.old
mv: cannot stat `/usr/local/lib/libreadline.a': No such file or directory
make: [install-static] Error 1 (ignored)
/usr/bin/install -c -m 644 libreadline.a /usr/local/lib/libreadline.a
test -n "ranlib" && ranlib /usr/local/lib/libreadline.a
mv /usr/local/lib/libhistory.a /usr/local/lib/libhistory.old
mv: cannot stat `/usr/local/lib/libhistory.a': No such file or directory
make: [install-static] Error 1 (ignored)
/usr/bin/install -c -m 644 libhistory.a /usr/local/lib/libhistory.a
test -n "ranlib" && ranlib /usr/local/lib/libhistory.a
( cd shlib ; make  DESTDIR= install )
make[1]: Entering directory `/root/readline-6.2/shlib'
/bin/sh ../support/mkdirs /usr/local/lib
/bin/sh ../support/mkdirs /usr/local/bin
/bin/sh ../support/shlib-install -O linux-gnu -V pc -d /usr/local/lib -b /usr/local/bin -i "/usr/bin/install -c -m 644" libhistory.so.6.2
/bin/sh ../support/shlib-install -O linux-gnu -V pc -d /usr/local/lib -b /usr/local/bin -i "/usr/bin/install -c -m 644" libreadline.so.6.2
install: you may need to run ldconfig
make[1]: Leaving directory `/root/readline-6.2/shlib'

5,[root@localhost rlwrap-0.37]# cd ../readline-6.2
[root@localhost readline-6.2]# ldconfig

方法二、
1,安裝盤內找到 readline安裝rpm檔案libtermcap-devel-2.0.8-46.1.i386.rpm 、readline-devel-5.1-3.el5.i386.rpm、 readline-5.1-3.el5.i386.rpm

2,上傳readline安裝rpm檔案檔案到安裝伺服器

3,安裝readline rpm包
[root@localhost ~]# rpm -ivh libtermcap-devel-2.0.8-46.1.i386.rpm
Preparing...                ########################################### [100%]
   1:libtermcap-devel       ########################################### [100%]
[root@localhost ~]# rpm -ivh readline-devel-5.1-3.el5.i386.rpm
Preparing...                ########################################### [100%]
   1:readline-devel         ########################################### [100%]
[root@localhost ~]# rpm -ivh readline-5.1-3.el5.i386.rpm
Preparing...                ########################################### [100%]
        package readline-5.1-3.el5.i386 is already installed



注意事項:
如果rlwrap安裝完成後,

[root@linux rlwrap-0.30]# rlwrap
rlwrap: error while loading shared libraries: libreadline.so.6: cannot open shared object file: No such file or directory

1,查詢 libreadline.so.6檔案
[root@localhost rlwrap-0.37]# find / -iname libreadline.so.6

/usr/local/lib/libreadline.so.6

(注:若沒有找到libreadline.so.6,則要安裝readline,我是安裝了readline,不知道之前有沒有這個庫檔案)

2,備份 /etc/ld.so.conf檔案

[root@localhost rlwrap-0.37]# cp /etc/ld.so.conf /etc/ld.so.conf.backup

3,修改 /etc/ld.so.conf檔案,在檔案尾部加上/usr/local/lib

[root@localhost rlwrap-0.37]# vi /etc/ld.so.conf

# include ld.so.conf.d/*.conf是原檔案有的,在ld.so.conf最後加入/usr/local/lib
include ld.so.conf.d/*.conf
/usr/local/lib

4,

[root@localhost rlwrap-0.37]# ldconfig




來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/14359/viewspace-719139/,如需轉載,請註明出處,否則將追究法律責任。

相關文章