Getting this on running ./configure on Ubuntu 20.04 for the new 27.1 install

checking for X... no
checking for X... true
configure: error: You seem to be running X, but no X development libraries
were found.  You should install the relevant development files for X
and for the toolkit you want, such as Gtk+ or Motif.  Also make
sure you have development files for image handling, i.e.
tiff, gif, jpeg, png and xpm.
If you are sure you want Emacs compiled without X window support, pass
to configure.

I've been running 26.3 just fine with X. I should have all the necessary libs from that install. What should I do here?

  • 1
    Did you build your own 26.3 or did you use the pre-built one? The devel libraries are needed when building, but not when running emacs.
    – NickD
    Commented Aug 11, 2020 at 16:11
  • See askubuntu.com/questions/1167278/… for the basic libx11-dev, but it's not going to be enough: you'll need more X devel libraries, probably the gtk+ devel library and libraries for all the graphics formats you want emacs to recognize (png, gif, jpg, imagemagick etc), font libraries, and various others (mostly optional). The good thing is that once you have them all installed (and you upgrade your system in place instead of reinstalling) you won't have to worry about it again.
    – NickD
    Commented Aug 11, 2020 at 16:30
  • 2
    apt build-dep emacs should get you quite a way there.
    – rpluim
    Commented Aug 11, 2020 at 16:41

1 Answer 1


As @rpluim comments:

apt build-dep emacs should get you quite a way there.

It will probably be missing some things which are both desirable and new for 27.1 however, such as libjansson-dev.

I'm not sure about Ubuntu 20.04 but on my 18.04 machine my manual prerequisite list of packages for building Emacs is:

autoconf automake g++ gcc gnu-standards libdbus-1-dev libfreetype6-dev libgif-dev libgnutls-dev libgnutls28-dev libjpeg-dev libmagickcore-dev libmagickwand-dev libncurses-dev libpng-dev librsvg2-dev libtiff-dev libxaw7-dev libxft-dev libxml2-dev libxpm-dev libz-dev libjansson-dev make ncurses-term texinfo ttf-ancient-fonts

(I expect that I can remove the libmagick* packages at this point, as from 27.1 Emacs no longer defaults to using Image Magick.)

I'll note that I build Emacs --with-x-toolkit=lucid rather than using the default GTK; but I expect that apt build-dep emacs would provide all the necessary GTK packages.

YMMV, and I recommend that you pay attention to the final summary output from configure, and review anything you're unsure of.

  • 5
    I ran this sudo apt-get install build-essential texinfo libx11-dev libxpm-dev libjpeg-dev libpng-dev libgif-dev libtiff-dev libgtk2.0-dev libncurses-dev gnutls-dev libgtk-3-dev and finally got configure to not complain.
    – 147pm
    Commented Aug 12, 2020 at 2:17
  • @147pm Your instructions are verified to build Emacs 27.2 from source on my Xubuntu 20.04 installation. Thank you! FWIW: The PPA at launchpad.net/~kelleyk/+archive/ubuntu/emacs mentioned by ubuntuhandbook.org/index.php/2021/03/gnu-emacs-27-2-released only provides Emacs 26.x (as of this posting; maybe someone will fix that at some point).
    – bgoodr
    Commented Sep 26, 2021 at 15:36
  • The PPA at launchpad.net/~kelleyk/+archive/ubuntu/emacs actually provides Emacs 27.1.1 since September 2020, as package name emacs27. It lacks 27.2 though.
    – kubanczyk
    Commented Jan 12, 2022 at 11:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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