2

dyld: lazy symbol binding failed: Symbol not found: _rb_encdb_declare Referenced from: /Users/sa125/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin10.8.0/enc/encdb.bundle Expected in: flat namespace

dyld: Symbol not found: _rb_encdb_declare Referenced from: /Users/sa125/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin10.8.0/enc/encdb.bundle Expected in: flat namespace Vim: Caught deadly signal SEGV

Hi,

I've built vim on my MacbookPro (running OSX 10.6.8), and trying to get Command-T to work. The ruby on my system is provided by RBENV, and I've used the following simple script to build and install vim:

#!/bin/bash

make distclean

./configure --with-features=huge \
            --enable-rubyinterp=yes \
            --with-ruby-command=`rbenv which ruby` \
            --enable-pythoninterp \
            --enable-perlinterp \
            --enable-cscope=yes \

make
make install

Vim compiles and everything works, except Command-T. I re-installed Command-T by cloning the repo, and running rake make && make inside the root folder, while ensuring the same ruby version (1.9.3-p194) was used to compile vim and Command-T. When I run vim and load Command-T, it crashes with the following error:

dyld: lazy symbol binding failed: Symbol not found: _rb_encdb_declare
Referenced from: /Users/sa125/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin10.8.0/enc/encdb.bundle
Expected in: flat namespace

dyld: Symbol not found: _rb_encdb_declare
Referenced from: /Users/sa125/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin10.8.0/enc/encdb.bundle
Expected in: flat namespace

Vim: Caught deadly signal SEGV

I've tried building both with a different ruby version (1.9.2-p320), but the outcome was the same. If all else fails, I'll use CtrlP (which is also great), but I'd like to give it another go and at least find out what's killing it, so any ideas will help. thanks.

8
  • Why not MacVim?
    – romainl
    Oct 30, 2012 at 19:51
  • I alternate between terminal and gui vim - I'd like both to work.
    – sa125
    Oct 31, 2012 at 4:32
  • MacVim comes with a CLI executable. You get exactly the same Vim in CLI and GUI. Just do $ mvim -m filename or add an alias: alias vim='mvim -m'. Compiling Vim by hand on Mac OS X is totally useless.
    – romainl
    Oct 31, 2012 at 6:20
  • @romainl No, it isn't if you want to build vim with support for options not included by MacVim.
    – Telemachus
    Nov 1, 2012 at 0:24
  • OK "almost totally useless", then. I'm curious: what options did you want that weren't available in MacVim?
    – romainl
    Nov 1, 2012 at 7:18

2 Answers 2

1

I wrote a blog post about my experiences with the same problem, but in a nutshell I think you need to apply this patch to your Ruby build and then build Vim with that Ruby specified. When you build Command-T, make sure to use the same Ruby interpreter.

Here's the patch to make it easier for Googlers:

diff --git a/missing/setproctitle.c b/missing/setproctitle.c
index 169ba8b..4dc6d03 100644
--- a/missing/setproctitle.c
+++ b/missing/setproctitle.c
@@ -48,6 +48,12 @@
 #endif
 #include <string.h>

+#if defined(__APPLE__)
+#include <crt_externs.h>
+#undef environ
+#define environ (*_NSGetEnviron())
+#endif
+
 #define SPT_NONE   0   /* don't use it at all */
 #define SPT_PSTAT  1   /* use pstat(PSTAT_SETCMD, ...) */
 #define SPT_REUSEARGV  2   /* cover argv with title information */

Again, if it helps anyone else, here is a ruby-build formula that I use to automate adding this patch and the falcon patches:

build_package_combined_patch() {
  local package_name="$1"

  {
    curl https://raw.github.com/gist/3905045/bf9d1c84c72cdce5be52d8b2dfd4d86a1cdbf185/gistfile1.txt | git apply
    curl https://raw.github.com/wayneeseguin/rvm/master/patches/ruby/1.9.3/p286/falcon.diff | git apply
    autoconf
    ./configure --prefix="$PREFIX_PATH" $CONFIGURE_OPTS --enable-shared
    make -j 8
    make install
  } >&4 2>&1

}

require_gcc

install_package "yaml-0.1.4" "http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz"
install_package "ruby-1.9.3-p286" "http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p286.tar.gz" combined_patch

EDIT August 31, 2013: Current versions of Ruby don't need this patch any longer (Ruby has it by default). However, there is still one thing that can go wrong. You must make sure that Ruby is built as a shared library. If Vim crashes in the same way, it probably has to do with this issue. Make sure to add your configure options include --enable-shared. (See this bug report for further discussion.)

2

You could just bypass rbenv and use the system Ruby when configuring Vim:

./configure --with-ruby-command=/usr/bin/ruby

and also when setting up Command-T:

/usr/bin/ruby extconf.rb && make

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .