1# @Language: Markdown
2# @Software: VS Code/MacDown/Typora/Vim
3# @Author : Di Wang
4# @Email : [email protected]
许久未更新blog, Hugo的版本更新导致出现一堆配置问题, 稍微花了些时间解决后可以进入主题了
最近需要阅读某些设备的手册, 但这些设备只提供chm格式的文件, 在Windows和Linux平台自然没有问题, 但macOS上如何阅读就稍微需要花点工夫. 检索之下发现了这个项目, 看着挺满足我的需求的.
https://github.com/rzvncj/xCHM
那就安装吧, 支持MacPorts, 但是不支持brew, 似乎只能编译安装了.
首先安装依赖
1$ brew install wxwidgets
2$ brew install chmlib
3# 然后安装
4$ ./configure && make
5checking whether make sets $(MAKE)... yes
6checking for a BSD-compatible install... /usr/bin/install -c
7checking for a race-free mkdir -p... mkdir -p
8checking for a sed that does not truncate output... /usr/bin/sed
9checking whether NLS is requested... yes
10checking for msgfmt... /opt/homebrew/bin/msgfmt
11checking for gmsgfmt... /opt/homebrew/bin/msgfmt
12checking for xgettext... /opt/homebrew/bin/xgettext
13checking for msgmerge... /opt/homebrew/bin/msgmerge
14checking for gcc... gcc
15checking whether the C compiler works... yes
16checking for C compiler default output file name... a.out
17checking for suffix of executables...
18checking whether we are cross compiling... no
19checking for suffix of object files... o
20checking whether the compiler supports GNU C... yes
21checking whether gcc accepts -g... yes
22checking for gcc option to enable C11 features... none needed
23checking whether gcc understands -c and -o together... yes
24checking build system type... aarch64-apple-darwin24.4.0
25checking host system type... aarch64-apple-darwin24.4.0
26checking for ld used by gcc... /Library/Developer/CommandLineTools/usr/bin/ld
27checking if the linker (/Library/Developer/CommandLineTools/usr/bin/ld) is GNU ld... no
28checking for shared library run path origin... done
29checking how to run the C preprocessor... gcc -E
30checking for egrep -e... /usr/bin/grep -E
31checking for CFPreferencesCopyAppValue... yes
32checking for CFLocaleCopyCurrent... yes
33checking for GNU gettext in libc... no
34checking for iconv... yes
35checking for working iconv... yes
36checking how to link with libiconv... -liconv
37checking for GNU gettext in libintl... no
38checking whether to use NLS... no
39checking for wx-config... /opt/homebrew/bin/wx-config
40checking for wxWidgets version >= 3.0.0... yes (version 3.2.8)
41checking for wxWidgets static library... no
42checking whether sleep supports fractional seconds... yes
43checking filesystem timestamp resolution... 2
44checking whether build environment is sane... yes
45checking for gawk... no
46checking for mawk... no
47checking for nawk... no
48checking for awk... awk
49checking whether make supports the include directive... yes (GNU style)
50checking whether make supports nested variables... yes
51checking xargs -n works... yes
52checking dependency style of gcc... gcc3
53checking for g++... g++
54checking whether the compiler supports GNU C++... yes
55checking whether g++ accepts -g... yes
56checking for g++ option to enable C++11 features... none needed
57checking dependency style of g++... gcc3
58checking for stdio.h... yes
59checking for stdlib.h... yes
60checking for string.h... yes
61checking for inttypes.h... yes
62checking for stdint.h... yes
63checking for strings.h... yes
64checking for sys/stat.h... yes
65checking for sys/types.h... yes
66checking for unistd.h... yes
67checking for int32_t... yes
68checking for int16_t... yes
69checking for uint16_t... yes
70checking for uint32_t... yes
71checking for uint64_t... yes
72checking for chm_lib.h... no
73configure: error: Can't find the CHMLIB header.
呃…缺少头文件, 找一找, 明明在那呢! 看来是路径问题
问了下LLM, 看来需要指定搜索路径, 包含brew安装的程序, 头文件在brew的目录下也的确有一份复制
那就手动添加指定头文件搜索路径
1$ export CFLAGS="-I/opt/homebrew/include"
2... # 省略部分输出
3checking for sys/types.h... yes
4checking for unistd.h... yes
5checking for int32_t... yes
6checking for int16_t... yes
7checking for uint16_t... yes
8checking for uint32_t... yes
9checking for uint64_t... yes
10checking for chm_lib.h... yes
11checking for chm_open in -lchm... no
12configure: error: Can't find/use -lchm. Please install CHMLIB first.
还是不行, 又说缺少链接库, 那就也指定链接库的路径
1$ export LDFLAGS="-L/opt/homebrew/lib"
2$ ./configure
3checking whether make sets $(MAKE)... yes
4checking for a BSD-compatible install... /usr/bin/install -c
5checking for a race-free mkdir -p... mkdir -p
6checking for a sed that does not truncate output... /usr/bin/sed
7checking whether NLS is requested... yes
8checking for msgfmt... /opt/homebrew/bin/msgfmt
9checking for gmsgfmt... /opt/homebrew/bin/msgfmt
10checking for xgettext... /opt/homebrew/bin/xgettext
11checking for msgmerge... /opt/homebrew/bin/msgmerge
12checking for gcc... gcc
13checking whether the C compiler works... yes
14checking for C compiler default output file name... a.out
15checking for suffix of executables...
16checking whether we are cross compiling... no
17checking for suffix of object files... o
18checking whether the compiler supports GNU C... yes
19checking whether gcc accepts -g... yes
20checking for gcc option to enable C11 features... none needed
21checking whether gcc understands -c and -o together... yes
22checking build system type... aarch64-apple-darwin24.4.0
23checking host system type... aarch64-apple-darwin24.4.0
24checking for ld used by gcc... /Library/Developer/CommandLineTools/usr/bin/ld
25checking if the linker (/Library/Developer/CommandLineTools/usr/bin/ld) is GNU ld... no
26checking for shared library run path origin... done
27checking how to run the C preprocessor... gcc -E
28checking for egrep -e... /usr/bin/grep -E
29checking for CFPreferencesCopyAppValue... yes
30checking for CFLocaleCopyCurrent... yes
31checking for GNU gettext in libc... no
32checking for iconv... yes
33checking for working iconv... yes
34checking how to link with libiconv... -liconv
35checking for GNU gettext in libintl... yes
36checking whether to use NLS... yes
37checking where the gettext function comes from... external libintl
38checking how to link with libintl... -lintl -Wl,-framework -Wl,CoreFoundation
39checking for wx-config... /opt/homebrew/bin/wx-config
40checking for wxWidgets version >= 3.0.0... yes (version 3.2.8)
41checking for wxWidgets static library... no
42checking whether sleep supports fractional seconds... yes
43checking filesystem timestamp resolution... 2
44checking whether build environment is sane... yes
45checking for gawk... no
46checking for mawk... no
47checking for nawk... no
48checking for awk... awk
49checking whether make supports the include directive... yes (GNU style)
50checking whether make supports nested variables... yes
51checking xargs -n works... yes
52checking dependency style of gcc... gcc3
53checking for g++... g++
54checking whether the compiler supports GNU C++... yes
55checking whether g++ accepts -g... yes
56checking for g++ option to enable C++11 features... none needed
57checking dependency style of g++... gcc3
58checking for stdio.h... yes
59checking for stdlib.h... yes
60checking for string.h... yes
61checking for inttypes.h... yes
62checking for stdint.h... yes
63checking for strings.h... yes
64checking for sys/stat.h... yes
65checking for sys/types.h... yes
66checking for unistd.h... yes
67checking for int32_t... yes
68checking for int16_t... yes
69checking for uint16_t... yes
70checking for uint32_t... yes
71checking for uint64_t... yes
72checking for chm_lib.h... yes
73checking for chm_open in -lchm... yes
74checking that generated files are newer than configure... done
75configure: creating ./config.status
76config.status: creating Makefile
77config.status: creating src/Makefile
78config.status: creating art/Makefile
79config.status: creating po/Makefile.in
80config.status: creating m4/Makefile
81config.status: creating mac/Makefile
82config.status: creating data/Makefile
83config.status: creating man/Makefile
84config.status: creating config.h
85config.status: executing po-directories commands
86config.status: creating po/POTFILES
87config.status: creating po/Makefile
88config.status: executing depfiles commands
没有报错了, 编译!
1$ make
一堆warning == 无事发生! 安装+运行
运行效果: