How to compile opencv with local libpng version?
I'm on a ubuntu-like Linux machine without root access. I have a local version of libpng-1.6.26 that I installed in my home account (the default libpng is libpng12). I successfully built opencv-2.4.13 with a cmake command that explicitly referenced my local libpng:
cmake -DPNG_INCLUDE_DIR=/home/tmpguest/INSTALL/libpng/install -DPNG_LIBRARY_RELEASE=/home/tmpguest/INSTALL/libpng/lib/libpng16.so ../
I built my other software, but then the problem occurs. When I try to run my software, I get this complaint:
libpng warning: Application built with libpng-1.5.14 but running with 1.6.26
This is confusing to me. I run 'ldd' on some of the opencv libraries and I see both libpng-1.6.26 and libpng12:
libpng16.so.16 => /home/tmpguest/INSTALL/libpng/lib/libpng16.so.16 (0x00007fffe9944000)
libpng12.so.0 => /usr/lib64/libpng12.so.0 (0x00007fffe45ff000)
So, where does the libpng-1.5.14 warning come from? I think the libpng12 comes from other libraries that opencv is linked with (libcairo), but I don't know where the libpng-1.5.14 warning comes from. However, source code for libpng version 1.5.12 is included in my opencv tarball (from github) in the opencv-2.4.13/3rdparty directory, but I did not build it explicitly. Is that where the libpng-1.5.14 warning comes from?
How can I fix this problem? I think I need to build opencv libraries that only link in one libpng library to get rid of the multiple libpng warning.
" I did not build it explicitly" You mean in CMake you set WITH_PNG=ON BUILD_PNG=OFF ?
BUILD_PNG=OFF
I tried WITH_PNG=ON and it worked. It no longer had the dependency on libpng16.