1

I build Vim from source, and install it with checkinstall. Soon after Software&Updates warned there is an update for Vim. But after the installation, Vim path is altered and another build take its place and my build from source disappeared. Any idea what is going on?

  • 1
    The "update" installed a new copy of vim. If you want to have a different one, install it in a different directory. If you don't want it to be overwritten, tell the packaging system to hold/pin the package. – Thomas Dickey Jan 6 at 18:38
1

One of two things happened:

  1. You used the same package name as your distro did, but your distro update package has a higher version. So the package manager happily "upgraded" your custom build to your distro's version. Solution: remove your distro's package & use a different name for your local package (such as local-vim). If you must use the same name (e.g., due to dependencies), then use a higher version. For example, on Debian, you could add an epoch.

  2. You installed your vim-from-source into /usr, and the files from your distro's package use the same names. Thus your files were overwritten. Less likely, as a lot of package managers would yell pretty loudly about this... Solution is to use a different path (like /opt or /usr/local) or not install your distro package.

1

I build Vim, so it is installed in a custom directory. I call configure like this:

configure --prefix=/usr/local/mybuild/vim --mandir=/usr/local/mybuild/vim/share/man --without-local-dir ...

then I do

make
make test
make install

the executable is then /usr/local/mybuild/vim/bin/vim.

To update the alternative links I executed the following. This is only needed once, not after every make install.

update-alternatives --install /usr/bin/editor editor /usr/local/mybuild/vim/bin/vim 1200
update-alternatives --install /usr/bin/eview eview /usr/local/mybuild/vim/bin/vim 1200
update-alternatives --install /usr/bin/evim evim /usr/local/mybuild/vim/bin/vim 1200
update-alternatives --install /usr/bin/ex ex /usr/local/mybuild/vim/bin/vim 1200
update-alternatives --install /usr/bin/gview gview /usr/local/mybuild/vim/bin/vim 1200
update-alternatives --install /usr/bin/gvim gvim /usr/local/mybuild/vim/bin/vim 1200
update-alternatives --install /usr/bin/gvimdiff gvimdiff /usr/local/mybuild/vim/bin/vim 1200
update-alternatives --install /usr/bin/rgview rgview /usr/local/mybuild/vim/bin/vim 1200
update-alternatives --install /usr/bin/rgvim rgvim /usr/local/mybuild/vim/bin/vim 1200
update-alternatives --install /usr/bin/rview rview /usr/local/mybuild/vim/bin/vim 1200
update-alternatives --install /usr/bin/rvim rvim /usr/local/mybuild/vim/bin/vim 1200
update-alternatives --install /usr/bin/vi vi /usr/local/mybuild/vim/bin/vim 1200
update-alternatives --install /usr/bin/view view /usr/local/mybuild/vim/bin/vim 1200
update-alternatives --install /usr/bin/vim vim /usr/local/mybuild/vim/bin/vim 1200
update-alternatives --install /usr/bin/vimdiff vimdiff /usr/local/mybuild/vim/bin/vim 1200

I have chosen a high priority (1200), so that system-installs will not replace the links.

Now Vim is /usr/bin/vim, which is a link to /etc/alternatives/vim, which in turn is a link to /usr/local/mybuild/vim/bin/vim. So calling vim starts my private build of Vim.

To see how the alternatives for vim are configured, you can run update-alternatives --display vim. On my machine it produces the following output:

$ update-alternatives --display vim
vim - auto mode
  link best version is /usr/local/mybuild/vim/bin/vim
  link currently points to /usr/local/mybuild/vim/bin/vim
  link vim is /usr/bin/vim
/usr/bin/vim.basic - priority 30
/usr/bin/vim.gtk3 - priority 50
/usr/local/mybuild/vim/bin/vim - priority 1200

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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