Building Emacs 25.2 on XUbuntu 17.04

I haven’t done much with Ubuntu recently, 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.
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.

Building Emacs 25.1 on Ubuntu 16.10

A reader of this blog kindly pointed out that my instructions for building Emacs 25.1 on Ubuntu 16.10 result in a core dump when the build process bootstraps emacs. I only tested the instructions on 16.04 so I hadn’t run into this issue yet.

The core dump on 16.10 appears to be a known issue and there is a workaround. Instead of running configure with just the prefix argument, run it as follows:

./configure CFLAGS=-no-pie --prefix=$HOME/local

The in-depth bug description is here in message #38. The short version is that gcc in Ubuntu 16.10 defaults to building code with -pie and this breaks Emacs. Turning off -pie results in a working executable.

How to build GNU Emacs 25.1 on (X)Ubuntu 16.04

Now that GNU Emacs 25.1 has been released, it is time for my customary “how to install Emacs 25.1 on a recent Ubuntu” post. In my case I’m using XUbuntu 16.04, but the instructions are pretty much the same for just about every recent Ubuntu version. The package versions of the referenced packages differ, but the package names haven’t changed since I first published one of these posts.

Read More

Installing Google Chrome on Ubuntu 15.04

Yes, I know Ubuntu and Xubuntu already come with Chromium in their official package repositories, but sometimes it does help to have the official/commercial version installed in addition to the Open Source one. I actually both installed right now, plus Firefox and Vivaldi. You could almost think I’m some sort of web developer or something.

The Google Chrome installation instructions for 14.04 on Ubuntu Portal also work fine for 15.04 with one wrinkle. If you use the installation via PPA method, you need to run the following command to actually install the stable version of Chrome:

sudo apt-get install google-chrome-stable

The page above lists the command as sudo apt-get install google-chrome but that doesn’t work for me on 15.04.

I would recommend installing Chrome via PPA as that will integrate into the automatic update process. One less thing to think about when keeping your machine up to date.