Building emacs 🐃 native 🆙

This blog post describes how to build Emacs with native comp activated.

Build gcc and JIT

Inspired from this article. cd ~/src tar xJf ~/Downloads/gcc-9.3.0.tar.xz mkdir -p build/gcc-9.3.0/jit mkdir -p build/gcc-9.3.0/all pushd build/gcc-9.3.0/jit ../../../gcc-9.3.0/configure --enable-host-shared \ --enable-languages=jit \ --disable-bootstrap \ --enable-checking=release \ --prefix=/usr/local/gcc-9.3 \ --build=x86_64-linux-gnu \ --host=x86_64-linux-gnu \ --target=x86_64-linux-gnu \ --disable-multilib \ --program-suffix=-9.3 popd pushd build/gcc-9.3.0/all ../../../gcc-9.3.0/configure --enable-languages=all \ --disable-bootstrap \ --enable-checking=release \ --prefix=/usr/local/gcc-9.3 \ --build=x86_64-linux-gnu \ --host=x86_64-linux-gnu \ --target=x86_64-linux-gnu \ --disable-multilib \ --program-suffix=-9.3 popd pushd build/gcc-9.3.0/jit make -j4 sudo make install popd pushd build/gcc-9.3.0/all make -j4 sudo make install popd

Build native emacs

Inspired from this article. export PATH=/usr/local/gcc-9.3/bin:$PATH export LIBRARY_PATH=/usr/local/gcc-9.3/lib:/usr/local/gcc-9.3/lib64:$LIBRARY_PATH export LD_LIBRARY_PATH=/usr/local/gcc-9.3/lib:/usr/local/gcc-9.3/lib64:$LD_LIBRARY_PATH cd ~/src git clone git://git.sv.gnu.org/emacs.git pushd emacs ./autogen.sh popd mkdir -p build/emacs99-99 cd build/emacs99-99 CC=gcc-9.3 ../../emacs/configure --with-mailutils --with-native-compilation make mkdir native-lisp sudo checkinstall --install=no dpkg -i ../emacs-99.99*.deb

Compile packages

(native-compile-async "~/.emacs.d/elpa/" 4 t)