2014-08-28 83 views
0

我们正在使用适用于Rails 4的activerecord-sqlserver-adapter适配器来与SQL Server数据库进行通信。此适配器需要使用tiny_tds宝石。为了安装tiny_tds,您需要在您的系统上安装freetds,因为它是在编译gem时使用的。Mac,Rails 4:使用`freetds`安装`tiny_tds` gem

在我的系统上,我安装了RVM和自制软件。我有brew install freetds,并确认它的工作原理是tsql -C,并且实际上已连接到SQL Server。根据我的理解,这意味着freetds已“安装”在我的机器上并正常工作。

然而,每次我做一个gem install tiny_tds如果抱怨freetds is missing

我尝试了好几种的“连接”到适当的文件,但似乎没有为我工作的参数选项。我已经花了几个小时搜索并查看宝石作者的着作。我正在使用的其他一些开发人员具有此功能,但我正在设置一个新环境,并且出于某种原因无法使其工作。他们已经研究过它,但不确定问题是什么。

看来,安装的tiny_tds宝石只是不知道freetds实际上安装在系统上。

在一个旁注中,我也看过mini_portile,它也不能正常工作,因为我已经花了几个小时在当前路径下,我想在切换到之前解决这个问题调查mini_portile

下面是安装的输出:

$ gem install tiny_tds 
Building native extensions. This could take a while... 
ERROR: Error installing tiny_tds: 
    ERROR: Failed to build gem native extension. 

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb 
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/2.0/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}/ 
    --with-freetds-dir 
    --without-freetds-dir 
    --with-freetds-include 
    --without-freetds-include=${freetds-dir}/include 
    --with-freetds-lib 
    --without-freetds-lib=${freetds-dir}/ 
    --with-iconvlib 
    --without-iconvlib 
    --with-sybdblib 
    --without-sybdblib 


Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/tiny_tds-0.6.2 for inspection. 
Results logged to /Library/Ruby/Gems/2.0.0/gems/tiny_tds-0.6.2/ext/tiny_tds/gem_make.out 

回答

0

终于解决了这一点。在安装RVM之后,忘记了通过RVM安装Ruby,这导致了所有问题。

如果您发现与上述类似的奇怪错误,请执行rvm list以查看是否已安装任何Rubies,然后在终端(Mac)上执行which ruby以查看您是否确实在使用RVM Ruby。