1

我成功安装了 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.

任何人都可以帮忙吗?

4

4 回答 4

1

确保安装并选择要使用的 Ruby 版本;rbenv默认为系统之一,即使您曾经rbenv install添加过另一个。

要查看要使用哪个 Ruby rbenv,只需运行rbenv version.

有关如何在不同上下文中设置 Ruby 版本的详细信息,请参阅rbenv localrbenv globalrbenv shell 。

于 2013-07-25T01:15:59.677 回答
0

Emil Sit,问题是 freetds 以某种方式尝试使用系统 ruby​​,即使 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.
于 2013-07-25T18:10:56.807 回答
0

确保rbenv rehash在使用gem install bundler.

于 2013-07-25T19:58:02.160 回答
0

解决方案是从 /usr/local/bundle 中删除系统提供的捆绑程序,因为它已经过时并且运行得不是很好。使用我的新 ruby​​(通过 rbenv)和 bundler(通过新 ruby​​),我能够正确编译所有内容。

于 2013-07-25T23:48:07.047 回答