Compiling Emacs.app on NEXTSPACE (CentOS 7)

enzu.ru
2 min readApr 18, 2020
Source: https://github.com/trunkmaster/nextspace

Emacs.app is the Cocoa version of Emacs. It is most often used on macOS, but is also used on the libre Cocoa implementation of GNUstep.

When I first tried to compile on NEXTSPACE, I ran into a number of issues. The fix involved patching the OS (CentOS 7) and patching Emacs. My Emacs patch was just committed to master so I’ll explain how to compile Emacs.app from the latest master branch against the latest NEXTSPACE.

First off, this article assumes that you have successfully compiled and installed the latest version of NEXTSPACE locally, and can compile regular Emacs successfully from source. Compiling regular Emacs successfully from source on CentOS 7 just requires you to keep hitting ./configure until you can determine and install all the missing packages that you need for compilation.

Patch the operating system

First, after backing it up, modify src/include/unistd.h and replace __block on line 1147 with __libc_block . Clang (required by NEXTSPACE) handles __block differently than GCC, hence why this change is required. That’s the only OS patch needed.

Per the NEWS file, this shouldn’t be a problem in glibc 2.19 and up:

The public headers no longer use __unused nor __block. This change is to support compiling programs that are derived from BSD sources and use __unused internally, and to support compiling with Clang’s -fblock extension which uses __block.

Compile Emacs

Now, run this in the emacs source directory:

source /Developer/Makefiles/GNUstep.sh
sh autogen.sh
CC=/usr/bin/clang ./configure --with-ns --with-gnustep-conf=/Library/Preferences/GNUstep.conf --with-mailutils
make

The first couple commands just sets up our environment correctly, and the configure step is the canonical way to setup Emacs.app with mailutils.

The compilation should work and you will have nextstep/Emacs.app waiting for you.

Emacs.app has some stability and visual issues, but I’ve been successfully using it for days for serious work. Hopefully the NEXTSPACE team and I can return Emacs.app to its former glory.

--

--

enzu.ru

Learning content for the GNU operating system and Lisp user space, developed through my eponymous charity (https://enzu.ru)