I want to compile the gccemacs branch of Emacs. When I run ./configure
, the configure script errors with:
cd emacs
git checkout feature/native-comp
./autogen.sh
./configure --with-nativecomp
configure: error: Installed libgccjit has failed passing the smoke test.
You can verify it yourself compiling:
<https://gcc.gnu.org/onlinedocs/jit/intro/tutorial01.html>.
Please report the issue to your distribution.
Here instructions on how to compile and install libgccjit from source:
<https://gcc.gnu.org/wiki/JIT>.
Here's some version info:
$ cd emacs/
$ git log -1
commit 2593bbee51f4d15d3a4fc1d4e2e3b215222f783a (HEAD -> feature/native-comp, origin/feature/native-comp)
Author: Andrea Corallo <[email protected]>
Date: Sat Jul 4 15:53:15 2020 +0100
* Relax constant folding rules
* lisp/emacs-lisp/comp.el (comp-function-optimizable-p): No need to
check for operands or result to be fixnums.
$ uname -r
5.4.0-7634-generic
$ gcc --version
gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0
I can verify that gccjit fails by compiling https://gcc.gnu.org/onlinedocs/jit/intro/tutorial01.html. It segfaults. Here's a gdb trace:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7566d63 in ?? () from /lib/x86_64-linux-gnu/libgccjit.so.0
(gdb) where
#0 0x00007ffff7566d63 in ?? () from /lib/x86_64-linux-gnu/libgccjit.so.0
#1 0x00007ffff7566e85 in ?? () from /lib/x86_64-linux-gnu/libgccjit.so.0
#2 0x00007ffff678b2a1 in ?? () from /lib/x86_64-linux-gnu/libgccjit.so.0
#3 0x00007ffff678d8d1 in ?? () from /lib/x86_64-linux-gnu/libgccjit.so.0
#4 0x00007ffff678e9dd in ?? () from /lib/x86_64-linux-gnu/libgccjit.so.0
#5 0x00007ffff678ea68 in ?? () from /lib/x86_64-linux-gnu/libgccjit.so.0
#6 0x00007ffff678d32b in ?? () from /lib/x86_64-linux-gnu/libgccjit.so.0
#7 0x00007ffff6784851 in ?? () from /lib/x86_64-linux-gnu/libgccjit.so.0
#8 0x00007ffff67775b6 in gcc_jit_context_compile () from /lib/x86_64-linux-gnu/libgccjit.so.0
#9 0x00005555555555a5 in main (argc=1, argv=0x7fffffffda38) at hello.c:99
(gdb) list
62
63 gcc_jit_block *block = gcc_jit_function_new_block (func, NULL);
64
65 gcc_jit_block_add_eval (
66 block, NULL,
67 gcc_jit_context_new_call (ctxt,
68 NULL,
69 printf_func,
70 2, args));
71 gcc_jit_block_end_with_void_return (block, NULL);
My suspicion is that I need a more recent version of GCC, since the Dockerfile for gccemacs installs gcc from source in the demo Dockerfile: https://gitlab.com/koral/emacs-nativecomp-dockerfile/-/blob/master/Dockerfile
feature/native-comp
branch was merged, and therefore is deprecated (and deleted upstream). If using git, checkout eitheremacs-28
(or a release branch for any later version), or else use the unstablemaster
branch (if you want to be on the bleeding edge). Not using git, you can build from the tarball for any release (or pretest or release candidate) for Emacs 28 or later.