compilation – Compile emacs desde la rama feature / native-comp (gccemacs) en Ubuntu

Pregunta:

Quiero compilar la rama gccemacs de Emacs. Cuando ejecuto ./configure , configuro errores de secuencia de comandos con:

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>.

Aquí hay información de la versión:

$ 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

Puedo verificar que gccjit falla compilando https://gcc.gnu.org/onlinedocs/jit/intro/tutorial01.html . Segfaults. Aquí hay un rastro de gdb:

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);

Mi sospecha es que necesito una versión más reciente de GCC, ya que Dockerfile para gccemacs instala gcc desde la fuente en la demostración Dockerfile: https://gitlab.com/koral/emacs-nativecomp-dockerfile/-/blob/master/Dockerfile

Respuesta:

Podría hacerlo funcionar con Ubuntu 18.04 y 20.04. Esta es la receta que usé.

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

ACTUALIZACIÓN: 11/03/21: He actualizado las banderas pasadas para configure . Otras cosas son iguales.

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 gccemacs
git checkout feature/native-comp
export CC=/usr/bin/gcc-10 CXX=/usr/bin/gcc-10
./autogen.sh
./configure --with-cairo --with-modules --without-compress-install --with-x-toolkit=no --with-gnutls --without-gconf --without-xwidgets --without-toolkit-scroll-bars --without-xaw3d --without-gsettings --with-mailutils --with-native-compilation --with-json --with-harfbuzz --with-imagemagick --with-jpeg --with-png --with-rsvg --with-tiff --with-wide-int --with-xft --with-xml2 --with-xpm CFLAGS="-O3 -mtune=native -march=native -fomit-frame-pointer" prefix=/usr/local
make -j2 NATIVE_FULL_AOT=1
make install

Leave a Comment

Your email address will not be published.

Scroll to Top

istanbul avukat

-

web tasarım