Command-T无法为Vim编译

4

我正在尝试安装Vim的Command-T插件,但到目前为止没有成功。

我使用brew重新安装了vim,vim使用的ruby版本是2.5.1

我使用RVM安装了ruby 2.5.1,然后运行了 ruby extconf.rb 命令,得到以下输出:

checking for float.h... yes
checking for ruby.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for fcntl.h... yes
checking for stdint.h... yes
checking for sys/errno.h... yes
checking for sys/socket.h... yes
checking for ruby/st.h... yes
checking for st.h... yes
checking for pthread_create() in -lpthread... yes
creating Makefile

然后我运行了make命令并成功获取了结果。
compiling ext.c
compiling heap.c
compiling match.c
compiling matcher.c
compiling watchman.c
linking shared-object ext.bundle

但是当我尝试在vim中使用它时,我收到了以下消息:
command-t.vim could not load the C extension.
Please see INSTALLATION and TROUBLE-SHOOTING in the help.
Vim Ruby version: 2.5.1-p57
For more information type:    :help command-t

如果我使用 Ruby 版本 2.5.0 进行编译,会提示我使用了错误的 Ruby 版本。我不知道还能做什么,请帮帮我。

在vim中运行命令 :ruby puts "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"。该命令的输出是什么? - Dmitry Shvetsov
@shvetsovdm 2.5.1-p57 - Morris
1个回答

6
问题在于您必须使用与vim编译相同的ruby来编译command-t C扩展程序。
您提到正在使用RVM,并且已使用ruby 2.5.1-p57编译了vim。 您需要选择完全相同的ruby版本。如果您使用brew从RVM安装ruby 2.5.1-p57编译vim,然后运行以下命令:
$ rvm use 2.5.1-p57

然后重新编译Command-T,确保ruby -v返回2.5.1-p57:

$ ruby -v

$ ruby extconf.rb

$ make

如果这不起作用,可能是您使用了与2.5.1版本相同的系统范围ruby安装它。这可以解决问题:
$ rvm use system

$ ruby extconf.rb

$ make

command-t与编译vim时相同版本的ruby一起编译的想法。

在最坏的情况下,您可以重新安装vim。

您还可以参考command-t文档


我一开始也是用的同一个版本,但是后来我通过使用rvm use system而不是rvm的2.5.1版本解决了这个问题。 - Morris
感谢您使用 rvm use system - qbantek
很高兴它能帮到你。 - Dmitry Shvetsov

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接