Ask Your Question
0

How to compile opencv with local libpng version?

asked 2017-02-15 10:04:52 -0600

User4834Tmp gravatar image

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.

edit retag flag offensive close merge delete

Comments

" I did not build it explicitly" You mean in CMake you set WITH_PNG=ON BUILD_PNG=OFF ?

LBerger gravatar imageLBerger ( 2017-02-15 10:09:16 -0600 )edit

BUILD_PNG=OFF

User4834Tmp gravatar imageUser4834Tmp ( 2017-02-15 14:40:09 -0600 )edit

I tried WITH_PNG=ON and it worked. It no longer had the dependency on libpng16.

User4834Tmp gravatar imageUser4834Tmp ( 2017-02-15 14:45:28 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-02-15 14:49:14 -0600

LBerger gravatar image

updated 2017-02-15 15:05:16 -0600

search in your cmakecache.txt. WITH_PNG ON mean you want to use PNG for imread. BUILD_PNG=ON means that opencv will build PNG using own source file in 3rd party folder

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-02-15 10:04:52 -0600

Seen: 4,481 times

Last updated: Feb 15 '17