日期:2014-05-16  浏览次数:20584 次

linux下安装expect

linux下安装expect



expect的主页:http://expect.nist.gov/
最新稳定版5.43.0的下载地址:http://expect.nist.gov/expect.tar.gz

expect依赖于tcl/tk,因此在安装expect之前先安装tcl/tk。

tcl/tk8.4.16的下载面页:
http://www.tcl.tk/software/tcltk/downloadnow84.html
软件包的下载地址:
http://prdownloads.sourceforge.net/tcl/tcl8.4.16-src.tar.gz
http://prdownloads.sourceforge.net/tcl/tk8.4.16-src.tar.gz



检查系统,看tcl是否已经安装。

[root@rhel ~]# rpm -qa|grep tcl



已经安装的情况:



因为expect需要重新编译后安装,那么就需要tcl的开发包。

rpm -ivh --force tcl-devel-8.4.13-3.fc6.i386.rpm

然后将expect-5.43包解开,开始读INSTALL文档,系统管理员告诉我,不用读,直接运行 ./configure --help开参数。确实好使,又土了一次 :-( 。
 
1.首先确定tcl开发包安装的位置
rpm -qpl tcl-devel-8.4.13-3.fc6.i386.rpm|more

2.然后根据参数,运行./configure
./configure --with-tcl=/usr/lib --with-tclinclude=/usr/include/tcl-private/generic

3.执行
make

4.执行
make install
   
完成第四步后,expect顺利安装成功。 -




没有安装的情况:


第一步,安装tcl
[root@supersun.biz download]#cd tcl8.4.16/unix/
./configure
make
make install
安装之后不要删除源码包,在安装expect时需要tcl的头文件。

安装完毕以后,进入tcl源代码的根目录,把子目录unix下面的tclUnixPort.h copy到子目录generic中

第二步,安装tk

[root@supersun.biz download]#cd tk8.4.16/unix/
./configure
make
make install

第三步,安装expect

在不提供参数的情况下执行configure报错:
checking for Tcl private headers... checking for tclInt.h... no
configure: error: Can't find Tcl private headers
再次运行configure脚本,并指定tcl的头文件所在目录:
[root@supersun.biz expect-5.43]#./configure --with-tclinclude=../tcl8.4.16/generic

脚本运行正常,进行执行make进行编译
make

如果make,或是configure有错误的话,根据提示,再增加配置参数

编译过程中未出现错误,执行安装:
make install





配置参数的意思是:

· --with-tcl=/usr/tcl/lib :(我的环境中是/usr/local/lib) 确保配置脚本找到临时工具目录中的Tcl ,我们不希望它使用主系统中可能存在的tcl.

· --with-x=no : 告诉配置脚本,不要查找 Tk (Tcl 的 GUI 组件) 或 X 窗口系统库,这两个都有可能存在于主系统中。

· -with-tclinclude :帮助脚本找到所需要的tcl 头文件。


本文来自:
http://blog.csdn.net/wind19/article/details/4905453