10

I'm having a hard time building a VIM 7.4(obtained from vim's ftp site) with gui option. It builds ok without the gui
option. Here's how I'm doing it:

cd ~/Downloads/vim74/src
./configure --enable-gui

The above line does not seem to work because I get this output from the command:

./configure --enable-gui | grep gui
checking --enable-gui argument... no GUI support

I uncommented line 352 of the makefile to enable the gui(I think):

CONF_OPT_GUI = --enable-gui=gtk2

But when I run vim -g(after rebuilding) I get:

E25: GUI cannot be used: Not enabled at compile time

There's a suggestion in the makefile to check the generated auto/config.h and
auto/config.mk files but the files are empty(less than 10 lines).
How do you fix this?

Plakhoy
  • 243
  • 1
  • 2
  • 9
  • possible duplicate of [How can I build vim with a gui without gtk?](http://askubuntu.com/questions/165516/how-can-i-build-vim-with-a-gui-without-gtk) – Radu Rădeanu Sep 14 '13 at 20:07
  • @RaduRădeanu I'm not looking for the appropriate `apt` command, it would probably work(haven't tried it). I want a solution for when compiling from its sources. – Plakhoy Sep 14 '13 at 20:30
  • Ok, I will retract the close vote, but I will let the comment for future users. – Radu Rădeanu Sep 14 '13 at 20:39
  • Did you do a `make install` or just a `make`? if the latter, then in order to run the newly-built binary you must specify the path explicitly i.e. if you are in the `vim74` directory where you issued the `make` command, do `./src/vim -g` . It should not be necessary to specify any additional options to `configure`, I just tested it and the default configuration produced a GUI-enabled executable. – steeldriver Sep 14 '13 at 21:40
  • @steeldriver, I've tried both with no luck. Mine does not even generate the `./src/vim -g` folder, how'd you do that? Please outline the steps you are using. – Plakhoy Sep 14 '13 at 22:22
  • I just downloaded the vim-7.4.tar.bz2 file, untarred it into my current directory `tar xvf ../Downloads/vim-7.4.tar.bz2 -C . `, then `cd vim74`, `./configure`, `make`. You may find it helpful to use `./configure --help` to see the available configuration options. In particular, the `--enable-gui` option needs an `=OPT` argument (and it appears to default to `--enable-gui=auto`) – steeldriver Sep 14 '13 at 22:40
  • I've tried with `--enable-gui=gtk2` and `--enable-gui=gnome2` but it still outputs `no GUI support`. What do you have for the line that starts with `checking --enable-gui argument`? – Plakhoy Sep 14 '13 at 23:50
  • I've decided to give up on this endeavor. I've installed it using `apt`. I'm guessing the `no GUI support` is because I'm missing some libraries or something. – Plakhoy Sep 15 '13 at 08:02

3 Answers3

8

To build Vim you will need first to install all the dependencies. This could be done using

$ sudo apt-get build-dep vim-gtk # or vim-gnome, if you prefer.

This will download and install a lot of packages that should only be needed to compile Vim. If you don't want to keep them, before running that command add this to /etc/apt/apt.conf

APT {
  Get {
     Build-Dep-Automatic "true";
  };
};

This will make all the packages installed with build-dep be "marked to be autoremoved". So after you finished compiling Vim you can uninstall them using sudo apt-get autoremove.

After this, just proceed with the usual steps:

$ ./configure --with-gui=gtk2 # or gnome
$ make -j 4
$ sudo make install  
Salem
  • 19,604
  • 6
  • 62
  • 90
  • For me on Ubuntu 20.04 LTS `sudo apt-get build-dep vim-gtk` showed error until I added "Source code" checkbox in Software&Updates on "Ubuntu Software" tab. Then I made `sudo apt-get update` and command worked. – Dmitry Oct 08 '20 at 19:57
3

If you call ./configure --enable-gui=auto, the build process will automatically build against whichever GUI libraries are available. A cursory glance suggests that gtk2 will be prioritised over gnome2.

Tullo_x86
  • 131
  • 3
1

Just run into the same issue on Ubuntu 16.04. Turns out, it happens because packages with headers/libs for GTK2/Gnome aren't installed. After sudo apt-get install gnome-devel as @RAOF advised in this post, vim --version says it has GUI GTK2 support and gvim, gvimdiff, gview symlinks are created during install.

kenorb
  • 9,995
  • 2
  • 78
  • 90