Ubuntu 24.04 に Emacs 31.1 (with pgtk,xwidgets) をインストール

はじめに

Ubuntu 24.04 に Emacs 31.1 をインストールしました。

インストール環境は下記です。 直近の数バージョンで、バージョンアップがある毎にNative/WSL両方の環境でもビルドしていますので、Native/WSLどちらでも同じ手順で実行できるかと思います。

  • ハードウェア : Core i5-1235U, 32GB Memory, NVMe SSD
  • OS : Windows11 / Ubuntu24.04(WSL)

下記のコンフィギュレーションとなります。

  • pgtk(Pure GTK)
  • native-compilation
  • XWidgets 有効

手順

ソースコードの取得

$ git clone --depth 1 --branch emacs-31.1 git://git.sv.gnu.org/emacs.git emacs-31.1

ビルドに必要なツールとライブラリの取得

libgccjit は 13 を使用します。

$ sudo apt update
$ sudo apt install autoconf make texinfo gnutls-bin libgccjit-13-dev gcc
$ sudo apt install zlib1g-dev \
                   libncurses-dev \
                   libgtk-3-dev \
                   xorg-dev \
                   libjpeg-dev \
                   libgif-dev \
                   libtiff-dev \
                   libgnutls28-dev \
                   librsvg2-dev \
                   libcairo-5c-dev \
                   liblcms2-dev \
                   libgpm-dev \
                   libacl1-dev \
                   libxml2-dev \
                   libotf-dev \
                   libsystemd-dev \
                   libjansson-dev \
                   libsqlite3-dev \
                   imagemagick \
                   libmagickwand-dev \
                   libmagickcore-dev \
                   libtree-sitter-dev \
                   libjansson-dev \
                   libwebkit2gtk-4.1-dev

autogen.sh

configure を生成します。

cd emacs-31.1
./autogen.sh

$ ./autogen.sh
Checking whether you have the necessary tools...
(Read INSTALL.REPO for more details on building Emacs)
Checking for autoconf (need at least version 2.65) ... ok
Your system has the required tools.
Building aclocal.m4 ...
Running 'autoreconf -fi -I m4' ...
Building 'aclocal.m4' in exec ...
Running 'autoreconf -fi' in exec ...
Configuring local git repository...
'.git/config' -> '.git/config.~1~'
git config transfer.fsckObjects 'true'
git config diff.cpp.xfuncname '!^[      ]*[A-Za-z_][A-Za-z_0-9]*:[[:space:]]*($|/[/*])
^((::[[:space:]]*)?[A-Za-z_][A-Za-z_0-9]*[[:space:]]*\(.*)$
^((#define[[:space:]]|DEFUN).*)$'
git config diff.elisp.xfuncname '^\([^[:space:]]*def[^[:space:]]+[[:space:]]+([^()[:space:]]+)'
git config diff.m4.xfuncname '^((m4_)?define|A._DEFUN(_ONCE)?)\([^),]*'
git config diff.make.xfuncname '^([$.[:alnum:]_].*:|[[:alnum:]_]+[[:space:]]*([*:+]?[:?]?|!?)=|define .*)'
git config diff.shell.xfuncname '^([[:space:]]*[[:alpha:]_][[:alnum:]_]*[[:space:]]*\(\)|[[:alpha:]_][[:alnum:]_]*=)'
git config diff.texinfo.xfuncname '^@node[[:space:]]+([^,[:space:]][^,]+)'
Installing git hooks...
'build-aux/git-hooks/commit-msg' -> '.git/hooks/commit-msg'
'build-aux/git-hooks/pre-commit' -> '.git/hooks/pre-commit'
'build-aux/git-hooks/prepare-commit-msg' -> '.git/hooks/prepare-commit-msg'
'build-aux/git-hooks/post-commit' -> '.git/hooks/post-commit'
'build-aux/git-hooks/pre-push' -> '.git/hooks/pre-push'
'build-aux/git-hooks/commit-msg-files.awk' -> '.git/hooks/commit-msg-files.awk'
'.git/hooks/applypatch-msg.sample' -> '.git/hooks/applypatch-msg'
'.git/hooks/pre-applypatch.sample' -> '.git/hooks/pre-applypatch'
You can now run './configure'.

configureの修正

Ubuntu 24.04 に対して、Emacs 30.x ではいくつかのコードの修正、環境変数の設定が必要でしたが、 Emacs 31.1 ではいずれも不要でした。 ただし、libgccjit については、libgccjit-14-dev では configure で検出されなかったかったため、libgccjit-13-dev を使用しました。

configureの実行

./configure --with-pgtk --with-native-compilation --without-pop --with-mailutils --with-imagemagick --with-tree-sitter --with-xwidgets

(参考)configure実行時のwarningについて

gtkのチェック

以前より継続して、こちらの警告は無視します。

configure: WARNING: Your version of Gtk+ will have problems with
       closing open displays.  This is no problem if you just use
       one display, but if you use more than one and close one of them
       Emacs may crash.
       See https://gitlab.gnome.org/GNOME/gtk/issues/221

ですが、そもそも、今回は pgtkビルド(Wayland)を使っているのでほぼ無関係(実害がない)と思われます。

configure結果

Configured for 'x86_64-pc-linux-gnu'.

  Where should the build process find the source code?    .
  What compiler should emacs be built with?               gcc -g3 -O2
  Should Emacs use the GNU version of malloc?             no
    (The GNU allocators don't work with this system configuration.)
  Should Emacs use a relocating allocator for buffers?    no
  Should Emacs use mmap(2) for buffer allocation?         no
  What window system should Emacs use?                    pgtk
  What toolkit should Emacs use?                          GTK3
  Where do we find X Windows header files?                Standard dirs
  Where do we find X Windows libraries?                   Standard dirs
  Does Emacs use -lXaw3d?                                 no
  Is Emacs being built for Android?                       no
  Does Emacs use the X Double Buffer Extension?           no
  Does Emacs use -lXpm?                                   no
  Does Emacs use -ljpeg?                                  yes
  Does Emacs use -ltiff?                                  yes
  Does Emacs use a gif library?                           yes -lgif
  Does Emacs use a png library?                           yes -lpng16
  Does Emacs use -lrsvg-2?                                yes
  Does Emacs use -lwebp?                                  yes
  Does Emacs use -lsqlite3?                               yes
  Does Emacs use cairo?                                   yes
  Does Emacs use -llcms2?                                 yes
  Does Emacs use imagemagick?                             yes
  Does Emacs use native APIs for images?                  no
  Does Emacs support sound?                               yes
  Does Emacs use -lgpm?                                   yes
  Does Emacs use -ldbus?                                  yes
  Does Emacs use -lgconf?                                 no
  Does Emacs use GSettings?                               yes
  Does Emacs use a file notification library?             yes (inotify)
  Does Emacs use access control lists?                    yes -lacl -lattr
  Does Emacs use -lselinux?                               no
  Does Emacs use -lgnutls?                                yes
  Does Emacs use -lxml2?                                  yes
  Does Emacs use -lfreetype?                              yes
  Does Emacs use HarfBuzz?                                yes
  Does Emacs use -lm17n-flt?
  Does Emacs use -lotf?                                   yes
  Does Emacs use -lxft?
  Does Emacs use -lsystemd?                               yes
  Does Emacs use -ltree-sitter?                           yes
  Does Emacs use the GMP library?                         yes
  Does Emacs directly use zlib?                           yes
  Does Emacs have dynamic modules support?                yes
  Does Emacs use toolkit scroll bars?                     yes
  Does Emacs support Xwidgets?                            yes
  Does Emacs have threading support in lisp?              yes
  Does Emacs support the portable dumper?                 yes
  Which dumping strategy does Emacs use?                  pdumper
  Does Emacs have native lisp compiler?                   yes
  Does Emacs use version 2 of the X Input Extension?      no
  Does Emacs generate a smaller-size Japanese dictionary? no

make

make -j$(nproc)

make install

sudo make install

その他の設定

必要に応じて post-1300 の設定を行います。

おわりに

Ubuntu 24.04 で Emacs 31.1 のビルドおよび起動が確認できました。

Copied title and URL