8

I am attempting to install emacs 25.1 on lubuntu 16.04, and having some trouble. After downloading and extracting the tar, I navigate to the emacs 25.1 directory then.. ./configure

The configuration stops when I receive the message

configure: error: The following required libraries were not found:
    libpng
Maybe some development libraries/packages are missing?
If you don't want to link with them give
     --with-png=no
as options to configure

When I try sudo apt install libpng-dev

I get the message

Note, selecting 'libpng12-dev' instead of 'libpng-dev' libpng12-dev is already the newest version (1.2.54-1ubuntu1). 0 upgraded, 0 newly installed, 0 to remove and 9 not upgraded. I tried reinstalling libpng12-dev using the below string, which didn't help at all.

sudo apt-get install --reinstall libpng12-0=1.2.54-1ubuntu1

I'm stuck here, I've googled around for a while and can't find any solutions that have actually worked.

Aaron Crump
  • 83
  • 1
  • 4
  • Looks like you have the correct (current) `libpng-dev` package. You may need to debug via the `configure` logs why Emacs thinks you have no png library. As an alternative, consider a prebuilt Emacs 25.1 for Ubuntu from this [PPA](https://launchpad.net/~ubuntu-elisp/+archive/ubuntu/ppa). – Dirk Eddelbuettel Oct 15 '16 at 23:50
  • I used the prebuilt Emacs from the PPA you linked. Thank you so much, very helpful! – Aaron Crump Oct 16 '16 at 00:04

2 Answers2

7

I have the same problem. After I checked the config.log file, I found out that because I already installed Anaconda3 python

when gcc compile emacs it uses some libpng... found in Anconda3 directory. So I remove related Anaconda3 directory in PATH, everything turns out right.

The wrong version:

configure:15301: result: -lz
configure:15407: checking for png
configure:15437: gcc -o conftest  -g3 -O2 -I/etc/anaconda3/include/libpng16       conftest.c -lpng16 -lz -lm -lX11   >&5 
/usr/bin/ld: cannot find -lpng16

The right version:

configure:15301: result: -lz
configure:15407: checking for png
configure:15437: gcc -o conftest  -g3 -O2 -I/usr/include/libpng12       conftest.c -lpng12 -lz -lm -lX11   >&5 
configure:15437: $? = 0
configure:15452: result: yes

Hope that would be helpful!

wslsqo0e
  • 86
  • 1
  • 4
  • Removing (or commenting out) the line `export PATH=/vol/home/user/miniconda3/bin:$PATH` from my .bashrc did the trick. I had to start a new terminal though, only calling `$ . .bashrc` did not work. Make sure to check if the changes are in effect, for example by checking if `which python` points to the conda folder (bad) or to the system default (good). After the installation just add the line back in. – m00am Jun 21 '17 at 11:32
1

The solution is to remove the default version of libpng-dev (1.2) and explicitly install version 1.6: sudo apt-get remove libpng-dev && sudo apt-get install libpng16-dev

Explicit versions of dependencies don't seem to be documented in the readme files.

Leo Alekseyev
  • 12,893
  • 5
  • 44
  • 44