[我试图在Windows 10上构建libpng以获取win32二进制文件,但我认为与awk解析具有CRLF行尾的文件有关。我尝试使用dos2unix命令转换文件,但没有成功,结果相同-在make命令中,我得到下一个输出:
sh-3.1$ make
rm -f pnglibconf.c pnglibconf.tf[45]
gawk -f ./scripts/options.awk out=pnglibconf.tf4 version=search\
./pngconf.h ./scripts/pnglibconf.dfa\
./pngusr.dfa 1>&2
gawk -f ./scripts/options.awk out=pnglibconf.tf5 pnglibconf.tf4 1>&2
options.awk: bad line (10): com
make: *** [pnglibconf.c] Error 1
编译器是在Windows 10 x86上具有MSYS v1.0的MinGW,libpng版本是1637。如何解决此问题?
更新:通过下载tar.gz存档解决,但有新问题
sh-3.1$ make make all-am make[1]: Entering directory `/c/Users/user/Downloads/libpng-1.6.37.tar/libpng-1.6.37' depbase=`echo contrib/tools/pngfix.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\ gcc -DHAVE_CONFIG_H -I. -g -O2 -MT contrib/tools/pngfix.o -MD -MP -MF $depbase.Tpo -c -o contrib/tools/pngfix.o contrib/tools/pngfix.c &&\ mv -f $depbase.Tpo $depbase.Po In file included from contrib/tools/../../png.h:330,
from contrib/tools/pngfix.c:44:
contrib/tools/../../pnglibconf.h:206:54: error: expected identifier or '(' before '-' token
#define PNG_TEXT_Z_DEFAULT_STRATEGY 0
^
In file included from contrib/tools/../../png.h:335,
from contrib/tools/pngfix.c:44:
contrib/tools/../../pngconf.h:524:9: error: unknown type name 'ptrdiff_t'
typedef ptrdiff_t png_ptrdiff_t;
^~~~~~~~~
make[1]: *** [contrib/tools/pngfix.o] Error 1 make[1]: Leaving directory `/c/Users/user/Downloads/libpng-1.6.37.tar/libpng-1.6.37' make: *** [all] Error 2
已经通过实验验证,在Linux上不会发生此问题。
已解决。摘要:将tar.gz或xz存档与unix LF一起使用,并编辑在编译过程中生成的pnglibconf.h,因此没有换行符。