Compile gvim from sources?

6,953

Solution 1

I had a similar problem installing gvim 7.3 onto Centos 6.2 (x86_64)

Some required devel packages were missing. To install them:

yum groupinstall "Desktop Platform Development"

[To view all available groups: yum grouplist]

Then building from source just worked

wget ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2
bunzip2 vim-7.3.tar.bz2
tar xf vim-7.3.tar
cd vim73

./configure --prefix=/home/me/vim73
make
make install

To discover what files were missing:

./configure | less

and searching for 'gui' showed that X11 related headers were missing.

Solution 2

In ubuntu I compile vim the following way:

sudo apt-get build-dep vim
sudo apt-get build-dep libx11-dev libxtst-dev

make distclean

./configure --with-compiledby="David Gamba <[email protected]>" \
--with-features=huge \
--enable-gui=auto \
--with-x \
--enable-rubyinterp \
--with-ruby-command=/usr/bin/ruby \
--enable-perlinterp \
--enable-pythoninterp --with-python-config-dir=/usr/lib/python2.7/config \
--enable-fontset \
--enable-cscope \
--enable-gtk2-check \
--enable-gnome-check

make

At this point, cd src and check for the correct X11 and clipboard support: ./vim --version. Then:

sudo make install

For Fedora (using the KDE desktop) I installed the following packages:

yum install gcc libX11-devel libXtst-devel ncurses-devel perl-ExtUtils-Embed ruby ruby-devel python-devel gtk2-devel libXt-devel

And changed my configure command to the following:

./configure --with-compiledby="David Gamba <[email protected]>" \
--with-features=huge \
--enable-gui=auto \
--with-x \
--enable-rubyinterp \
--with-ruby-command=/usr/bin/ruby \
--enable-perlinterp \
--enable-pythoninterp --with-python-config-dir=/usr/lib64/python2.7/config \
--enable-fontset \
--enable-cscope \
--enable-gtk2-check \
--enable-gnome-check \
--enable-fail-if-missing

After that I get the following:

gvim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled May  4 2014 19:43:27)
Included patches: 1-274
Compiled by David Gamba <davidgamba ...>

EDIT: Forgot to mention that for Fedora I was getting an error with the location of the xsubpp perl script so I ended up modifying the Makefile thanks to some bug report online.

--- a/src/Makefile      Fri May 02 15:46:14 2014 +0200
+++ b/src/Makefile      Sun May 04 19:56:20 2014 -0600
@@ -2465,7 +2465,7 @@

 auto/if_perl.c: if_perl.xs
        $(PERL) -e 'unless ( $$] >= 5.005 ) { for (qw(na defgv errgv)) { print "#define PL_$$_ $$_\n" }}' > $@
-       $(PERL) $(PERLLIB)/ExtUtils/xsubpp -prototypes -typemap \
+       $(PERL) /usr/bin/xsubpp -prototypes -typemap \
            $(PERLLIB)/ExtUtils/typemap if_perl.xs >> $@

  auto/osdef.h: auto/config.h osdef.sh osdef1.h.in osdef2.h.in

Solution 3

You can use the following command to find necessary dependencies for gvim:

sudo apt-get build-dep vim

If you haven't add source repository in your source.list file in /etc/apt/, you can open this file, duplicate the entries inside and change "dep" to "dep-src".

After all dependencies installed, you will be able to compile vim with gui.

Solution 4

This looks like the case of not having enough *-devel packages installed. Try installing all the devel packages. I think there is a meta-package for installing most of them. Try gnome-devel. Sorry I don't have Ubuntu nearby right now.

To compile different variants of vim (e.g. GUI and non-GUI), you have to configure/compile it multiple times.

Solution 5

I also failed to build vim73 with enable-gui option on RHEL6.1 due to lack of X11/Intrinsic.h. Did your linux have the include file? If not, you could get it from, I guess, the libxt-dev package.

Share:
6,953

Related videos on Youtube

Nemoden
Author by

Nemoden

Updated on September 18, 2022

