When native gem is installed on Mac OS X, dyld_stub_binding_helper and dyldfatalerror cannot be found.
Under Mac OS X10.10, sudo gem install curses returns the following error:
Apple @ kissAir: ruby_src $ sudo gem install curses
Password:
Fetching: curses-1.0.1.gem (100%)
Building native extensions. This cocould take a while...
ERROR: Error installing curses:
ERROR: Failed to build gem native extension.
/Users/apple/. rvm/rubies/ruby-2.1.3/bin/ruby extconf. rb
Checking for tgetent () in-ltinfo... no
Checking for tgetent () in-ltermcap... yes
Checking for ncurses. h... yes
Checking for initscr () in-lncursesw... no
Checking for initscr () in-lncurses... yes
Header: ncurses. h
Library: ncurses
Checking for beep ()... yes
Checking for bkgd ()... yes
Checking for bkgdset ()... yes
Checking for curs_set ()... yes
Checking for deleteln ()... yes
Checking for doupdate ()... yes
Checking for flash ()... yes
Checking for getbkgd ()... yes
Checking for getnstr ()... yes
Checking for init ()... no
Checking for init in ncurses. h... no
Checking for isendwin ()... yes
Checking for keyname ()... yes
Checking for keypad ()... yes
Checking for resizeterm ()... yes
Checking for scrl ()... yes
Checking for set ()... no
Checking for set in ncurses. h... no
Checking for setscrreg ()... yes
Checking for ungetch ()... yes
Checking for wattroff ()... yes
Checking for wattron ()... yes
Checking for wattrset ()... yes
Checking for wbkgd ()... yes
Checking for wbkgdset ()... yes
Checking for wdeleteln ()... yes
Checking for wgetnstr ()... yes
Checking for wresize ()... yes
Checking for wscrl ()... yes
Checking for wsetscrreg ()... yes
Checking for def_prog_mode ()... yes
Checking for reset_prog_mode ()... yes
Checking for timeout ()... yes
Checking for wtimeout ()... yes
Checking for nodelay ()... yes
Checking for init_color ()... yes
Checking for wcolor_set ()... yes
Checking for use_default_colors ()... yes
Checking for newpad ()... yes
Checking for ESCDELAY in ncurses. h... yes
Checking for TABSIZE in ncurses. h... yes
Checking for COLORS in ncurses. h... yes
Checking for COLOR_PAIRS in ncurses. h... yes
Checking for function curses_version in ncurses. h... yes
Checking for variable curses_version in ncurses. h... no
Creating Makefile
Make "DESTDIR =" clean
Make "DESTDIR ="
Compiling curses. c
Linking shared-object curses. bundle
Ld: warning: directory not found for option '-L/Users/mpapis/. sm/pkg/active/lib'
Ld: symbol dyld_stub_binding_helper not found, normally in crt1.o/dylib1.o/bundle1.o for architecture x86_64
Collect2: error: ld returned 1 exit status
Make: *** [curses. bundle] Error 1
Make failed, exit code 2
The main error is that the dyld_stub_binding_helper symbol cannot be found. I searched the internet and changed the deployment target in Xcode from a lower version to a later version. However, I didn't use Xcode to compile it! After thinking about it, let's see if the above compiler uses gcc (4.9). Do you need to try clang ?!
Apple @ kissAir: ruby_src $ type gcc
Gcc is/opt/local/bin/gcc
Apple @ kissAir: ruby_src $ ls-lh/opt/local/bin/gcc
Lrwxr-xr-x 1 root admin 39B 10 27/opt/local/bin/gcc->/usr/local/Cellar/gcc/4.9.1/bin/gcc-4.9
Apple @ kissAir: ruby_src $ sudo mv/opt/local/bin/gcc old_gcc
Password:
Apple @ kissAir: ruby_src $ type gcc
Gcc is/usr/bin/gcc
Apple @ kissAir: ruby_src $ gcc-v
Configured with: -- prefix =/Applications/Xcode. app/Contents/Developer/usr -- with-gxx-include-dir =/usr/include/c ++/4.2.1
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix
Apple @ kissAir: ruby_src $ clang-v
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix
Now the gcc is actually connected to clang, so install gem again:
Apple @ kissAir: ruby_src $ sudo gem install curses
Building native extensions. This cocould take a while...
Successfully installed curses-1.0.1
Parsing documentation for curses-1.0.1
Installing ri documentation for curses-1.0.1
Done installing documentation for curses after 3 seconds
1 gem installed
Oh, bird! Let's take a look at the exported symbols:
Nm/System/Library/Frameworks/Ruby. framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin14/curses. bundle
U _ COLORS
U _ COLOR_PAIRS
U _ COLS
U _ ESCDELAY
0000000000000732 T _ Init_curses
U _ LINES
U _ TABSIZE
U ___ sprintf_chk
U ___ stack_chk_fail
U ___ stack_chk_guard
U _ beep
U _ can_change_color
U _ cbreak
U _ color_content
U _ curs_set
U _ curses_version
U _ def_prog_mode
U _ delwin
U _ doupdate
U _ echo
U _ endwin
U _ flash
U _ getbegx
U _ getbegy
U _ getcurx
U _ getcury
U _ getmaxx
U _ getmaxy
U _ getmouse
U _ has_colors
U_idlok
U _ init_color
U _ init_pair
U _ initscr
U _ isendwin
U _ keyname
U _ keypad
U _ mouseinterval
U _ mousemask
U _ mvwin
U _ newpad
U _ newwin
U _ nl
U _ nocbreak
U _ nodelay
U _ noecho
U _ nonl
U _ noraw
U _ pair_content
U _ pnoutrefresh
U _ prefresh
U _ raw
U _ rb_ary_new3
U _ rb_block_given_p
U _ rb_cData
U _ rb_cFalseClass
U _ rb_cFixnum
U _ rb_cFloat
U _ rb_cNilClass
U _ rb_cObject
U _ rb_cSymbol
U _ rb_cTrueClass
U _ rb_check_typeddata
U _ rb_data_typed_object_alloc
U _ rb_define_alloc_func
U _ rb_define_class_under
U _ rb_define_const
U _ rb_define_method
U _ rb_define_module
U _ rb_define_module_function
U _ rb_define_module_under
U _ rb_eArgError
U _ rb_eRuntimeError
U _ rb_eSecurityError
U _ rb_fix2int
U _ rb_gc_register_address
U _ rb_gc_unregister_address
U _ rb_isprint
U _ rb_locale_str_new
U _ rb_locale_str_new_cstr
U _ rb_num2int
U _ rb_num2long
U _ rb_num2uint
U _ rb_obj_alloc
U _ rb_obj_class
U_rb_raise
U _ rb_safe_level
U _ rb_scan_args
U _ rb_secure
U _ rb_set_end_proc
U _ rb_str_export_locale
U _ rb_str_new_cstr
U _ rb_string_value
U _ rb_string_value_cstr
U _ rb_thread_call_without_gvl
U _ rb_undef_method
U _ rb_yield
U _ reset_prog_mode
U _ resizeterm
U _ ruby_xfree
U _ ruby_xmalloc
U _ scrolok
U _ start_color
U _ stdscr
U _ subwin
U _ ungetch
U _ ungetmouse
U _ use_default_colors
U _ waddch
U _ waddnstr
U _ wattr_off
U _ wattr_on
U _ wattrset
U _ wbkgd
U _ wbkgdset
U _ wborder
U _ wclear
U _ wclrtoeol
U _ wcolor_set
U _ wdelch
U _ wgetch
U _ wgetnstr
U _ winch
U _ winsch
U _ winsdelln
U _ wmove
U _ wnoutrefresh
U _ wrefresh
U _ wresize
U _ wscrl
U _ wsetscrreg
U _ wtimeout
U dyld_stub_binder
Finally, connect gcc to it to restore its true nature:
Apple @ kissAir :~ $ Gcc-v
Using built-in specs.
COLLECT_GCC = gcc
COLLECT_LTO_WRAPPER =/usr/local/Cellar/gcc/4.9.1/libexec/gcc/x86_64-apple-darwin14.0.0/4.9.1/lto-wrapper
Target: x86_64-apple-darwin14.0.0
Configured :.. /configure -- build = x86_64-apple-darwin14.0.0 -- prefix =/usr/local/Cellar/gcc/4.9.1 -- enable-languages ages = c, c ++, objc, obj-c ++, fortran -- program-suffix =-4.9 -- with-gmp =/usr/local/opt/gmp -- with-mpfr =/usr/local/opt/mpfr -- with-mpc =/ usr/local/opt/libmp c -- with-cloog =/usr/local/opt/cloog -- with-isl =/usr/local/opt/isl -- with-system-zlib -- enable-version-specific-runtime-libs -- enable-libstdcxx-time = yes -- enable-stage1-checking -- enable-checking = release -- enable-lto -- disable-werror -- with-pkgversion = 'homebrew gcc 4.9.1 '-- with-bugurl = https://github.com/Homebrew/homebrew/issues -- enable-plugin -- disable-nls -- enable-multilib
Thread model: posix
Gcc version 4.9.1 (Homebrew gcc 4.9.1)
Apple @ kissAir :~ $