libpng "png_set_longjmp_fn" not found

10,455

Solution 1

Perhaps you have built with libpng-1.6.8 but are linking to an earlier version of libpng. The "png_set_longjmp_fn()" API was introduced in libpng-1.4.x. Ubuntu 13:10 currently comes with libpng-1.2.49 (see /usr/include/libpng12), which does not supply png_set_longjmp_fn().

Solution 2

If you do this on an older Playstation Portable program you also might have stale libraries in the source directory. Run rm *.a then make clean which happened to fix that error message for me.

Solution 3

In my case, I have 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 that rely on the new interface, you need to add

CPPFLAGS="-I/usr/local/include $CPPFLAGS"
LDFLAGS="-L/usr/local/lib $LDFLAGS"

this will 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))))

from the newer interface

Share:
10,455
foothill
Author by

foothill

Updated on June 17, 2022

Comments

  • foothill
    foothill almost 2 years

    I'm using libpng from ubuntu and when I try to compile a c++ file I get

    undefined reference to `png_set_longjmp_fn'

    I'm using libpng version 1.6.8

    If you are interested in reading the code please let me know, but I do not this has to do with my bad code.

    Thank you in advance.