Comments

  • Nemoden
    Nemoden over 1 year

    Recently, I've installed vim like so:

    hg clone https://vim.googlecode.com/hg/ vim
    cd vim
    sudo ./configure --enable-rubyinterp=yes --enable-pythoninterp=yes --enable-gui=gtk2 --prefix=/opt/vim
    make 
    make install
    make install clean
    

    So, my VIM's binaries now live under /opt/vim/bin. Here is ls -la of this dir:

    $ ls -la /opt/vim/bin
    total 1500
    drwxr-xr-x 2 root root    4096 2011-05-25 12:46 .
    drwxr-xr-x 4 root root    4096 2011-05-25 12:46 ..
    lrwxrwxrwx 1 root root       3 2011-05-25 12:46 ex -> vim
    lrwxrwxrwx 1 root root       3 2011-05-25 12:46 rview -> vim
    lrwxrwxrwx 1 root root       3 2011-05-25 12:46 rvim -> vim
    lrwxrwxrwx 1 root root       3 2011-05-25 12:46 view -> vim
    -rwxr-xr-x 1 root root 1504188 2011-05-25 12:46 vim
    lrwxrwxrwx 1 root root       3 2011-05-25 12:46 vimdiff -> vim
    -rwxr-xr-x 1 root root    2084 2011-05-25 12:46 vimtutor
    -rwxr-xr-x 1 root root   13900 2011-05-25 12:46 xxd
    

    Where is my vim.gtk? I specified --enable-gui=gtk2 in configure. Shouldn't it say the installer I want a GUI version as well as console application?

    I specified gtk version correctly:

    $ dpkg -l libgtk[0-9]* | grep ^i
    ii  libgtk2-perl                          1:1.221-4                                  Perl interface to the 2.x series of the Gimp Toolkit library
    ii  libgtk2.0-0                           2.18.3-1ubuntu2.2                          The GTK+ graphical user interface library
    ii  libgtk2.0-bin                         2.18.3-1ubuntu2.2                          The programs for the GTK+ graphical user interface library
    ii  libgtk2.0-common                      2.18.3-1ubuntu2.2                          Common files for the GTK+ graphical user interface library
    

    UPDATE: It is written on src/INSTALL

     88 Unix: COMPILING WITH/WITHOUT GUI
     89
     90 NOTE: This is incomplete, look in Makefile for more info.
     91
     92 These configure arguments can be used to select which GUI to use:
     93 --enable-gui=gtk      or: gtk2, motif, athena or auto
     94 --disable-gtk-check
     95 --disable-motif-check
     96 --disable-athena-check
     97
     98 --enable-gui defaults to "auto", so it will automatically look for a GUI (in
     99 the order of GTK, Motif, then Athena).  If one is found, then is uses it and
    100 does not proceed to check any of the remaining ones.  Otherwise, it moves on
    101 to the next one.
    

    So I tried not to specify --enable-gui hoping it will find which GUI engine/toolkit to use on its own... Still the same result :(

    UPDATE: Furthermore:

    /opt/vim/bin$ ./vim -g
    E25: GUI cannot be used: Not enabled at compile time
    

    UPDATE:

    Do I need ALL of this:

    $ sudo aptitude search gtk | grep dev
    p   gnunet-gtk-dev                  - secure, trust-based peer-to-peer framework
    v   gtkgl-dev                       -                                           
    p   gtkparasite                     - GTK+ debugging and development tool       
    p   libaiksaurusgtk-1.2-dev         - graphical interface to the Aiksaurus toolk
    v   libaiksaurusgtk-dev             -                                           
    p   libcanberra-gtk-dev             - a simple abstract interface for playing ev
    p   libchamplain-gtk-0.4-dev        - A Gtk+ widget to display maps (development
    p   libclutter-gtk-0.10-dev         - Open GL based interactive canvas library G
    p   libdbusmenu-gtk-dev             - Menus over DBus shared library for GTK    
    p   libempathy-gtk-dev              - High-level library and user-interface for 
    v   libequeue-gtk2-ocaml-dev        -                                           
    p   libexif-gtk-dev                 - Library providing GTK+ widgets to display/
    p   libgalago-gtk-dev               - libraries and header files for developing 
    p   libgdu-gtk-dev                  - GTK+ standard dialog library for libgdu - 
    p   libggadget-gtk-1.0-dev          - Google Gadgets GTK+ development files     
    p   libggz-gtk-dev                  - GGZ Gaming Zone: core client embedding lib
    p   libghc6-gtk-dev                 - A GUI library for Haskell (Gtk2Hs) -- GTK+
    p   libghc6-gtkglext-dev            - A GUI library for Haskell (Gtk2Hs) -- gtkg
    p   libghc6-gtksourceview2-dev      - A GUI library for Haskell (Gtk2Hs) -- GtkS
    p   libghc6-soegtk-dev              - A GUI library for Haskell (Gtk2Hs) -- soeg
    p   libglrr-gtk-dev                 - Development library of Grift (gtk)        
    p   libgpod-nogtk-dev               - development files for libgpod (version wit
    p   libgtk-directfb-2.0-dev         - Development files for the GTK+ library - D
    p   libgtk-vnc-1.0-dev              - A VNC viewer widget for GTK+ (development
    i   libgtk2.0-dev                   - Development files for the GTK+ library
    p   libgtkada2-dev                  - Development files for libgtkada2
    p   libgtkdatabox-0.9.0-1-dev       - A Gtk+ library to display large amounts of
    v   libgtkdatabox-dev               -
    p   libgtkextra-x11-2.0-dev         - A useful set of widgets for GTK+ (developm
    p   libgtkgl2.0-dev                 - OpenGL area for GTK (development files)
    p   libgtkglext1-dev                - OpenGL Extension to GTK+ (development file
    p   libgtkglextmm-x11-1.2-dev       - C++ bindings for GtkGLExt (Development fil
    p   libgtkhex0-dev                  - GNOME Hex editor for files (development he
    p   libgtkhtml-editor-dev           - HTML rendering/editing library - editor wi
    p   libgtkhtml2-dev                 - HTML rendering/editing library - developme
    p   libgtkhtml3.14-dev              - HTML rendering/editing library - developme
    p   libgtkhtml3.8-dev               - HTML rendering/editing library - developme
    p   libgtkimageview-dev             - image viewer widget for GTK+ (development
    p   libgtkmathview-dev              - rendering engine for MathML documents
    p   libgtkmm-2.4-dev                - C++ wrappers for GTK+ 2.4 (development fil
    p   libgtkmm-utils-dev              - utility functions, classes and widgets wri
    p   libgtksourceview-dev            - development files for the GTK+ syntax high
    p   libgtksourceview2.0-dev         - development files for the GTK+ syntax high
    p   libgtksourceviewmm-1.0-dev      - C++ binding of GtkSourceView - development
    p   libgtksourceviewmm-2.0-dev      - C++ binding of GtkSourceView - development
    p   libgtkspell-dev                 - Development files for GtkSpell
    p   libindicate-gtk-dev             - GNOME panel indicator applet - shared libr
    p   libjana-gtk-dev                 - A set of GTK+ widgets to visualise libjana
    p   liblablgtk2-gl-ocaml-dev        - OCaml bindings to GtkGL
    p   liblablgtk2-gnome-ocaml-dev     - OCaml bindings to GNOME
    p   liblablgtk2-ocaml-dev           - OCaml bindings to Gtk+ version 2
    p   liblablgtkmathview-ocaml-dev    - OCaml bindings for libgtkmathview, a GTK w
    p   liblablgtksourceview-ocaml-dev  - OCaml bindings for libgtksourceview, a sou
    v   libnotify-dev-gtk2.10           -
    p   libocamlnet-gtk2-ocaml-dev      - OCaml application-level Internet libraries
    p   libpolkit-gtk-1-dev             - PolicyKit GTK+ API - development files
    v   libsylpheed-claws-gtk2-dev      -
    p   libtinymailui-gtk-dev           - Framework for mobile applications with e-m
    p   libtinymailui-gtkhtml-dev       - Framework for mobile applications with e-m
    p   libtracker-gtk-dev              - GTK+ widgets for apps that use tracker - d
    v   libunicapgtk-dev                -
    p   libunicapgtk2-dev               - graphical widgets for unicap - development
    p   libwxgtk2.6-dev                 - wxWidgets Cross-platform C++ GUI toolkit (
    p   libwxgtk2.8-dev                 - wxWidgets Cross-platform C++ GUI toolkit (
    p   libzbargtk-dev                  - scanning and decoding bar codes (GTK+ bind
    p   python-galago-gtk-dev           - Galago presence library (Python interface)
    p   python-gtk2-dev                 - GTK+ bindings: devel files
    p   telepathy-devel-gtk             - Telepathy Development packages for GTK
    

    Looks like most of ths packages I don't need. E.g. Frameworks for mobile apps, ... HTML renderers, etc. The one I've installed is libgtk2.0-dev... Still, I can't compile gVIM.... Agrhhhhh

    • Admin
      Admin over 12 years
      Why are you doing "sudo ./configure [...]"? The configure script should not need to be run as root. I can understand doing "sudo make isntall", although you don't need to do "make install" and then "make install clean" as that would install Vim twice—just do "make install; make clean".
    • Admin
      Admin almost 11 years
      You shouldn't need to install a bunch of random dev files. If the configure script can't find the libraries it needs, it will refuse to output a makefile.. Seems like your issue is with configure itself. I'd check config.log, and see how it handles the --enable-gui option, etc.
    • Admin
      Admin almost 9 years
      Similar on askubuntu: askubuntu.com/questions/132724/…
  • Keith
    Keith almost 13 years
    You're right, you don't have to. But most distros do have separate builds for GUI and non-GUI variants, available in different binary packages. Something like a minimal and a full featured version. The OP seemed to want to also do that.
  • Nemoden
    Nemoden almost 13 years
    I'm on KDE, so I'm actually have KUbuntu
  • garyjohn
    garyjohn almost 13 years
    That said, I agree with Keith that it looks like you're missing some development packages. There's an apt-get command that will install build dependencies of a specified target, but I don't have an Ubuntu system handy at the moment, either.
  • Keith
    Keith almost 13 years
    Even so, you wanted the gtk+ GUI build, so you will need all the gtk devel packages installed. the gnome-devel is a meta package that will pull of of them in. Their might be a smaller, gtk specific one. But I can't check right now.
  • Nemoden
    Nemoden almost 13 years
    I've installed gtk2-dev. Nothing changed. Now I do all this process again and outputing result of sudo ./configure --enable-rubyinterp=yes --enable-pythoninterp=yes --enable-gui=gtk2 --prefix=/opt/vim to file for closer look after.
  • Nemoden
    Nemoden almost 13 years
    I have updated my question :)
  • Keith
    Keith almost 13 years
    Check the config.log and see what it says about GUI selection.
  • DavidGamba
    DavidGamba almost 10 years
    Unfortunately when it tells you you are missing something it doesn't tell you which package provides that or what is the name of the providing library, so that is why you need to give a bit more than that.