Compiling Emacs 29.4 on Rocky Linux 9 with treesitter support

Emacs is an extensible, customizable, free text editor that supports a lot of plugins and other useful tools. Some features include syntax coloring, unicode support, customizable interface, project planner, mail client, debugging interfaces, and a packaging system for downloading extensions.

Compiling Emacs 29.4 on Rocky Linux 9 with treesitter support
An image of the Emacs Application

Emacs is an extensible, customizable, free text editor that supports a lot of plugins and other useful tools. Some features include syntax coloring, unicode support, customizable interface, project planner, mail client, debugging interfaces, and a packaging system for downloading extensions.

Most if not all of this software should already be installed on Rocky Linux, but just to make sure, here is the yum command to install the dependencies.

yum install ca-certificates curl gpg libgccjit gcc jansson jansson-devel texinfo libgccjit-devel nettle nettle-devel gmp gmp-devel libtasn1-devel libunistring-devel p11-kit-devel ncurses-devel
After the install has completed run the following command.
gcc --version
Output should look like this:

gcc (GCC) 11.4.1 20231218 (Red Hat 11.4.1-3)
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Run the following commands

export CC=gcc
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
LD_LIBRARY_PATH=/usr/local/lib

Clone the Tree-Sitter Code Repo. In this case I am using the v0.24.7 version, pick the version that you would like to use. If you want to clone the bleeding edge remove the version number.
git clone https://github.com/tree-sitter/tree-sitter.git v0.24.7
Build tree-sitter first. In my case I will cd to the version I downloaded.
cd v0.24.7
Then run the following commands

make
make install

I also needed to download and build gnutls to do this, I ran the following commands:

wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.7/gnutls-3.7.11.tar.xz
./configure
make
make check
make install

All of my libs got installed to /usr/local/lib/ and for some reason my ldconfig would not pick up the installed libs. To fix this I had to do the following:

nano /etc/ld.so.conf
This is what my ld.so.conf file looks like with the edits that I made.

include ld.so.conf.d/*.conf
/usr/local/lib/

After editing the file, run ldconfig

You can also run ldconfig -v | grep tree to make sure the treesitter lib has been found by ldconfig.

Then run the following commands to download, build, and install emacs.

git clone https://git.savannah.gnu.org/git/emacs.git -b emacs-29.4
./autogen.sh
./configure --with-tree-sitter --with-json --with-modules --without-x --with-native-compilation
make
make install

To see all the options that can be passed to configure run ./configure --help

Subscribe to The Encrypted Edge

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe