3

To have the latest emacs, on ubuntu 22.04 I activated the ppa https://launchpad.net/~ubuntu-elisp/+archive/ubuntu/ppa and installed emacs-snapshot from there. When starting it I get the warning:

You are trying to run Emacs configured with the "pure-GTK" interface under the X Window System. That configuration is unsupported and will lead to sporadic crashes during transfer of large selection data. It will also lead to various problems with keyboard input.

This happens when I log in with either xfce or Ubuntu(standard) on the login screen. My screen manager is lightdm, if that has any relevance here.

Obviously I should not be using this version of emacs or start it with some different environment or command line argument. Is there any way to start it correctly? Is there a more suitable ppa to get a rather new version of emacs?

Harald
  • 218
  • 1
  • 8

2 Answers2

4

This means that it was compiled with pure-GTK (Wayland). You are seeing this warning as you are using X instead. I am not aware of another ppa, but there probably is one.

You could use the 'latest/edge' version of the snap instead:

sudo snap install emacs --edge --classic

Or even better imo just compile it yourself which is actually very easy and quite fast:

# Install dependencies for Ubuntu 22.04
# In older releases of Ubuntu some dependencies have other names or are not 
# available. If you have Ubuntu 21.04 or an older release make sure to install 
# tree-sitter from source to get native tree-sitter support.
# Got the dependencies from the snap and from 'apt-cache depends emacs-gtk'.

sudo apt install -y autoconf automake bsd-mailx dbus-x11 debhelper dpkg-dev \
    gcc-10 libacl1-dev libasound2-dev libdbus-1-dev libgccjit-10-dev \
    libgif-dev libgnutls28-dev libgpm-dev libgtk-3-dev libjansson-dev \
    libjpeg-dev liblcms2-dev liblockfile-dev libm17n-dev libncurses5-dev \
    liboss4-salsa2 libotf-dev libpng-dev librsvg2-dev libselinux1-dev \
    libsystemd-dev libtiff-dev libxi-dev libxml2-dev libxpm-dev libxt-dev \
    procps quilt sharutils texinfo zlib1g-dev gvfs language-pack-en-base \
    libasound2 libaspell15 libasyncns0 libatk-bridge2.0-0 libatk1.0-0 \
    libatspi2.0-0 libbrotli1 libc6 libc6-dev libcairo-gobject2 libcairo2 \
    libcanberra-gtk3-0 libcanberra-gtk3-module libcanberra0 libdatrie1 \
    libdb5.3 libdrm2 libegl1 libepoxy0 libflac8 libfontconfig1 libfreetype6 \
    libgbm1 libgccjit0 libgcc-s1 libgdk-pixbuf2.0-0 libgif7 libgl1 \
    libglvnd0 libglx0 libgpm2 libgraphite2-3 libgstreamer-gl1.0-0 \
    libgstreamer-plugins-base1.0-0 libgstreamer1.0-0 libgtk-3-0 \
    libgudev-1.0-0 libharfbuzz-icu0 libharfbuzz0b libhyphen0 libice6 \
    libicu70 libisl23 libjansson4 libjbig0 libjpeg-turbo8 liblcms2-2 \
    liblockfile1 libltdl7 libm17n-0 libmpc3 libmpfr6 libnotify4 libnss-mdns \
    libnss-myhostname libnss-systemd libogg0 liborc-0.4-0 libotf1 \
    libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpixman-1-0 \
    libpng16-16 libpulse0 librsvg2-2 libsasl2-2 libsecret-1-0 libsm6 \
    libsndfile1 libsoup2.4-1 libssl3 libstdc++6 libtdb1 libthai0 libtiff5 \
    libvorbis0a libvorbisenc2 libvorbisfile3 libwayland-client0 \
    libwayland-cursor0 libwayland-egl1 libwayland-server0 libwebp7 \
    libwebpdemux2 libwoff1 libx11-6 libx11-xcb1 libxau6 libxcb-render0 \
    libxcb-shm0 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxdmcp6 \
    libxext6 libxfixes3 libxi6 libxinerama1 libxkbcommon0 libxml2 libxpm4 \
    libxrandr2 libxrender1 libxslt1.1 libyajl2 libwebp-dev libtree-sitter0 \
    libtree-sitter-dev emacs-bin-common emacs-common libcairo2-dev \
    libdbus-1-3 libfontconfig1-dev libfreetype6-dev libglib2.0-0 libgmp10 \
    libgnutls30 libgpm2 libharfbuzz0b libjpeg8-dev libtinfo-dev \
    build-essential libxfixes-dev libxrender-dev libsqlite3-dev libc6 \
    libc6-dev libenchant-2-dev
    
# Clone Emacs master
cd ~
git clone --depth 1 git://git.sv.gnu.org/emacs.git

# Install it

export CC="gcc-10" CXX="gcc-10"
./autogen.sh
# Turns native compilation on. Remove if you don't want this.
./configure --with-json --with-native-compilation
make -j $(nproc)
sudo make install
Hubisan
  • 1,623
  • 7
  • 10
  • To speed up compilation, I'd say `make -j $(nproc)` to take advantage of all the available cores on your system. – g-gundam Dec 22 '22 at 08:57
  • 1
    @g-gundam Thanks for the input, edited the code accordingly. And will use this myself next time :-) – Hubisan Dec 22 '22 at 09:11
2

Another PPA for Emacs is the one from kelleyk. As of this writing, the latest version it has is 28.1, and it's not built with pgtk so Xorg users won't get that warning.

If you're going to try this one, completely uninstall the emacs from the first PPA before installing this one. You may also need to remove the first PPA too, but I'm not sure. Also, if you want native compilation enabled, you have to explicitly install emacs28-nativecomp.

g-gundam
  • 1,096
  • 1
  • 3
  • 13