开发者

Trying to compile vim on OS X?

Following this writeup...

The compiled binary seems to work fine, but the installed binary fails (when running make install).

It seems to be failing on this step:

...
generating help tags
/usr/local/bin/vim -u NONE -esX -c "helptags ++t ." -c quit
dyld: Symbol not found: _environ
  Referenced from: /Users/neezer/.rvm/rubies/ruby-1.9.2-p0/lib/libruby.1.9.1.dylib
  Expected in: flat namespace
 in /Users/neezer/.rvm/rubies/ruby-1.9.2-p0/lib/libruby.1.9.1.dylib
make[2]: *** [vimtags] Trace/BPT trap
make[1]: [installrtbase] Error 2 (ignored)

I used this to configure:

./configure --prefix=/usr/local --enable-rubyinterp --enable-gui=no --disable-gpm

Like I said, I think it compiled correctly, because I开发者_JS百科 can run ./src/vim after make just fine (no errors). But when I try to run the installed version after make install in /usr/local/bin/vim, I get this (mirrors above):

dyld: Symbol not found: _environ
  Referenced from: /Users/neezer/.rvm/rubies/ruby-1.9.2-p0/lib/libruby.1.9.1.dylib
  Expected in: flat namespace
 in /Users/neezer/.rvm/rubies/ruby-1.9.2-p0/lib/libruby.1.9.1.dylib
[1]    13175 trace trap  vim

Running which vim verifies that it is trying to load the new binary in /usr/local/bin/vim.

My current version of Ruby is ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.5.0] via RVM.

What's happening here?

And no: I don't want to just use MacVim instead...


Says right in the blog post:

you’ve probably fallen prey to a (currently) not very well documented issue: Vim 7.2 does not support the integration of Ruby 1.9.x on Snow Leopard.

There's more information available in this ticket.

But in summary, you have to link against Ruby 1.8.7, which is the version that ships with Snow Leopard anyway.


Vim can't be compiled with Ruby 1.9.X (may be fixed in the future). You have to compile it with Ruby 1.8.X, if you want to use ruby integration.

If you use rbenv instead of rvm, you can change to ruby 1.8.7 or disable rbenv in your .zshenv or .bash_profile file, recompile vim and enable your current ruby again. This should work for OSX 10.6 too. I've tested this solution on OSX 10.7 and 10.8 only.

For zsh and rbenv:

# disable in your .zshenv for compile time. Just comment it out for comile time.
# eval "$(rbenv init -)"

For bash and rbenv:

# disable in .bash_profile or .bashrc for compile time. Just comment it out for comile time.
# eval "$(rbenv init -)"

For rvm, you can switch to system ruby (osx), recompile and switch back

rvm use system
brew uninstall vim
brew install vim
rvm use 1.9.3


I would recommend using MacPorts; compiling vim then becomes:

$ sudo port install vim

EDIT: Correction; you would need the ruby mode:

$ sudo port install vim +ruby

MacPorts will then fetch all dependencies and sort all that headache out itself.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