akorentlab / leptonica

Automatically exported from code.google.com/p/leptonica
0 stars 0 forks source link

Missing #include for .png support #56

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

./configure --with-libpng && make

What is the expected output? What do you see instead?

[...]
checking for png_read_png in -lpng... yes
[...]
/bin/sh ../libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..   
-I/sw/include  -g -O2 -MT pngio.lo -MD -MP -MF .deps/pngio.Tpo -c -o pngio.lo 
pngio.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I/sw/include -g -O2 -MT 
pngio.lo -MD -MP -MF .deps/pngio.Tpo -c pngio.c  -fno-common -DPIC -o 
.libs/pngio.o
pngio.c:118: error: 'Z_DEFAULT_COMPRESSION' undeclared here (not in a function)
pngio.c: In function 'pixReadStreamPng':
pngio.c:184: warning: passing argument 2 of 'png_set_longjmp_fn' makes 
qualified function pointer from unqualified
pngio.c: In function 'fgetPngResolution':
pngio.c:523: warning: passing argument 2 of 'png_set_longjmp_fn' makes 
qualified function pointer from unqualified
pngio.c: In function 'pixWriteStreamPng':
pngio.c:690: warning: passing argument 2 of 'png_set_longjmp_fn' makes 
qualified function pointer from unqualified
make[2]: *** [pngio.lo] Error 1

What version of the product are you using? On what operating system?

leptonica-1.68
OS X 10.6, XCode 4

Please provide any additional information below.

fink (32-bit) for libpng (libpng15-1.5.2-1)

Original issue reported on code.google.com by dma...@gmail.com on 9 Jul 2011 at 1:12

GoogleCodeExporter commented 9 years ago
Z_DEFAULT_COMPRESSION is part of zlib not png, but pngio.c only #includes png 
(relying on png headers to (re)declare it or include something else that does). 
My png headers don't. Solution is to directly #include the zlib header in the 
.c that directly uses its token. Attached patch works for me and is now part of 
fink's leptonica package.

Original comment by dma...@gmail.com on 9 Jul 2011 at 1:19

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the patch.  This will be fixed in 1.69.
We'll also use #if HAVE_LIBPNG && HAVE_LIBZ
in the guard, because both are required for png read/write.

Original comment by dbloomb...@google.com on 13 Jul 2011 at 4:17

GoogleCodeExporter commented 9 years ago

Original comment by dan.bloo...@gmail.com on 13 Jul 2011 at 4:20

GoogleCodeExporter commented 9 years ago
Hi guys,

I'm having a problem with tesseract OCR in OpenKM and I think it is linked to 
this problem in leptonica (doesn't include zlib when I build it). I'm using 
ubuntu "natty" 11.04 and the above patch didn't work in the command line, so I 
opened pngio.c and put the lines 

+#ifdef HAVE_LIBZ
+#include "zlib.h"
+#endif

in between #include "png.h" and /* ----------------Set defaults for read/write 
options ----------------- */, however the build still won't include zlib.

Any ideas?

Original comment by DigitalP...@gmail.com on 28 Sep 2011 at 3:40

GoogleCodeExporter commented 9 years ago
Scratch that, I'm just a linux n00b. Used sudo patch and it patched fine.

Original comment by DigitalP...@gmail.com on 28 Sep 2011 at 4:01

GoogleCodeExporter commented 9 years ago
Still doesn't build with zlib though...

Original comment by DigitalP...@gmail.com on 29 Sep 2011 at 5:25

GoogleCodeExporter commented 9 years ago
This is fixed in 1.69

Original comment by dan.bloo...@gmail.com on 5 Jul 2012 at 8:39