首页 > 解决方案 > 如何使用 MinGW / MSYS 在 Windows 上编译 htmlcxx?

问题描述

我正在尝试使用 MinGW / MSYS 编译 htmlcxx lib,但我遇到了麻烦。首先,我收到了这个错误:

make : The term 'make' is not recognized as the name of a cmdlet, function, script file, or
operable program.

在我通过编辑 PATH 弄清楚这一点后,我开始收到关于“./configure”命令的相同错误

./configure : The term './configure' is not recognized as the name of a cmdlet, function,
script file, or operable program.

这个问题的根源是什么?

标签: mingwconfiguremsyshtmlcxx

解决方案


首先,我真的建议使用 MSYS2 ( https://www.msys2.org/ ),因为它比 MSYS 更新和更快,而 MinGW-w64 因为它比 MinGW 更新,并且支持 32位和 64 位 Windows。

您的错误表明您正在从 PowerShell 运行这些命令,而不是从 MSYS (bash) shell。从 MSYS shell 运行相同的命令。

事实上,你可以省略autoreconf -i,因为已经有一个configure脚本。

在自己尝试之后,我发现 MSYS2/MinGW-w64 构建需要一些技巧才能构建(静态库和共享库):

INSTALLPREFIX=/usr/local
./configure --prefix=$INSTALLPREFIX &&
sed -i.bak -e "s/\(allow_undefined=\)yes/\1no/" libtool &&
make install-strip am_libcss_parser_pp_la_OBJECTS="parser_pp.lo parser.lo css_syntax.lo css_lex.lo" LIBS="-Wl,--as-needed -liconv" &&
echo Success

我已在此处向 htmlcxx 报告了这些 MinGW-w64 构建问题。


推荐阅读