Ubuntu installation Dlib appears dlib.so:undefined SYMBOL:PNG_SET_LONGJMP_FN

Source: Internet
Author: User

Refer to the online tutorial installation Dlib


sudo apt-get install libboost-python-dev cmakesudo pip install dlib
Installation Tutorial 2

Go to the official website to download the installation package, unzip

Tools required to install the compilation

sudo apt-get install CMake
sudo apt-get install Libboost-python-dev

Go to Dlib's directory sudo python setup.py install
the following error occurred
$ Pythonpython2.7.12 (default, Nov 19 2016, 06:48:10) [GCC5.4.0 20160609] on Linux2type" Help","Copyright","credits" or "License" forMore information.>>>ImportDlibtraceback (most recent): File"<stdin>", Line 1,inch<module>importerror:./dlib.so:undefined SYMBOL:PNG_SET_LONGJMP_FN>>>

Cause of the problem

This is the time to compile the project on Linux, a dynamic library layer used by a function implementation is not found,

The system installed libpng16.so.16.29.0*, readelf-s the next file, there is png_set_longjmp_fn this symbol

lrwxrwxrwx  1 root root         19 June   1 10:49 libpng16.so libpng16.so.16.29.0*lrwxrwxrwx  1 root Root         19 June   1 10:49 libpng16.so.16-libpng16.so.16.29.0*-rwxr-xr-x  1 root root     926416 June   1 10:49 libpng16.so.16.29.0*

Find cause Discovery:

There is also a location in the system where the old version of Libpng12 is installed,

/lib/x86_64-linux-gnu

-rwxrwxrwx 1 root root 149800 October 19:21 libpng12.so.0*-rwxrwxrwx 1 root root 149800 October 19:21 libpng12.so.0.54.0*

In this version of the libpng is not png_set_longjmp_fn function definition, compile the relevant library dlib dependent on the time,

The first is the link to/lib/x86_64-linux-gnu/libpng12.so.0 cannot find the function, error.

Workaround 1: (recommended)

Cd/lib/x86_64-linux-gnu

sudo rm libpng12.so.0 (delete old version of Libpng library here)

sudo rm libpng12.so.0.54.0

sudo ln-s/usr/local/lib/libpng16.so.16./libpng16.so.16 (Establish a link to libpng16)

When the system compiles, it links to/usr/local/lib/libpng16.so.16 's library

Workaround 2:

PNG Usage Process issues Summary:

(1) libpng "PNG_SET_LONGJMP_FN" not found

Solution Ideas

in my case, I has the old PNG 1.2 came with my Ubuntu installed IN/USR. I installed the 1.6.x in/usr/local. In my make system, the default Include/usr/include and Linking/usr/lib were picked up. When compiling any software this rely on the new interface, you need to add

cppflags= "-i/usr/local/include $CPPFLAGS"
ldflags= "-l/usr/local/lib $LDFLAGS"

This'll pick up

grep png_set_longjmp_fn png.h
Png_export (8, jmp_buf*, PNG_SET_LONGJMP_FN, Png_structrp png_ptr,
(*PNG_SET_LONGJMP_FN (png_ptr), longjmp, (sizeof (JMP_BUF) )))

when compiling the program, add it to the makefile .

cppflags= "-i/usr/local/include $CPPFLAGS"
ldflags= "-l/usr/local/lib $LDFLAGS"
make the dependent libpng library point to the latest LIBPNG16 you have installed

 

Ubuntu installation Dlib appears dlib.so:undefined SYMBOL:PNG_SET_LONGJMP_FN

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.