Building VIM 9 on Ubuntu

633 views
Skip to first unread message

J S

unread,
Aug 10, 2022, 9:11:00 AM8/10/22
to Vim Mailing List
I tried building the latest VIM on a Ubuntu system, and it worked, except...

I followed the instructions on the VIM page, which consists of 3 steps:

1) git clone http://...
2) cd vim/src
3) make


This worked, and 8 minutes later, I had a new vim executable.  However, I noticed that the first thing the "make" did was to run the usual "configure" script, which is good, but the thing is, I usually like to pass some args to "configure", such as setting the "prefix" to something under my $HOME (so that I can later do "make install" without "sudo")

I also noticed that the resulting binary did not include the GUI.  Now, I think that VIM without a GUI is virtually useless (Yes, I know, some people may disagree with this, but that's irrelevant).  The version of VIM that is already installed on my system (which is old) is the "gtk3" version, and I would like the new version to also be GTK3.  Note that installing Vim9 from a repo is not an option here; I need to compile it myself.

Now, I figured out that if I do:

1) make distclean
2) ./configure ...
3) make

It will re-do the make, using the version of the configure stuff that I ran manually (i.e., it won't run it again).  This is good.  However, despite trying several times, I was not able to make a GUI version of Vim9.  (I keep getting the error message "GUI not enabled at compile time")

Therefore, my questions and comments are:

1) Can someone give me a good list of all the dependencies and packages that I need to install on my Ubuntu 18.04 (Yes, I know that is old, but that also cannot be changed) system so that I can build a GTK3 version of Vim9? (N.B.  This is the most important paragraph of this post; everything else is just information!)

2) I hate the fact that it goes ahead and builds it (which takes a non-trivial amount of time and computing resources - as I said, about 8 to 10 minutes) even though the resulting file is junk (useless).  I know that Vim is not alone in this behavior - other modern programs are like this - where if they figure out that you don't have the necessary dependencies installed, they go ahead and silently fail (i.e., build an output file that is junk).  I wish there were a way - a ./configure option - that would tell it to fail immediately if it is not going to work.

Note: I was using the ./configure option: --enable-gui=gtk3
I also tried adding: --with-x

Note that when I added those options, it did make the resulting file much larger (18 meg vs only 3 meg originally), but it still refused to run the GUI.

Gary Johnson

unread,
Aug 10, 2022, 1:11:00 PM8/10/22
to vim...@googlegroups.com
On 2022-08-10, 'J S' via vim_use wrote:

> 1) Can someone give me a good list of all the dependencies and packages that I
> need to install on my Ubuntu 18.04 (Yes, I know that is old, but that also
> cannot be changed) system so that I can build a GTK3 version of Vim9? (N.B.
> This is the most important paragraph of this post; everything else is just
> information!)

1. Find the Ubuntu package that includes the features you want in
Vim.

$ apt list | grep ^vim

In your case, that would be vim-gtk3

2. Do one of the following.

a) Have apt install dependencies automatically.

$ sudo apt build-dep vim-gtk3

b) View the dependencies and install the ones you want or need
manually.

$ apt show vim-gtk3 | grep ^Depends

For each <package> to be installed, run

$ sudo apt install <package>

3. Execute

$ make distclean
$ ./configure <options the way you want>
$ make
$ sudo make install

Without any options, configure will configure the build system for
a huge build. That includes a GUI if GUI libraries are available.

See

./configure --help
:help 90.1

and search or scroll to the SELECTING FEATURES section. See also

:help +feature-list

Regards,
Gary

J S

unread,
Aug 10, 2022, 1:43:36 PM8/10/22
to Vim Mailing List
Not trying to be difficult or insulting or anything like that, but so it boils down to, no, there is no easy way to do it.
You (i.e., me) just have to figure it out.  By the way, my system doesn't have "build-dep".  It says no such package.

Right?


Again, it would be so much better if it would just fail if it isn't going to work.


Also, and BTW, I can't login to Google, so I can't respond to this thread the normal way.  So, I just have to kludge it via email.  Sorry about that.



Gary Johnson wrote the following:

unread,
1:11 PM (26 minutes ago) 
On 2022-08-10, 'J S' via vim_use wrote: 

