compilationlibpngcray

libpng version 1.5.14 missing endif


I have tried compiling libpng 1.5.14 on a Cray x86_64 system using CC 5.10 and ran into frequent missing endif errors. I fixed many of these errors by adding an #endif to the end of the files, allowing 'make check' to continue past the first series of 3 tests. However, there is 1 endif error in dfn.c that I am unable to fix. I attempted to hack this with no success by copying the dfn.c to hack_dfn.c, adding an #endif statement to the end of hack_dfn.c, then having Makefile copy hack_dfn.c to dfn.c after dfn.c is recreated during the compile process. Below is the final bit of output without any fix made to the dfn.c file, and includes the error I am receiving:

Running tests.  For details see pngtest-log.txt
Running test-pngtest.sh
  PASS: pngtest --strict pngtest.png
PASS: test-pngtest.sh
Running test-pngvalid-simple.sh
  PASS: pngvalid --standard
  PASS: pngvalid --standard --progressive-read
  PASS: pngvalid --standard --interlace
  PASS: pngvalid --standard --progressive-read --interlace
  PASS: pngvalid --size
  PASS: pngvalid --size --progressive-read
  PASS: pngvalid --transform
PASS: test-pngvalid-simple.sh
Running test-pngvalid-full.sh
  PASS: pngvalid --gamma-threshold
  PASS: pngvalid --gamma-transform
  PASS: pngvalid --gamma-sbit
  PASS: pngvalid --gamma-16-to-8
  PASS: pngvalid --gamma-background
  PASS: pngvalid --gamma-alpha-mode
  PASS: pngvalid --gamma-transform --expand16
  PASS: pngvalid --gamma-background --expand16
  PASS: pngvalid --gamma-alpha-mode --expand16
PASS: test-pngvalid-full.sh
==================
All 3 tests passed
==================
make[1]: Leaving directory `/usr/local/libpng-1.5.14'
rm -f scripts/symbols.out dfn.c dfn?.out
test -d scripts || mkdir scripts
echo '#include "scripts/symbols.dfn"' >dfn.c
cc -E -DHAVE_CONFIG_H -I.  -DPNG_CONFIGURE_LIBPNG\
             -DPNGLIB_LIBNAME='PNG15_0' -DPNGLIB_VERSION='1.5.14' -DSYMBOL_PREFIX='' -DPNG_NO_USE_READ_MACROS -DPNG_BUILDING_SYMBOL_TABLE dfn.c > dfn1.out
PGC-S-0218-Missing #endif (dfn.c: 2)
PGC/x86-64 Linux 12.4-0: compilation completed with severe errors
make: *** [scripts/symbols.out] Error 2

I do not have time to go through 3282 if[n]def statements checking that each is closed. I am hoping that someone here with more knowledge of libpng than myself can at least help direct me to where I could begin looking. Oddly, I was able to compile this same version of libpng on another system with gcc without issue. I am hoping to avoid using gcc on this system.


Solution

  • Perhaps your C preprocessor is confused by the presence of comments on the #endif statements, e.g.,

      #endif /* PNG_READ_SUPPORTED */