从源代码编译gvim?


12

最近,我已经这样安装了vim

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

因此,我的VIM二进制文件现在位于下/opt/vim/bin。这是ls -la这个目录:

$ 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

我的vim.gtk呢?我--enable-gui=gtk2在configure中指定。它不应该说我想要GUI版本以及控制台应用程序的安装程序吗?

gtk正确指定了版本:

$ 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

更新:它写在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.

因此,我尝试不指定--enable-gui希望它能找到自己使用的GUI引擎/工具包...还是一样的结果:(

更新:此外:

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

更新

我需要所有这些吗?

$ 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

看起来大多数我不需要的软件包。例如,用于移动应用程序,... HTML渲染器等的框架。我安装的框架是libgtk2.0-dev...仍然,我无法编译gVIM.... Agrhhhhh


您为什么要执行“ sudo ./configure [...]”?配置脚本不需要以超级用户身份运行。我可以理解“ sudo make isntall”,尽管您不需要先进行“ make install”然后再进行“ make install clean”,因为那样会安装两次Vim,只需“ make install; make clean”即可。
Heptite'1

您不需要安装一堆随机的dev文件。如果configure脚本找不到所需的库,它将拒绝输出makefile。。似乎您的问题在于configure自身。我会检查一下config.log,看看它如何处理该--enable-gui选项,等等
。– jpaugh

Answers:


7

我在将gvim 7.3安装到Centos 6.2(x86_64)时遇到了类似的问题

缺少一些必需的开发套件。要安装它们:

yum groupinstall "Desktop Platform Development"

[查看所有可用的组:yum grouplist]

然后从源头构建就可以了

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

要发现缺少哪些文件:

./configure | less

并搜索“ gui”表明缺少与X11相关的标头。


4

ubuntu中,我通过以下方式编译vim:

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

make distclean

./configure --with-compiledby="David Gamba <davidgamba@gambaeng.com>" \
--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

此时,cd src请检查X11和剪贴板支持是否正确:./vim --version。然后:

sudo make install

对于Fedora(使用KDE桌面),我安装了以下软件包:

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

并将我的configure命令更改为以下内容:

./configure --with-compiledby="David Gamba <davidgamba@gambaeng.com>" \
--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

之后,我得到以下信息:

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 ...>

编辑:忘了提到Fedora,我在xsubppperl脚本的位置上遇到了一个错误,因此由于在线上的一些错误报告,我最终修改了Makefile。

--- 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

2

您可以使用以下命令查找gvim的必要依赖项:

sudo apt-get build-dep vim

如果尚未在/ etc / apt /的source.list文件中添加源存储库,则可以打开此文件,复制其中的条目,然后将“ dep”更改为“ dep-src”。

安装完所有依赖项后,您将可以使用gui编译vim。


1

看起来好像没有*-devel安装足够的软件包。尝试安装所有devel软件包。我认为有一个元软件包可以安装大多数软件包。尝试gnome-devel。抱歉,我现在附近没有Ubuntu。

要编译vim的不同变体(例如GUI和非GUI),必须多次配置/编译。


在类似Unix的系统上,没有理由构建单独的GUI和非GUI版本。“正常”的编译和安装将创建一个名为一个二进制文件vim,而所有其他形式的Vim-- gvimviewex,等-有联系。Vim根据被调用的名称知道采用哪种个性。
garyjohn

你说得对,你不具备对。但是大多数发行版的确有针对GUI和非GUI变体的单独版本,可在不同的二进制程序包中获得。类似于minimalfull featured版本。OP似乎也想这样做。
基思

我正在使用KDE,所以实际上我有K Ubuntu
Nemoden

就是说,我同意Keith的意见,即您似乎缺少一些开发包。有一个apt-get命令将安装指定目标的构建依赖项,但是目前我也没有方便的Ubuntu系统。
garyjohn

1
即使这样,您仍需要gtk + GUI构建,因此您将需要安装所有gtk devel软件包。gnome-devel是一个meta软件包,可以将它们放入其中。它们可能是较小的,gtk特定的软件包。但是我现在不能检查。
基思(Keith)

1

由于缺少X11 / Intrinsic.h,我也未能在RHEL6.1上使用enable-gui选项构建vim73 。您的Linux是否有包含文件?如果没有,我可以从libxt-dev包中获取。


0

编译vim时观察输出。我还没有自己编译vim,但是我很确定会有一些关于gvim所需文件丢失的警告/错误。


不幸的是,当它告诉您缺少某些内容时,它并没有告诉您哪个包提供了该包,或者它没有提供库的名称,所以这就是为什么您需要提供更多信息的原因。
DavidG 2014年
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.