Instructions for installing Emacs 28 on CentOS 7, and also enabling the new Native Comp feature recently merged in.
Note that this is similar to compiling Emacs 27, but requires extra dependencies to enable native compilation.
At the time of this writing, there is no official Emacs 28 release yet. For now, we can just use the latest from the master branch. Keep that in mind if are worried about stability.
libgccjit and a newer version of GCC, first enable the Software Collections (SCL) yum repository:
sudo yum install centos-release-scl
Install the rest of the dependencies:
# Note: This installs dependencies for X11 as well. Change this and the ./configure below if you don't want any X11 deps sudo yum install \ GConf2-devel \ Xaw3d-devel \ devtoolset-9-gcc \ devtoolset-9-libgccjit-devel \ dbus-devel \ dbus-glib-devel \ dbus-python \ gcc \ giflib-devel \ gnutls-devel \ gpm-devel \ gtk+-devel \ gtk2-devel \ ImageMagick \ ImageMagick-devel \ jansson-devel \ libX11-devel \ libXft-devel \ libXpm-devel \ libjpeg-devel \ libpng-devel \ libtiff-devel \ libungif-devel \ make \ ncurses-devel \ pkgconfig \ texi2html \ texinfo
Clone the emacs git repo and checkout the master branch. At the time of writing, there are no official 28 tags. You can use
git tag -l to check if there are any yet, and then check out one of those tags instead of using the latest HEAD.
git clone https://git.savannah.gnu.org/git/emacs.git cd emacs
Compile and install
Run autogen and configure. When running
./configure, double check the output to ensure any features you need are enabled. E.g.: Look for
Does Emacs use -ljansson? yes to make sure native json support will be compiled in. If something you need is not enabled, additional dependencies may need to be installed first.
source /opt/rh/devtoolset-9/enable ./autogen.sh PKG_CONFIG_PATH=/usr/lib64/pkgconfig ./configure --without-selinux --with-native-compilation
Compile and install. Should go to
/usr/local/bin by default, but can be changed with options to
NATIVE_FULL_AOT=1 causes all elisp files included in the Emacs distribution to be compiled ahead of time instead of after startup.
make -j4 NATIVE_FULL_AOT=1 && sudo make install