PGC-S-0240-Unmatched #endif


I have to compile libpng (libpng-1.5.14) which is required for WRF. I end up on this error:

make all-am
make[1]: Entering directory /home/wrfcomp/WRF.3.4.1.ARW.pgi/libpng-1.5.14' source='png.c' object='libpng15_la-png.lo' libtool=yes \ DEPDIR=.deps depmode=pgcc /bin/sh ./depcomp \ /bin/sh ./libtool --tag=CC --mode=compile pgcc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c -o libpng15_la-png.lo test -f ‘png.c’ || echo ‘./’`png.c
libtool: compile: pgcc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c png.c -MD -fpic -DPIC -o .libs/libpng15_la-png.o
PGC-S-0240-Unmatched #endif (./pngpriv.h: 1740)
PGC/x86-64 Linux 13.1-1: compilation completed with severe errors

I checked the .h and i can’t find any unmatched #endif

Neither gcc/gfortran (4.4.6) or intel (13.0.1) fail on this compilation.

Plateform is linux centos 6.2 x64

Any idea ?



Hi Arnaud,

The problem here has to do with how the file “pnglibconf.h” is getting generated. Our preprocessor will put a space between a “*” and “/” unless it’s the end of a comment. The authors aren’t expecting this, hence when they preprocess the following line from “scripts/pnglibconf.dfa”

PNG_DEFN_MAGIC-/PNG_JOIN*  pnglibconf.h - library build configuration */-PNG_DEFN_END

our preprocessor can’t tell “/PNG_JOIN*” is the beginning of a comment, so adds the space between the end “*” and “/”. Of course, this causes the compile error since the comment doesn’t get closed and the whole file becomes one big comment. This then cascades into the error you see.

The work around is to use “cpp” to pre-process this file by setting the environment variable “CPP=cpp” before running configure.

Hope this helps,

Thanks for the quick answer. I will try to report back to libpng people and try to find a fix.