vim8.2移植+ gtags 安装

下载源码

https://www.vim.org/download.php#unix
ftp://ftp.vim.org/pub/vim/unix

编译

配置
./configure --with-features=huge \
              --enable-multibyte \
              --enable-rubyinterp=yes \
              --enable-pythoninterp=yes \
              --with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu  \
              --enable-python3interp=yes \
              --with-python3-config-dir=/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu  \
              --enable-perlinterp=yes \
              --enable-luainterp=yes \
              --enable-gui=gtk2 --enable-cscope --prefix=/usr

中标麒麟:

./configure --with-features=huge \
              --enable-multibyte \
              --enable-rubyinterp=yes \
              --enable-pythoninterp=yes \
              --with-python-config-dir=/usr/lib64/python2.7/config/  \
              --enable-python3interp=yes \
              --with-python3-config-dir=/usr/lib64/python3.4/config-3.4m/  \
              --enable-perlinterp=yes \
              --enable-luainterp=yes \
              --enable-gui=gtk2 --enable-cscope --prefix=/usr

loongnix:

./configure --with-features=huge \
              --enable-multibyte \
              --enable-rubyinterp=yes \
              --enable-pythoninterp=yes \
              --with-python-config-dir=/usr/lib64/python2.7/config/  \
              --enable-python3interp=yes \
              --with-python3-config-dir=/usr/lib64/python3.4/config-3.4m/  \
              --enable-perlinterp=yes \
              --enable-luainterp=yes \
              --enable-gui=gtk2 --enable-cscope --prefix=/usr

centos7

./configure --with-features=huge \
              --enable-multibyte \
              --enable-rubyinterp=yes \
              --enable-pythoninterp=yes \
              --with-python-config-dir=/usr/lib64/python2.7/config/  \
              --enable-python3interp=yes \
              --enable-perlinterp=yes \
              --enable-luainterp=yes \
              --enable-gui=gtk2 \
              --enable-cscope \
              --prefix=/home/zhubo/bin

注意:python路径
其中参数说明如下:
–with-features = huge:支持最大特性
–enable-multibyte:多字节支持可以在Vim中输入中文
–enable-rubyinterp:启用Vim对ruby编写的插件的支持
–enable-pythoninterp:启用Vim对python2 编写的插件的支持
–enable-python3interp: 启用Vim对python3 编写的插件的支持
–enable-luainterp:启用Vim对于lua 编写的插件的支持
–enable-perlinterp:启用Vim对perl编写的插件的支持
–enable-cscope:Vim对cscope支持
–with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu :指定python路径
–enable-gui = gtk2:gtk2支持,也可以使用gnome,表示生成gvim
-prefix = / usr:编译安装路径

说明:

  • 使用clipboard主要就是加上 --with-x这个选项
  • 另外因为配置里需要python 所以把其他的一些选项也加了进去 , 编译+python的时候 注意/usr/lib/python2.7/config 这个文件夹一定要有 没有的话 安装下这个库 sudo apt-get install python-dev
编译

重新编译了几次每次都把这句给忘了,太注重上面的参数了QAQ

$ make VIMRUNTIMEDIR=/usr/share/vim/vim82

安装

$ sudo make install

安装checkinstall(非必须)

安装checkinstall工具
可以安装checkinstall工具将从源码安装的软件变得像用deb包安装的一样,方便以后可以直接用sudo dpkg -P vim删除vim:

$sudoapt-get install checkinstall
$cd vim
$sudo checkinstall

设置VIM为默认编辑器

$ sudoupdate-alternatives --install /usr/bin/editor editor /usr/bin/vim 1
$ sudoupdate-alternatives --seteditor /usr/bin/vim
$ sudoupdate-alternatives --install /usr/bin/vi vi /usr/bin/vim1
$ sudoupdate-alternatives --setvi /usr/bin/vim

问题解决

问题一:在编译perl组件支持时,出现如下错误:

/bin/perl -e 'unless ( $] >= 5.005 ) { for (qw(na defgv errgv)) { print "#define PL_$_ $_\n" }}' > auto/if_perl.c
/bin/perl /usr/share/perl5/ExtUtils/xsubpp -prototypes -typemap \
    /usr/share/perl5/ExtUtils/typemap if_perl.xs >> auto/if_perl.c
Can't open perl script "/usr/share/perl5/ExtUtils/xsubpp": No such file or directory
Makefile:2453: recipe for target 'auto/if_perl.c' failed
make[1]: *** [auto/if_perl.c] Error 2
make[1]: Leaving directory '/home/$usr/vim/src/vim74/src'
Makefile:26: recipe for target 'first' failed
make: *** [first] Error 2

解决:

yum install perl-ExtUtils*

找了下,发现perl5的 l i b 路 径 和 原 先 系 统 的 竟 然 不 一 样 了 , 在 lib路径和原先系统的竟然不一样了,在 libPELR5/vendor_perl/ExtUtil/中才有连接文件xsubpp。
接着修改了编译的指向路径,接着编译,却报错:

objects/buffer.o: In function `free_buffer':
/home/$usr/vim/src/vim74/src/buffer.c:661: undefined reference to `perl_buf_free'
objects/ex_docmd.o:(.rodata+0x4678): undefined reference to `ex_perl'
objects/ex_docmd.o:(.rodata+0x4690): undefined reference to `ex_perldo'
objects/window.o: In function `win_free':
/home/$usr/vim/src/vim74/src/window.c:4554: undefined reference to `perl_win_free'
objects/main.o: In function `getout':
/home/$usr/vim/src/vim74/src/main.c:1488: undefined reference to `perl_end'
collect2: error: ld returned 1 exit status
link.sh: Linking failed
Makefile:1733: recipe for target 'vim' failed
make[1]: *** [vim] Error 1
make[1]: Leaving directory '/home/$USR/vim/src/vim74/src'
Makefile:26: recipe for target 'first' failed
make: *** [first] Error 2
     检查src/auto/中的if_perl.c文件,发现竟然是空得,生成失败了。

     根据makefile或者第一个报错的指引,找到生成if_perl.c的命令,手动生成即可:

/bin/perl -e 'unless ( $] >= 5.005 ) { for (qw(na defgv errgv)) { print "#define PL_$_ $_\n" }}' > auto/if_perl.c
/bin/perl /usr/share/perl5/ExtUtils/xsubpp -prototypes -typemap \
    /usr/share/perl5/ExtUtils/typemap if_perl.xs >> auto/if_perl.c
     注意xsubpp的路径。

如果出现问题请安装python-dev 再执行上面命令

sudo yum install python-dev
sudo yum install python3-dev
sudo yum install libncurses5-dev

gtags

  • 安装 global(gtags)

wget http://tamacom.com/global/global-6.6.2.tar.gz

tar xzvf global-6.6.2.tar.gz
cd global-6.6.2
./configure
make && make install

ubuntu也可以使用命令安装,但命令安装的版本较低
sudo apt-get install global

  • 使用
    在项目中执行gtags
    会生成几个文件:GPATH GRTAGS GTAGS
    详细使用可以参看
    https://zhuanlan.zhihu.com/p/36279445
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值