I haven’t used Ubuntu much recently after switching several systems to Manjaro, but had to set up a laptop with XUbuntu 17.04. That came with Emacs 24.5 as the default emacs package, and as skeeto pointed out in the comments, with a separate emacs25 package for Emacs 25.1. I tend to run the latest release Emacs everywhere out of habit, so I revisited my build instructions to build a current Emacs on Ubuntu and its derivates. The good news is that in thanks to some changes in the Emacs build, the build is as straightforward as it used to be prior to the combination of Ubuntu 16.10 and Emacs 25.1. In other words, no need to remember to switch off PIE as was necessary when building GNU Emacs 25.1 on Ubuntu 16.10.
Here’s a brief recap of the build steps so you don’t have to go back and click your way through my old posts.
First, if you haven’t enabled the ‘source code’ repository in Ubuntu’s software sources, do so now. If you don’t, you’ll run into the following error when installing the build dependencies for Emacs:
E: You must put some 'source' URIs in your sources.list
Assuming you have added the source code repositories to your software sources, execute the following commands. The first command installs the build tools, the second one installs all the build dependencies for the stock Emacs build. Those dependencies will give you a fully functioning GUI Emacs. If you need additional third party libraries for additional functionality that aren’t covered by the regular Ubuntu Emacs build dependencies, make sure you install those also. I usually go with the stock configuration so for me, these are the two commands I need to run:
sudo apt install build-essential sudo apt build-dep emacs25
On my fresh install of XUbuntu 17.04, the build-essential packages were already installed, so it may not be necessary to execute that step any longer. However, it was necessary in the past so I’m still leaving it in there as it makes sure you have the normal build setup.
You can install the build-deps for either the emacs or the emacs24 package instead of the one for the emacs25 package as I show in the example above. They all appear to install the same dependencies as trying to install all three doesn’t appear to result in any additional packages being installed.
At this point, it’s time to download the GNU Emacs 25.2 tarball from your favourite GNU mirror, extract it to a suitable place and do the usual configure/make/make install dance. I prefer to install my home built binaries in a local subtree in my user directory, hence the $HOME/local prefix passed to configure:
./configure --prefix=$HOME/local make && make install
At this point, we’re good to go:
timo-xubuntu-VirtualBox% emacs --version GNU Emacs 25.2.1 Copyright (C) 2017 Free Software Foundation, Inc. GNU Emacs comes with ABSOLUTELY NO WARRANTY. You may redistribute copies of GNU Emacs under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING.
The instructions above will also work for building Emacs 25.2 on older versions of Ubuntu, although you have to make sure that you pick the correct build-dep package to install the build dependencies first.