First, let’s install some build dependencies:
build-essnetial
should install necessary tools to build C/C++ programs such as gcc, g++, make, gdb and dpkg.
The rest packages install pre-compiled libraries.
Besides these packages, there are two important packages to support Lisp native compilation:
After installing them, make sure to export the path in the current session, otherwise the compiler will not realize it.
The last thing to do is install a bunch of X and GTK-3 development libraries for Emacs GUI, and another bunch of image processing libraries.
Without the above packages, one may encounter the following error when configuring the Emacs build:
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+ or Motif. Also make sure you have development files for image handling, i.e. tiff, gif, jpeg, png and xpm.