[solved] opencv libpng version mismatch [closed]

asked 2014-05-31 12:42:27 -0500

rocrates gravatar image

updated 2014-06-06 04:33:40 -0500

Hi, I'm using opencv-2.4.9 on Ubuntu 14.04 and getting this error running my java application:

libpng warning: Application was compiled with png.h from libpng-1.5.12

libpng warning: Application is running with png.c from libpng-1.2.50

libpng error: Incompatible libpng version in application and library

As far as I understand opencv comes with libpng 1.5.12, but ubuntu 14.04 has version 1.2.50, so I installed libpng-1.5.12, but not sure did it properly because I get the same error. What can I check? Thank You

SOLUTION: Add flag BUILD_PNG=OFF to cmake. On the cmake results you'll see under Media I/O, PNG: "path to your libpng.so" instead of Build...

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by StevenPuttemans
close date 2014-10-16 03:13:05.244302

Comments

2

you can check:

cerr << cv::getBuildInformation() << endl;

this will show you the compile time cmake output.

maybe try to rebuild it with cmake -D BUILD_PNG , so it usues its own png lib instead of your system one

berak gravatar imageberak ( 2014-05-31 13:03:16 -0500 )edit

Worked! Thank you, I compiled with flag BUILD_PNG=OFF and worked. Post your solution as a response, so i can vote you! :)

rocrates gravatar imagerocrates ( 2014-06-06 04:30:24 -0500 )edit

hehe, i actually meant the opposite: BUILD_PNG=ON, but now it seems, OFF made it use a consistent version at last.

which one is it using now , 1.2.5 or 1.5.12 ?

berak gravatar imageberak ( 2014-06-06 05:35:12 -0500 )edit

just wondering if this is really what you want, I have build 2.4.9 latest stable github release on Ubuntu14.04LTS with CUDA6.0 and there was no problem at all with the PNG lib. Putting the flag on off will result in you never being able to process any png file with openCV...

StevenPuttemans gravatar imageStevenPuttemans ( 2014-06-06 06:40:19 -0500 )edit

This is what I've undestood: by default Ubuntu 14.04 has libpng12-0 (version 1.2.5...this was my case), if you compile opencv-249 (download archive from website and compile) without cmake flag "BUILD_PNG=OFF" it will build the libpng from source contained in the opencv-249 (is libpng 1.5.12), if you see cmake results you see under Media I/O - PNG: Build... Compiling is fine, but when you try to run a java application using opencv, and this application requires libpng, you will get my error, because system is running version 1.2.5, but opencv was compiled with 1.5.12! If you put the flag, opencv will not compile libpng, but use the system library instead, so no mismatch error! I'm new to the linux world, so maybe I'm saying something wrong, but now it works!:)

rocrates gravatar imagerocrates ( 2014-06-06 12:41:33 -0500 )edit

Just to clarify, I think there are other ways to solve my issue...i tried to update system's libpng, but doesn't exist a newer version as a packet, so you can download and install a newer versiob (1.5.12 for example) but you'll have 2 different version in the system now... I was not able to tell ubuntu to use the 1.5.12 instead of its default version (1.2.5). That's why I decided to recompile opencv telling to not build libpng with its source, but use instead the system's version.

rocrates gravatar imagerocrates ( 2014-06-06 12:47:28 -0500 )edit

Same issue here, BUILD_PNG=OFF worked fine, I just wanted to point out that it is important to install libpng12-dev first

Jong Bor Lee gravatar imageJong Bor Lee ( 2014-10-15 10:03:44 -0500 )edit