27

I am trying to compile emacs on Ubuntu 12.04. This is because I want to use Emacs 24.2.

However, I am getting the following error. How can I fix it?

checking for long file names... yes
checking for X... no
checking for X... true
configure: error: You seem to be running X, but no X development libraries
were found.  You should install the relevant development files for X
and for the toolkit you want, such as Gtk+, Lesstif or Motif.  Also make
sure you have development files for image handling, i.e.
tiff, gif, jpeg, png and xpm.
If you are sure you want Emacs compiled without X window support, pass
  --without-x
to configure.
Kevin Bowen
  • 19,395
  • 55
  • 76
  • 81
michael
  • 5,879
  • 9
  • 26
  • 27

2 Answers2

30

I used to do it this way:

sudo apt-get install build-essential texinfo libx11-dev libxpm-dev libjpeg-dev libpng-dev libgif-dev libtiff-dev libgtk-3-dev libncurses-dev libgnutls28-dev
# for gtk2 build replace libgtk-3-dev with libgtk2.0-dev

git clone --depth=1 git://git.savannah.gnu.org/emacs.git
cd emacs
./autogen.sh # not needed when installing from tarball
./configure
make bootstrap
sudo make install

To build docs:

make docs
# or build just the format you want:
make info
make dvi
make html
make pdf

But now I just use the package

sudo add-apt-repository -y ppa:ubuntu-elisp
sudo apt-get update
sudo apt-get install emacs-snapshot
Adobe
  • 3,791
  • 4
  • 28
  • 46
  • Will it be installing `emacs v28.1`? or whatever the latest one is? – alper Feb 21 '21 at 11:35
  • 1
    @alper if you mean via `apt-get`, then yes `emacs-snapshot` means latest "trunk" version. I'm still installing emacs that way, and my current emacs says `GNU Emacs 28.0.50 of 2021-02-12`. – Adobe Feb 21 '21 at 11:48
15

If you run

sudo apt-get build-dep emacs23

that installs everything that is needed to compile the emacs23 package. Quite likely that's enough to compile Emacs 24.2, too.

Florian Diesch
  • 86,013
  • 17
  • 224
  • 214
  • 5
    Or, in Ubuntu 14: `sudo apt-get build-dep emacs24` – nnyby Oct 22 '14 at 15:23
  • 5
    If you are running >=16.04 and get ```E: You must put some 'source' URIs in your sources.list```, see [this question](http://askubuntu.com/questions/761357/how-to-automatically-update-etc-apt-sources-list-with-source-uris-on-ubuntu-16) – dinosaur Sep 26 '16 at 23:48
  • very helpful, can be adapted for installation of emacs 26.1 on Ubuntu 18.04 or Linux Mint 19 "Tara": `sudo apt-get build-dep emacs25` – sebisnow Nov 20 '18 at 09:45