2013-07-25 83 views
1

我安裝rbenv成功,這似乎正確的:rbenv不設置紅寶石版本正確

piousboxs-MacBook-Pro:lms piousbox$ cat .rbenv-version 
1.8.7-p374 
piousboxs-MacBook-Pro:lms piousbox$ ruby -v 
ruby 1.8.7 (2013-06-27 patchlevel 374) [i686-darwin12.2.1] 
piousboxs-MacBook-Pro:lms piousbox$ which ruby 
/Users/piousbox/.rbenv/shims/ruby 

但是當我運行bundle,它使用系統紅寶石不知何故?

Installing tiny_tds (0.5.1) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. 

    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb 
checking for iconv_open() in iconv.h... no 
checking for iconv_open() in -liconv... yes 
checking for sybfront.h... no 
----- 
freetds is missing. 
----- 
*** extconf.rb failed *** 
Could not create Makefile due to some reason, probably lack of 
necessary libraries and/or headers. Check the mkmf.log file for more 
details. You may need configuration options. 

任何人都可以幫忙嗎?

回答

1

確保您安裝並選擇了要使用的Ruby版本;即使您已使用rbenv install添加另一個,系統默認爲rbenv

要查看哪個Ruby rbenv即將使用,請運行rbenv version

請參閱rbenv localrbenv globalrbenv shell瞭解有關如何在不同上下文中設置Ruby版本的詳細信息。

0

Emil坐,問題是,不知何故freetds試圖使用系統紅寶石,即使rbenv配置正確。有此--ruby標誌建築原生擴展時傳遞:

Installing tiny_tds (0.5.1) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. 

    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb --ruby=/Users/piousbox/.rbenv/shims/ruby 
checking for iconv_open() in iconv.h... no 
checking for iconv_open() in -liconv... yes 
checking for sybfront.h... yes 
checking for sybdb.h... yes 
checking for tdsdbopen() in -lsybdb... no 
----- 
freetds is missing. 
----- 
*** extconf.rb failed *** 
Could not create Makefile due to some reason, probably lack of 
necessary libraries and/or headers. Check the mkmf.log file for more 
details. You may need configuration options. 

Provided configuration options: 
    --with-opt-dir 
    --without-opt-dir 
    --with-opt-include 
    --without-opt-include=${opt-dir}/include 
    --with-opt-lib 
    --without-opt-lib=${opt-dir}/lib 
    --with-make-prog 
    --without-make-prog 
    --srcdir=. 
    --curdir 
    --ruby=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby 
    --enable-lookup 
    --disable-lookup 
    --with-iconv-dir 
    --without-iconv-dir 
    --with-iconv-include 
    --without-iconv-include=${iconv-dir}/include 
    --with-iconv-lib 
    --without-iconv-lib=${iconv-dir}/lib 
    --with-freetds-dir 
    --without-freetds-dir 
    --with-freetds-include 
    --without-freetds-include=${freetds-dir}/include 
    --with-freetds-lib 
    --without-freetds-lib=${freetds-dir}/lib 
    --with-iconvlib 
    --without-iconvlib 
    --with-sybdblib 
    --without-sybdblib 


Gem files will remain installed in /Users/piousbox/.bundler/tmp/26769/gems/tiny_tds-0.5.1 for inspection. 
Results logged to /Users/piousbox/.bundler/tmp/26769/gems/tiny_tds-0.5.1/ext/tiny_tds/gem_make.out 

An error occurred while installing tiny_tds (0.5.1), and Bundler cannot continue. 
Make sure that `gem install tiny_tds -v '0.5.1'` succeeds before bundling. 
0

確保你與gem install bundler安裝捆綁後運行rbenv rehash

0

解決的辦法是從/ usr/local/bundle中刪除系統提供的捆綁程序,因爲它過時並且運行不正常。用我的新紅寶石(通過rbenv)和捆綁器(通過新的紅寶石),我能夠正確地編譯一切。