[solved] opencv libpng version mismatch [closed]
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...
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
Worked! Thank you, I compiled with flag BUILD_PNG=OFF and worked. Post your solution as a response, so i can vote you! :)
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 ?
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...
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!:)
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.
Same issue here, BUILD_PNG=OFF worked fine, I just wanted to point out that it is important to install libpng12-dev first