需要安装rlwrap,它依赖readline,所以这两个都需要安装,
yum install readline readline-devel
yum install autoconf automake
yum install gcc unzip
wget https://codeload.github.com/hanslub42/rlwrap/zip/v0.42 -O rlwrap.zip
unzip rlwrap.zip
cd rlwrap-0.42
autoreconf --install
./configure
readline可以使用yum源按照,而rlwrap 从github下载,源码安装
然后在,~/.bash_profile中添加如下信息:
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
如果想要立即生效,执行
source ~/.bash_profile
在执行rlwrap的make命令时遇到如下异常:
/usr/bin/ld: term.o: undefined reference to symbol 'tgetstr'
/usr/bin/ld: note: 'tgetstr' is defined in DSO /lib64/libtinfo.so.5 so try adding it to the linker command line
/lib64/libtinfo.so.5: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
这个是libtinfo没有被正确链接进来导致的。先export LIBS=/lib64/libtinfo.so.5,然后再./configure make make install就好了,LIBS能让-l选项搜索非标准后缀(*.so)的库文件,而通过"-L -l"选项只能搜索标准后缀的库文件,对libtinfo.so.5 添加一个libtinfo.so的符号链接也能解决这个问题
LDFLAGS 指定额外的选项LDFLAGS="-L/usr/lib64"表示链接时搜索/usr/lib64目录下的*.so库文件,但是新的版本不建议使用-l选项来指定库名称。
LIBS 选项指定额外的库文件,LIBS=/lib64/libtinfo.so.5 表示链接libtinfo这个库文件, 最后通过-ltinfo传递给ld的
Posted in: Linux
Comments are closed.