I'm attempting to configure libpng 1.5.12 for an embedded system (ARM9, Green Hills compiler). I would like to strip out all floating point support, as well as selected other features. To that end, I've configured a pngusr.h file as follows:
I'm using Cygwin tools to generate pnglibconf.h as indicated in scripts/pnglibconf.dfa, and no problems are noted here.
The problem shows up when I attempt to compile pngget.c. When attempting to build libpng, the compiler fails and reports:
"shared\libpng\png.h", line 1161: error #381-D: extra ";" ignored
> int error_action, double red, double green));
Using the preprocessor, I've tracked the problem down to a stray semicolon here:
extern void (png_set_gray_to_rgb) (png_structp png_ptr);
>extern void (png_set_rgb_to_gray_fixed) (png_structp png_ptr, int error_action, png_fixed_point red, png_fixed_point green);|
which appears to be related to how PNG_FP_EXPORT is getting processed in png.h.
Has anyone else seen this problem? Are there suggested work-arounds?
Brett L. Moore, PhD
From: John Bowler <jbowler@ac...> - 2012-08-07 22:35:15
I don't know what the latter will end up doing for sure but I'm pretty
certain every one of your #define PNG_NO_whatever_SUPPORTED
definitions does nothing.
I suspect you are correct, however, in that there is a stray ";" being
generated; I'll investigate that more.
John Bowler <jbowler@...>
Maybe the stray ';' is triggered somehow in scripts/options.awk by the lack of
a space separating the "/*" comment from the define in this line:
png.h:#define PNG_RGB_TO_GRAY_DEFAULT (-1)/*for red/green coefficients*/
I don't see anything else unusual in the vicinity. It's the only such comment
so just try inserting a space before the "/*" and see what happens.
From: John Bowler <jbowler@ac...> - 2012-08-08 00:31:26
It's just the known bug (fixed in libpng16) that the new
PNG_FIXED_EXPORT and PNG_FP_EXPORT macros don't include the ';' at the
end of the definition, so when FIXED or FP APIs are switched off the
semicolor is still there. It didn't happen before the macros because
every definition was wrapped in #ifdef/#endif (so everything got
So far as I can see the fix is to move the ';' inside the macro, as
was done in 1.6. I think that should be back ported to 1.5, because
while most compilers don't complain it's technically non-ANSI and it
was introduced in 1.5