Search code examples
windowsawklibpngbuilding

LibPNG building issue on Windows 10


Im trying to build libpng on Windows 10 to get win32 binaries but having an issue related, i supposed, to awk parsing files with CRLF line endings. I've tried to convert files with dos2unix command, but without success, result the same - on the make command I've getting next output:

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

Compiler is MinGW with MSYS v1.0 on WIndows 10 x86, libpng version is 1637. How to solve this issue?

Update: solved by downloading tar.gz archive, but having new issue

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

It has been experimentally verified that this problem does not occur on Linux.


Solution

  • Solved. Summary: use tar.gz or xz archive with unix LF, and edit pnglibconf.h generated during compilation so there is no line breaks.