chm格式的由来:
CHM文件是微软推出的基于HTML文件特性的帮助文件系统(压缩存储的HTML格式的帮助文件),以替代早先的WinHelp帮助系统(.hlp格式)。在Windows中把该类型文件称作“已编译的HTML帮助文件”。
CHM在不同语言的操作系统下,会自动显示对应语种的选单。浏览器(如Internet Explorer和Mozilla)支持的JavaScript、VBScript、ActiveX、JavaApplet、Flash、HTML图像文件(GIF、JPEG、PNG)和音频/视频文件(AU、MIDI、WAV、AVI)等,CHM同样支持,并可以通过URL地址与因特网联系在一起。
XCHM是Unix下的CHM文件阅读器,开放源代码(GPL),支持FreeBSD、Linux和Solaris,基于wxWindows框架和 chmlib库开发。wxWindows是一个开放源代码的基于C++的GUI框架。XCHM使用的是基于Gtk+的版本,即wxGtk。chmlib是 Jed Wing's开发的ITSS/CHM文件处理库。
由于本人是下载了《LPI Linux Certification in a Nutshell, 2nd Edition》这本书,只见chm格式的,搜索pdf未果,而自己又没有windows系统可用,在Ubuntu下只需使用apt-get install xchm就可以了,但是我不可能一直在这个平台下,而Fedora core 5有没有安装包,自己的问题自己解决,这就是学习linux的好处!
首先,去XCHM的sourceforge.net上的主站:http://xchm.sourceforge.net/
最新的稳定版本是1.9,xchm基于wxGTK和chmlib库,分别去他们的站点下载:
wxGTK2.6.3(http://www.wxwidgets.org/)和chmlib0.38(http://66.93.236.84/~jedwin/projects/chmlib/).
我下载到桌面:~/Desktop/xchm/目录下,分别解压:
[code]tar -zvxf wxGTK2.6.3.tar.gz
tar -zvxf chmlib-0.38.tar.gz
tar -zvxf xchm1.9.tar.gz
cd wxGTk
./configure --help
./configure
make
make test
sudo make install[/code]
同理,切换到各自的目录下,重复上述步骤,安装完毕后,默认是在/usr/local/下的,由于库的搜寻路径没有设置,所以xchm是不可以执行的,即会包下面的错误:
[code][lee@lee bin]$ ./xchm
./xchm: error while loading shared libraries: libwx_gtk2_xrc-2.6.so.0: cannot open shared object file: No such file or directory[/code]
用ldd命令查看:
[code][lee@lee bin]$ ldd xchm
linux-gate.so.1 => (0x00662000)
libwx_gtk2_xrc-2.6.so.0 => not found
libwx_gtk2_qa-2.6.so.0 => not found
libwx_gtk2_html-2.6.so.0 => not found
libwx_gtk2_adv-2.6.so.0 => not found
libwx_gtk2_core-2.6.so.0 => not found
libwx_base_xml-2.6.so.0 => not found
libwx_base_net-2.6.so.0 => not found
libwx_base-2.6.so.0 => not found
libchm.so.0 => not found
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x0045b000)
libm.so.6 => /lib/libm.so.6 (0x00253000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x0044d000)
libpthread.so.0 => /lib/libpthread.so.0 (0x0038e000)
libc.so.6 => /lib/libc.so.6 (0x0011e000)
/lib/ld-linux.so.2 (0x00101000)[/code]
在.profile中添加$PATH=/usr/local/后仍然不起作用,使用export LD_LIBRARY_PATH=/usr/local/lib也不起作用,我甚至在/etc/ld.conf.d/下添加了两个文件,依然如故!于是想到了如下的一个麻烦的办法:
[code][lee@lee bin]$ ln -s /usr/local/lib/libchm.so.0 /usr/lib/libchm.so.0[/code]
ln: 正在创建指向“/usr/local/lib/libchm.so.0”的符号链接“/usr/lib/libchm.so.0”: 权限不够
[code][lee@lee bin]$ sudo ln -s /usr/local/lib/libchm.so.0 /usr/lib/libchm.so.0
Password:
[lee@lee bin]$ sudo ln -s /usr/lib/libwx_gtk-2.4.so.0 /usr/lib/libwx_gtk-2.4.so[lee@lee bin]$ sudo ln -s /usr/lib/libwx_gtk-2.6.so.0 /usr/lib/libwx_gtk-2.6.so
[lee@lee bin]$ ls
dig host nslookup rar wx-config wxrc-2.6
googleearth isc-config.sh nsupdate unrar wxrc xchm
[lee@lee bin]$ ./xchm
./xchm: error while loading shared libraries: libwx_gtk2_xrc-2.6.so.0: cannot open shared object file: No such file or directory
[lee@lee bin]$ sudo ln -s /usr/lib/libwx_gtk_xrc-2.6.so.0 /usr/lib/libwx_gtk_xrc-2.6.so
[lee@lee bin]$ ./xchm ./xchm: error while loading shared libraries: libwx_gtk2_xrc-2.6.so.0: cannot open shared object file: No such file or directory
[lee@lee bin]$ sudo ln -s /usr/local/lib/libwx_gtk_xrc-2.6.so.0 /usr/lib/libwx_gtk_xrc-2.6.so
ln: 正在创建指向“/usr/local/lib/libwx_gtk_xrc-2.6.so.0”的符号链接“/usr/lib/libwx_gtk_xrc-2.6.so”: 文件已存在
[lee@lee bin]$ rm /usr/lib/libwx_gtk_xrc-2.6.so
rm: 无法删除 “/usr/lib/libwx_gtk_xrc-2.6.so”: 权限不够
[lee@lee bin]$ sudo rm /usr/lib/libwx_gtk_xrc-2.6.so
[lee@lee bin]$ sudo ln -s /usr/local/lib/libwx_gtk_xrc-2.6.so.0 /usr/lib/libwx_gtk_xrc-2.6.so
[lee@lee bin]$ ./xchm
./xchm: error while loading shared libraries: libwx_gtk2_xrc-2.6.so.0: cannot open shared object file: No such file or directory
[lee@lee bin]$ sudo ln -s /usr/local/lib/libwx_gtk2_xrc-2.6.so.0 /usr/lib/libwx_gtk2_xrc-2.6.so
[lee@lee bin]$ ./xchm ./xchm: error while loading shared libraries: libwx_gtk2_xrc-2.6.so.0: cannot open shared object file: No such file or directory
[lee@lee bin]$ sudo ln -s /usr/local/lib/libwx_gtk2_xrc-2.6.so.0 /usr/lib/libwx_gtk2_xrc-2.6.so.0
[lee@lee bin]$ ./xchm ./xchm: error while loading shared libraries: libwx_gtk2_qa-2.6.so.0: cannot open shared object file: No such file or directory
[lee@lee bin]$ sudo ln -s /usr/local/lib/libwx_gtk2_qa-2.6.so.0 /usr/lib/libwx_gtk2_qa-2.6.so.0
[lee@lee bin]$ ./xchm ./xchm: error while loading shared libraries: libwx_gtk2_html-2.6.so.0: cannot open shared object file: No such file or directory
[lee@lee bin]$ sudo ln -s /usr/local/lib/libwx_gtk2_html-2.6.so.0 /usr/lib/libwx_gtk2_html-2.6.so.0
[lee@lee bin]$ ./xchm ./xchm: error while loading shared libraries: libwx_gtk2_adv-2.6.so.0: cannot open shared object file: No such file or directory
[lee@lee bin]$ sudo ln -s /usr/local/lib/libwx_gtk2_adv-2.6.so.0 /usr/lib/libwx_gtk2_adv-2.6.so.0
[lee@lee bin]$ ./xchm ./xchm: error while loading shared libraries: libwx_gtk2_core-2.6.so.0: cannot open shared object file: No such file or directory
[lee@lee bin]$ sudo ln -s /usr/local/lib/libwx_gtk2_core-2.6.so.0 /usr/lib/libwx_gtk2_core-2.6.so.0
[lee@lee bin]$ ./xchm ./xchm: error while loading shared libraries: libwx_base_xml-2.6.so.0: cannot open shared object file: No such file or directory
[lee@lee bin]$ sudo ln -s /usr/local/lib/libwx_base_xml-2.6.so.0 /usr/lib/libwx_base_xml-2.6.so.0
[lee@lee bin]$ ./xchm ./xchm: error while loading shared libraries: libwx_base_net-2.6.so.0: cannot open shared object file: No such file or directory
[lee@lee bin]$ sudo ln -s /usr/local/lib/libwx_base_net-2.6.so.0 /usr/lib/libwx_base_net-2.6.so.0
[lee@lee bin]$ ./xchm ./xchm: error while loading shared libraries: libwx_base-2.6.so.0: cannot open shared object file: No such file or directory
[lee@lee bin]$ sudo ln -s /usr/local/lib/libwx_base-2.6.so.0 /usr/lib/libwx_base-2.6.so.0
[lee@lee bin]$ ./xchm
[1]+ Stopped ./xchm[/code]
结果是自己装上了,并且可以用了,重复了几次也很稳定。但是过程并没有作到完美!但愿这不是一个开始,希望日后的自己能更加努力的去理解linux的库和环境!