[vtkusers] Incompatible libpng version in application and library

Clinton Stimpson clinton at elemtech.com
Mon Jan 30 09:59:26 EST 2006


>From: Martin Baumann <mailsgetlost at web.de>
>Subject: [vtkusers] Incompatible libpng version in application and
>	library
>To: vtkusers at vtk.org
>
>Hi,
>
>I am using VTK-4.2 and QT4.
>When I try to create a *.png image file I get the following error:
>
>   libpng warning: Application was compiled with png.h from libpng-1.0.12
>   libpng warning: Application  is  running with png.c from libpng-1.2.8
>   libpng error: Incompatible libpng version in application and library
>   ERROR: In /home/martin/local/src/vtk/vtk-4.2/IO/vtkPNGWriter.cxx, 
>line 156
>   vtkPNGWriter (0x8295418): Unable to write PNG file!
>
>It seems as if VTK-4.2 comes with libpng-1.0.12 and QT4 comes with 
>libpng-1.2.8.
>  
>
If you have a system png, Qt defaults to using it.  VTK defaults to 
using its own.  I've seen both Qt and VTK break because of that.

>I tried to disable the use of libpng-1.0.12 when I configured VTK. I did 
>the following:
>
>cmake
>-> toggle to advanced mode
>-> VTK_USE_SYSTEM_PNG               ON
>
>(I left the following with its standard values:)
>-> PNG_LIBRARY                          /usr/lib/libpng.so
>-> PNG_PNG_INCLUDE_DIR       /usr/include
>
>
>But this didn't help!
>
>How can I find what libpng versions are a certain png.h or png.cpp or 
>libpng.so?
>I am not sure what I have to set for PNG_LIBRARY and PNG_PNG_INCLUDE_DIR 
>because I
>don't know where I find the 1.2.8 versions of the files.
>I have three or four png.h png.cpp and libpngX.so
>
>
>Thanks, MB
>
>  
>
How about using VTK 5?  VTK uses its own mangled png library.  With that 
version, all you have to worry about is freetype conflicts.  With VTK 
4.2, you have to worry about zlib, png, tiff and freetype conflicts 
(more ??).

To build VTK, I sometimes use a CMake initial cache file which parses 
one of Qt's .prl files to check freetype.  If it is using the system 
freetype, force VTK to use the system freetype, otherwise Qt isn't using 
freetype, and VTK can use its own.

There's one catch I've seen with VTK 5 -- if you are building binaries 
to distribute, VTK relies on a couple freetype functions that changed 
between minor freetype releases (it seems the freetype developers broke 
the rules).  You end up with your binaries not working on some 
customer's machines.  I just comment out the section of VTK code in that 
case, since only one class in all of VTK uses that binary incompatible 
freetype function.  Qt still works because it doesn't call those functions.

VTK 5.0 made some improvements for compatiblity when using Qt, there's 
still a little bit left.

Clint




More information about the vtkusers mailing list