安装Command-T时缺少ruby.h头文件

时间:2013-10-05 00:17:29

标签: vim

我正在尝试在OS X 10.8上安装Command-T并按照http://www.vim.org/scripts/script.php?script_id=3025上的说明操作,但是当我尝试构建Makefile时,我收到以下错误:

Command-T[master+]/ruby/command-t
 ❯ ruby extconf.rb
checking for ruby.h... no
couldn't find ruby.h (required)

我正在使用系统ruby,这是一个Vim编译(由我自己)反对。如您所见,Vim是使用ruby支持编译的:

Command-T[master+]/ruby/command-t
 ❯ ruby --version
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]

Command-T[master+]/ruby/command-t
 ❯ vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jan 29 2013 10:09:48)
MacOS X (unix) version
Included patches: 1-785
Compiled by caleb@sirius.local
Huge version without GUI.  Features included (+) or not (-):
+arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent 
-clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments 
+conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs 
-dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path 
+find_in_path +float +folding -footer +fork() -gettext -hangul_input +iconv 
+insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispindent 
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape 
+mouse_dec -mouse_gpm -mouse_jsbterm +mouse_netterm +mouse_sgr -mouse_sysmouse 
+mouse_urxvt +mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg 
+path_extra -perl +persistent_undo +postscript +printer +profile +python 
-python3 +quickfix +reltime +rightleft +ruby +scrollbind +signs +smartindent 
-sniff +startuptime +statusline -sun_workshop +syntax +tag_binary 
+tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title
 -toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo 
+vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
 -xterm_clipboard -xterm_save 
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX -no-cpp-precomp  -Os -w -pipe -march=native -Qunused-arguments -mmacosx-version-min=10.8 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1      
Linking: /usr/bin/clang   -L.    -L/usr/local/lib -o vim       -lm  -lncurses -liconv -framework Cocoa     -framework Python   -lruby -lobjc 

来自Vim:

:ruby puts RUBY_VERSION
1.8.7

我找到了/System/Library/Frameworks/Ruby.framework/Versions/1.8/Headers/ruby.h中所需的ruby.h文件并试过了两个

export CPP_INCLUDE_PATH=/System/Library/Frameworks/Ruby.framework/Versions/1.8/Headers/
export C_INCLUDE_PATH=/System/Library/Frameworks/Ruby.framework/Versions/1.8/Headers/

但这些都不会使have_header('ruby.h')返回true,而ruby extconf.rb仍然会失败。

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

虽然在类似的question中提到了一些替代方案,但一些评论可能有所帮助。

首先,我所熟悉的唯一c ++库路径环境变量称为CPLUS_INCLUDE_PATH,并且特定于GNU编译器集合here

其次,c ++ / c库路径环境变量不会影响ruby加载路径。 搜索到的路径可以使用

显示
ruby -e 'puts $:'

可以通过RUBYLIB环境变量进行补充。例如

RUBYLIB=/custom/path ruby -e 'puts $:'

应将/ custom / path放在加载路径列表的顶部。

这似乎是你想做的最后一件事。

第三个也是最后一个,我怀疑这些东西足以解决你的实际问题:一个不完整的ruby设置。