在solaris上安装putty (Build putty on Solaris)

来源:互联网 发布:ubuntu sudo密码忘记 编辑:程序博客网 时间:2024/04/28 01:37
Putty是一款非常好用的开源的终端软件。支持大多数远程登录协议。
不过在solaris下面除了terminal好像还没有类似SecureCRT和putty这样的终端软件。

Putty是开源的,代码可以在 http://www.putty.nl/download.html 下载到。

下面主要介绍编译putty的办法:
首先进入下载到putty0.6,进入到unix目录,运行./configure
这样会根据机器的情况自动生成Makefile。
然后make就可以了。
在make的过程中会出现一些问题,现总结如下:

1、符号连接错误
Undefined                       first referenced
symbol                             in file
in6addr_loopback                    uxnet.o
in6addr_any                         uxnet.o
ld: fatal: Symbol referencing errors. No output written to plink
collect2: ld returned 1 exit status
*** Error code 1
make: Fatal error: Command failed for target `plink'
原因:编译时没有找到ipv6的库。
解决办法:修改Makefile
在ULDFLAGS =  -lxnet 后面加上 -lsocket 就可以了。

2、编译选项报错
gcc -o puttygen cmdgen.o import.o misc.o notiming.o sshaes.o sshbn.o /
        sshdes.o sshdss.o sshdssg.o sshmd5.o sshprime.o sshpubk.o /
        sshrand.o sshrsa.o sshrsag.o sshsh512.o sshsha.o time.o /
        tree234.o uxcons.o uxgen.o uxmisc.o uxnoise.o uxstore.o /
        version.o -lxnet
gcc  -g -O2 -Wall -Werror  -DHAVE_CONFIG_H -I/usr/local/include/gtk-1.2 -I/usr/local/include/glib-1.2 -I/usr/local/lib/glib/include -I/usr/openwin/include -I.././ -I../charset/  -I../windows/ -I../unix/ -I../mac/ -I../macosx/  -c ../config.c
../config.c: In function `portfwd_handler':
../config.c:1060: warning: unused variable `idx'
*** Error code 1
make: Fatal error: Command failed for target `config.o'
原因:有些头文件包含#pragma ident string 指示,其功能是把string加入.comment部分,有没有对程序执行没有影响,但是gcc无法识别,会产生警告,由于没有权限修改头文件,将 makefile中的编译选项 -Werror去掉,该编译选项令编译器将警告当作错误处理,去掉后产生警告make也不会停止。
解决办法:去掉makefile里的-Werror选项。

3、系统调用
gcc  -g -O2 -Wall  -DHAVE_CONFIG_H -I/usr/local/include/gtk-1.2 -I/usr/local/include/glib-1.2 -I/usr/local/lib/glib/include -I/usr/openwin/include -I.././ -I../charset/  -I../windows/ -I../unix/ -I../mac/ -I../macosx/  -c ../unix/uxpty.c
../unix/uxpty.c: In function `pty_open_master':
../unix/uxpty.c:364: error: `FIONBIO' undeclared (first use in this function)
../unix/uxpty.c:364: error: (Each undeclared identifier is reported only once
../unix/uxpty.c:364: error: for each function it appears in.)
*** Error code 1
make: Fatal error: Command failed for target `uxpty.o'
原因:uxpty.c里使用了宏FIONBIO,这个宏实际定义在sys/filio.h中,sys/ioctl.h包含了sys/filio.h,而 uxpty.c包含了sys/ioctl.h,正常理解应该能正确引用FIONBIO,但是编译时确又抱错说找不到符号FIONBIO,所以把 sys/filio.h包含进uxpty.c中再编译就没问题了,说明编译器预处理存在一定的问题。
解决办法:把 sys/filio.h包含进uxpty.c中。

4、代码修改
gcc -o pterm be_none.o cmdline.o config.o dialog.o fromucs.o gtkcfg.o /
        gtkcols.o gtkdlg.o gtkwin.o ldisc.o ldiscucs.o localenc.o /
        logging.o macenc.o mimeenc.o minibidi.o misc.o nocproxy.o /
        sbcs.o sbcsdat.o sercfg.o settings.o slookup.o terminal.o /
        time.o timing.o toucs.o tree234.o utf8.o uxcfg.o uxmisc.o /
        uxprint.o uxpterm.o uxpty.o uxsel.o uxsignal.o uxstore.o /
        uxucs.o version.o wcwidth.o xenc.o xkeysym.o xpmptcfg.o /
        xpmpterm.o -lxnet  -L/usr/sfw/lib -L/usr/openwin/lib -R/usr/openwin/lib -lgtk -lgdk -R/usr/sfw/lib -lgmodule -lglib -lXext -lX11 -lsocket -lnsl -lm
Undefined                       first referenced
symbol                             in file
Xutf8TextListToTextProperty         gtkwin.o
Xutf8TextPropertyToTextList         gtkwin.o
ld: fatal: Symbol referencing errors. No output written to pterm
collect2: ld returned 1 exit status
*** Error code 1
make: Fatal error: Command failed for target `pterm'
原因:Xutf8TextListToTextProperty和Xutf8TextPropertyToTextList两个函数是在某版本的X11之后才有的,Xutil.h中应该有它们的原形,但在目前系统的X11版本可能没有。
解决办法: Xutil.h中有另外的一些函数,参数刚好吻合,XmbTextListToTextProperty和 XmbTextPropertyToTextList,所以就尝试进行替换,编译成功,能够获得可执行文件。不过最根本的解决办法还是用新的X11去编译。

5、运行时警告
Gtk-WARNING **: Unable to locate loadable module in module_path: "libpixmap.so"
这个问题好像非常常见。google之后找到一个在ubuntu上的解答:
This is caused by the lack of the GTK1 pixmap engine.
You can install it (and thus fix this issue) by apt-getting the __gtk-engines-pixmap__ package.
不过在blastwave上面没有找到gtkengines。

按照以上办法可以顺利编成putty。运行./putty可以看到不错的界面。
enjoy!

注:编译过程由unix-center用户he1l0编译,本人结合自己的编译经过总结而成。非常感谢he1l0。原帖请访问:http://www.unix-center.net/bbs/viewthread.php?tid=1526&extra=page%3D1&page=1
原创粉丝点击