> 1) Can someone give me a good list of all the dependencies and packages that I 
> need to install on my Ubuntu 18.04 (Yes, I know that is old, but that also 
> cannot be changed) system so that I can build a GTK3 version of Vim9? (N.B. 
> This is the most important paragraph of this post; everything else is just 
> information!) 

1. Find the Ubuntu package that includes the features you want in 
Vim. 

$ apt list | grep ^vim 

In your case, that would be vim-gtk3 

2. Do one of the following. 

a) Have apt install dependencies automatically. 

$ sudo apt build-dep vim-gtk3 

----> Shouldn't that be "sudo apt install ..." ?

Yegappan Lakshmanan

unread,
Aug 10, 2022, 2:15:14 PM8/10/22
to vim_use, Vim Mailing List
Hi,

On Wed, Aug 10, 2022 at 10:43 AM 'J S' via vim_use
<vim...@googlegroups.com> wrote:
>
> Not trying to be difficult or insulting or anything like that, but so it boils down to, no, there is no easy way to do it.
> You (i.e., me) just have to figure it out. By the way, my system doesn't have "build-dep". It says no such package.
>
> Right?
>
> Again, it would be so much better if it would just fail if it isn't going to work.
>

If you pass the "--enable-fail-if-missing" argument to configure, then
it will fail if the
dependencies are not found.

- Yegappan

Tony Mechelynck

unread,
Aug 10, 2022, 2:58:33 PM8/10/22
to vim...@googlegroups.com, Vim Mailing List
In adition to Gary's reply about how to get the nessary "development"
packages on Ubuntu, I recommend _not_ to tun configure with arguments
on the command-line, but to set the configure arguments by means of
environment variables so that even if "make" decides to rerun
configure, it will do so with your preferred settings. This way, if
you decide that it is necessary to recompile "your own version of Vim"
from scratch rather than recompiling only the changed modules, "make
reconfig" (with the appropriate environment settings) will do it.
Otherwise, just "make" will normally trigger an incremental compile,
though in some cases make may decide to rerun configure (and usually
it will find out that auto/config.cache is unchanged and compile only
the changed modules anyway).

I used to have a how-to page about that but my ISP has removed all
"user sites" since then. I'm attaching my backup copy of it.

Best regards,
Tony.
compunix.htm

Gary Johnson

unread,
Aug 10, 2022, 4:30:53 PM8/10/22
to vim...@googlegroups.com
On 2022-08-10, 'J S' via vim_use wrote:
> Not trying to be difficult or insulting or anything like that, but so it boils
> down to, no, there is no easy way to do it.
> You (i.e., me) just have to figure it out. By the way, my system doesn't have
> "build-dep". It says no such package.
>
> Right?

From that error message, it appears that you tried to install
build-dep as a package rather than use it as a command.

On my system, Ubuntu 20.04, and according to my notes, also when it
was 18.04, the command is just

$ sudo apt build-dep vim-gtk3

You could also try apt-get:

$ sudo apt-get build-dep vim-gtk3

It's use is documented in the apt-get(8) man page but not in the
apt(8) page, which is a little frustrating, although it works in
both.

Also, that was good advice from Tony. That's what I do, source
a file of build-option environment variables. I probably got the
idea from his page. Then you never have to run ./configure
yourself. Just execute "make" and if make needs to run ./configure,
it does; otherwise it doesn't. That saves a lot of time and
thinking.

Regards,
Gary

Marius Gedminas

unread,
Aug 11, 2022, 2:24:16 AM8/11/22
to vim...@googlegroups.com, Vim Mailing List
On Wed, Aug 10, 2022 at 01:10:43PM +0000, 'J S' via vim_use wrote:
> 1) Can someone give me a good list of all the dependencies and packages that I
> need to install on my Ubuntu 18.04 (Yes, I know that is old, but that also
> cannot be changed) system so that I can build a GTK3 version of Vim9? (N.B.
> This is the most important paragraph of this post; everything else is just
> information!)

This is the shell script I've been using to build a local vim on Ubuntu
since a long time ago (originally it was meant to build me a vim 7), so
it should work on 18.04:
https://github.com/mgedmin/scripts/blob/master/rebuild-vim

The list of packages is on line 60.

The list of configure arguments is on line 34. It builds a GTK3
version which works for me (although I mostly use terminal vim these
days for reasons).

