4

When trying to install the new emacs I'm getting an error about libpng15 being missing:

$ ./configure
...
$ make all
...
/usr/bin/ld: cannot find -lpng15
collect2: ld returned 1 exit status

I have libpng12 installed. How can I make emacs use that library instead?

Below is the configuration output of ./configure.

Configured for `x86_64-unknown-linux-gnu'.

  Where should the build process find the source code?    .
  What compiler should emacs be built with?               gcc -std=gnu99 -g3 -O2
  Should Emacs use the GNU version of malloc?             yes
      (Using Doug Lea's new malloc from the GNU C Library.)
  Should Emacs use a relocating allocator for buffers?    no
  Should Emacs use mmap(2) for buffer allocation?         no
  What window system should Emacs use?                    x11
  What toolkit should Emacs use?                          GTK2
  Where do we find X Windows header files?                Standard dirs
  Where do we find X Windows libraries?                   Standard dirs
  Does Emacs use -lXaw3d?                                 no
  Does Emacs use -lXpm?                                   yes
  Does Emacs use -ljpeg?                                  yes
  Does Emacs use -ltiff?                                  yes
  Does Emacs use a gif library?                           yes -lgif
  Does Emacs use a png library?                           yes -lpng15 -lz -lm
  Does Emacs use -lrsvg-2?                                no
  Does Emacs use imagemagick?                             no
  Does Emacs support sound?                               yes
  Does Emacs use -lgpm?                                   no
  Does Emacs use -ldbus?                                  yes
  Does Emacs use -lgconf?                                 yes
  Does Emacs use GSettings?                               no
  Does Emacs use a file notification library?             yes -lgio (gfile)
  Does Emacs use access control lists?                    no
  Does Emacs use -lselinux?                               yes
  Does Emacs use -lgnutls?                                yes
  Does Emacs use -lxml2?                                  yes
  Does Emacs use -lfreetype?                              yes
  Does Emacs use -lm17n-flt?                              no
  Does Emacs use -lotf?                                   no
  Does Emacs use -lxft?                                   yes
  Does Emacs directly use zlib?                           yes
  Does Emacs use toolkit scroll bars?                     yes

ImageMagick is installed, so I'm not sure why Emacs doesn't see that. But more importantly, Emacs seems to think the libpng15 is available.

And earlier...

checking png.h usability... yes
checking png.h presence... yes
checking for png.h... yes
checking for png_get_channels in -lpng... yes
checking whether png_longjmp is declared... no
  • 1
    Maybe the libpng12-dev library is needed? Didn't ./configure report anything regarding libpng12? – piwi Oct 24 '14 at 14:51
  • nope. See that output above. – wdkrnls Oct 24 '14 at 16:43
4

I suffered from the same situation. Investigating in the configure.ac file reveals that the configure script in my case got the -lpng15 from the invocation of the libpng-config utility:

dnl Some systems, eg NetBSD 6, only provide eg "libpng16", not "libpng".
lpng=`libpng-config --libs 2> /dev/null`
case $lpng in
  -l*) : ;;
  *) lpng="-lpng" ;;
esac
LIBPNG="$lpng -lz -lm"

Checking for the result that the utility yields, confirms the source of the link flag. In my case the error is due to a libpng installation from my external anaconda environment that gets mixed up with the build (and the anaconda env lacks the dev files for building... else it probably would have worked).

~/desk/emacs-24.4$ libpng-config --libs
   -lpng15
~/desk/emacs-24.4$ which libpng-config
   /opt/anaconda/python2.7/bin/libpng-config

So, my guess is that you also should have a look at the PATH settings of your build environment and test where the libpng-config comes from. Correct it and then re-run configure.

After correcting the PATH my build works cleanly.

Good luck!

  • 1
    anaconda is responsible for my issue as well. – wdkrnls Oct 28 '14 at 14:49
  • The same problem occurs in Ubuntu 14.10 when installing emacs24.4 if anaconda is installed. The answer by dfeich works - thanks! Move .bashrc to .bashrc_bak and remove the references to anaconda from the path in .bashrc. Start a new terminal window to do the build. Then mv .bashrc_bak to .bashrc. – billmrn Mar 4 '15 at 20:30
  • Throw in Canopy/Enthought. Got this error on a 25.1 configure on U16.04. Comment out all your Canopy lines (2 lines in my .bashrc). – 147pm Sep 19 '16 at 3:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.