undefined reference to `png_write_destroy' when linking with libpng-1.0.8-1.tar.gz from Charles Wilson
Charles Wilson
cwilson@ece.gatech.edu
Thu Sep 14 16:07:00 GMT 2000
I haven't downloaded netpbm myself, but it looks like png_write_destroy
&tc. are being misdefined in whatever header files are included by
pngtopng.c (or gimp/png.c). The reason I say this, is because the
missing link should be to '_imp__png_write_destroy'.
Three possible reasons:
1. netpbm / gimp may have their own versions of png header files (bad
bad bad...) which do not contain the appropriate declspec() / PNG_STATIC
definitions
2. you may have old versions of png.h/pngconf.h somewhere that do not
contain the appropriate declspec() definitions, and the compiler is
finding those old versions instead of the new ones in /usr/include.
Possibly old cygutils stuff in /usr/local/include?
3. I screwed up the headers in the official png package. I'll check
this one, you check the other two. :-)
AHA! It is #3. But that's because png_write_destroy / png_read_destroy
have been removed as external functions, and are only called from inside
the library:
-------------------------------------------
/* free any memory used in info_ptr struct (old method - NOT DLL
EXPORTED) */
extern void png_write_destroy_info PNGARG((png_infop info_ptr));
/* free any memory used in png_ptr struct (old method - NOT DLL
EXPORTED) */
extern void png_write_destroy PNGARG((png_structp png_ptr));
-------------------------------------------
Now that I think about it, I remember some discussion on png-develop
that you are never ever ever supposed to mess with the info_ptr in
client code. If you do, you (somehow) screw up the internals of
libpng. So, netpbm and gimp are broken and need to be updated.
--Chuck
"Dr. Volker Zell" wrote:
>
> Hi
>
> System: WinNT 4.0/SP3 - 196 MB Ram
> Cygwin 1.1.4
> - everything mounted binary,
> - CYGWIN = tty title binmode ntea nontsec
>
> plus all the contrib libraries from Charles Wilson.
>
> I get the following when compiling
>
> o netpbm-9.8 - http://download.sourceforge.net/netpbm/
>
> gcc -c -I.. -I../ppm -I../pgm -I../pbm -I../shhopt -I/usr/include -I/usr/include -I/usr/include -I../urt -pedantic -O3 -Wall -Wno-uninitialized -o pnmtopng.o pnmtopng.c
> gcc -o pnmtopng pnmtopng.o `../libopt libpnm.a ../ppm/libppm.a ../pgm/libpgm.a ../pbm/libpbm.a ` \
> -L/usr/lib -lpng -lz -lm
> pnmtopng.o(.text+0x39ce):pnmtopng.c: undefined reference to `png_write_destroy'
> collect2: ld returned 1 exit status
> make[1]: *** [pnmtopng] Error 1
>
> and also the following errors when compiling
>
> o gimp-1.0.4 - ftp://ftp.gimp.org/pub/gimp/v1.0/v1.0.4/
>
> /bin/sh ../../libtool --mode=link gcc -g -O2 -Wall -s -o png png.o ../../libgimp/libgimpui.la ../../libgimp/libgimp.la -L/usr/local/lib -L/usr/X11R6/lib -lgtk -lgdk -lgmodule -lglib -lXext -lX11 -lm -lipc -lpng -lz -lm
> gcc -g -O2 -Wall -s -o png png.o ../../libgimp/.libs/libgimpui.a ../../libgimp/.libs/libgimp.a -L/usr/local/lib -L/usr/X11R6/lib -lgtk -lgdk -lgmodule -lglib -lXext -lX11 -lm -lipc -lpng -lz -lm
> png.o: In function `load_image':
> /gnu/src/gimp-1.0.4/plug-ins/png/png.c:601: undefined reference to `png_read_destroy'
> png.o: In function `save_image':
> /gnu/src/gimp-1.0.4/plug-ins/png/png.c:794: undefined reference to `png_write_destroy'
> collect2: ld returned 1 exit status
>
> Both symbols are defined in the static libpng.a library but not in the libpng.dll.a.
>
> Any hints why ?
>
> Ciao
> Volker
>
> --
> Want to unsubscribe from this list?
> Send a message to cygwin-unsubscribe@sourceware.cygnus.com
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com
More information about the Cygwin
mailing list