先看看编译后的程序:
image.png
先把相关文件下载:
- chmlib http://www.jedrea.com/chmlib/
- wxWidgets https://www.wxwidgets.org/downloads/
- xchm https://github.com/rzvncj/xCHM
分别解压,先编译和安装chmlib和wxWidgets,用terminal打开所在目录,执行:
./configure && make
wxWidgets 编译时间较长,chmlib相对较快。
make install
完成后,提示chmlib安装在
ls /usr/local/lib/libchm.
libchm.0.dylib* libchm.a libchm.dylib@ libchm.la*
wxWidgets 相对文件多很多
ls /usr/local/lib/wx/
config/ include/
接着编译和安装xchm,根据官方教程一步一步来,但由于aclocal
没有跟随autoreconf一起安装,执行./configure
会报错
Can't exec "aclocal": No such file or directory at /usr/local/Cellar/autoconf/2.72/share/autoconf/Autom4te/FileUtils.pm line 299.
autoreconf: error: aclocal failed with exit status: 2
解决方案是brew install automake
,安装完成后就可以继续了。如果编译过程提示找不到文件,比如:
checking for chm_lib.h... no
configure: error: Can't find the CHMLIB header.
执行./configure
的时候,添加参数,比如
./configure CPPFLAGS="-I./src" LDFLAGS="-L./src" && make
# 等待完成
make install