4

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 <akrl@sdf.org>
  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

  • Did you ever resolve this? I'm having the same problem. – gct Jul 19 at 1:32
6

I could get it to work with Ubuntu 18.04 and 20.04. This is the recipe I used.

sudo apt install libxpm-dev libgif-dev libjpeg-dev libpng-dev libtiff-dev libx11-dev libncurses5-dev automake autoconf texinfo libgtk2.0-dev
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa
sudo apt install gcc-10 g++-10 libgccjit0 libgccjit-10-dev libjansson4 libjansson-dev
git clone git://git.sv.gnu.org/emacs.git
git checkout feature/native-comp
export CC=/usr/bin/gcc-10 CXX=/usr/bin/gcc-10
./autogen.sh 
./configure --with-nativecomp --with-json CFLAGS="-O3 -mtune=native -march=native -fomit-frame-pointer"
make -j2 NATIVE_FULL_AOT=1
make install
| improve this answer | |
  • 2
    The key part of this answer is sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa; the default repositories contain a broken version of libgccjit that causes the smoke test to fail. – Clément Sep 28 at 16:48
0

In my case, I'm in debian stable with the version 8.3.0 and had no trouble installing it, maybe you can try to downgrade gcc and install libgccjit-8-dev.

Good luck!

| improve this answer | |
0

On Fedora 32 (almost latest update as of 5 Sept 2020), I got the same error. But strangely, libgccjit was not installed. I installed it and the corresponding -devel package - and the compilation worked nicely.

If anyone gets here searching for this error - check if you have libgccjit installed at all.

dnf install libgccjit-devel.x86_64 libgccjit.x86_64
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.