0

我们正在使用activerecord-sqlserver-adapterRails 4 的适配器与 SQL Server 数据库通信。此适配器需要tiny_tdsgem。为了安装tiny_tds,您需要freetds在系统上安装,因为它在 gem 编译期间使用。

在我的系统上,我安装了 RVM 和 homebrew。我已经brew install freetds并确认它可以正常工作tsql -C并实际连接到 SQL Server。据我了解,这意味着freetds“安装”在我的机器上并且可以正常工作。

但是,每次我做一个gem install tiny_tdsif 抱怨freetds is missing

我已经尝试了几个参数选项来“链接”到正确的文件,但似乎没有什么对我有用。我已经花了几个小时在谷歌上搜索并查看 gem 作者的著作。我正在与之合作的其他一些开发人员具有此功能,但我正在建立一个新环境,由于某种原因无法使其正常工作。他们也已经对此进行了调查,但不确定问题出在哪里。

似乎tiny_tdsgem的安装只是不知道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
4

2 回答 2

0

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

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

于 2014-08-29T14:43:41.117 回答
0

您可以将 freetds 库的位置传递给gem命令,如下所示:

gem install tiny_tds -- --with-freetds-dir=/opt/homebrew/Cellar/freetds/1.2.21
于 2021-06-07T09:16:39.410 回答