It makes use of another script of mine,
https://github.com/mgedmin/scripts/blob/master/autoclone, which is just
there to make the experience smoother on a fresh install (it asks me
interactively whether I want to run git clone if ~/src/vim doesn't
already exist).

I run rebuild-vim --pull whenever I notice interesting features or
bugfixes posted to this list.

I then use a wrapper script to run vim right from the source tree,
skipping the 'make install' step because it's a bother:
https://github.com/mgedmin/scripts/blob/master/vim

All it does is export VIMRUNTIME=~/src/vim/runtime before execing
~/src/vim/vim. Later, of course, it grew extra features like
--vagrind so I can try to catch bugs without having to remember all the
magic arguments.

Marius Gedminas
--
QOTD:
"A child of 5 could understand this! Fetch me a child of 5."
signature.asc

Marius Gedminas

unread,
Aug 11, 2022, 2:29:17 AM8/11/22
to vim...@googlegroups.com
On Wed, Aug 10, 2022 at 01:31:27PM -0700, Gary Johnson wrote:
> On 2022-08-10, 'J S' via vim_use wrote:
> > Not trying to be difficult or insulting or anything like that, but so it boils
> > down to, no, there is no easy way to do it.
> > You (i.e., me) just have to figure it out. By the way, my system doesn't have
> > "build-dep". It says no such package.
> >
> > Right?
>
> From that error message, it appears that you tried to install
> build-dep as a package rather than use it as a command.
>
> On my system, Ubuntu 20.04, and according to my notes, also when it
> was 18.04, the command is just
>
> $ sudo apt build-dep vim-gtk3

One important note is that 'sudo apt build-dep' requires you to have
deb-src lines in /etc/apt/sources.list, which are not present in default
Ubuntu installs.

Marius Gedminas
--
/* Halley */

(Halley's comment.)
signature.asc

Marius Gedminas

unread,
Aug 11, 2022, 2:32:29 AM8/11/22
to vim...@googlegroups.com
On Wed, Aug 10, 2022 at 10:11:28AM -0700, Gary Johnson wrote:
> b) View the dependencies and install the ones you want or need
> manually.
>
> $ apt show vim-gtk3 | grep ^Depends
>
> For each <package> to be installed, run
>
> $ sudo apt install <package>

This installs runtime libraries, but not their development packages.
For each libsomething42-3 you need to figure out the appropriate
libsomething-dev and then apt install that too.

It's a pain and I'd rather use apt build-dep or look up the build
dependencies in a git repo somewhere (the Debian vim package has them in
https://salsa.debian.org/vim-team/vim/blob/debian/sid/debian/control
and I doubt Ubuntu patches the build dependency list).

Marius Gedminas
--
Of course it is very important to support quitting emacs.
-- Bram Moolenar
signature.asc

Gary Johnson

unread,
Aug 11, 2022, 3:16:15 AM8/11/22
to vim...@googlegroups.com
On 2022-08-11, Marius Gedminas wrote:
> On Wed, Aug 10, 2022 at 10:11:28AM -0700, Gary Johnson wrote:
> > b) View the dependencies and install the ones you want or need
> > manually.
> >
> > $ apt show vim-gtk3 | grep ^Depends
> >
> > For each <package> to be installed, run
> >
> > $ sudo apt install <package>
>
> This installs runtime libraries, but not their development packages.
> For each libsomething42-3 you need to figure out the appropriate
> libsomething-dev and then apt install that too.

Of course. Thanks for the correction.

Regards,
Gary

J S

unread,
Aug 12, 2022, 9:38:55 AM8/12/22
to Vim Mailing List
Solved (more or less).

I now understand the point of "build-dep" and it works (but see below).  Before posting, I had searched the web and found something about build-dep that implied it was a package to install (rather than a command).  Note that there is also something called "build-essentials" that *is* a package to install.

Anyway, the command: apt-get build-dep vim-gtk3
failed on the main the Ubuntu machine that I was originally working on - got lots of errors like:

Package something something depends on somethingelse somethingelse which is not going to be installed.

I'm guessing the repos for that version of Ubuntu are just too old (no longer maintained).

However, on a different Debian-ish system, I was able to do the build-dep command successfully and then to successfully build Vim9 with GTK GUI.  So, that's something, I guess.

The only ./configure option I needed to include was the --prefix=...

BTW, I don't understand the stuff here about using environment variables, but that's OK.

Reply all
Reply to author
Forward
0 new messages