【问题标题】:ROR FreeTDS install failure on OSX在 OSX 上安装 ROR FreeTDS 失败
【发布时间】:2015-05-23 03:23:09
【问题描述】:

下午好,我正在尝试使用带有 Ruby on Rails 的 MS SQL Server 数据库。根据我的研究,在继续将其添加到我的 Rails 项目之前,我已经安装了 FreeTDS 和 unixodbc。我已经测试了我的安装并连接/查询了许多 MSSQL 数据库中的任何一个都没有问题:

$ sqsh -S <servername> -U <username>
sqsh-2.5.16.1 Copyright (C) 1995-2001 Scott C. Gray
Portions Copyright (C) 2004-2014 Michael Peppler and Martin Wesdorp
This is free software with ABSOLUTELY NO WARRANTY
For more information type '\warranty'
Password: 
[4] <server>.master.1> use <DBNAME>;
[5] <server>.<DBNAME>.1> select top 5 * from <tablename>;

.. 结果如下..

在成功运行测试后,我决定尝试为我的新 Rails 应用程序捆绑安装。我修改了gemfile:

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
# Use MS SQL Server as the database for Active Record
# and default connection through tiny_tds default connection mode
gem 'tiny_tds'
gem 'activerecord-sqlserver-adapter'
...

当我运行捆绑安装时,我收到以下错误:

Gem::Installer::ExtensionBuildError: 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 /var/folders/vh/3f8srsrs57zbk6p7vg7fg6pw0000gn/T/bundler20150319-18359-ed8ld7/tiny_tds-0.6.2/gems/tiny_tds-0.6.2 for inspection.
Results logged to /var/folders/vh/3f8srsrs57zbk6p7vg7fg6pw0000gn/T/bundler20150319-18359-ed8ld7/tiny_tds-0.6.2/gems/tiny_tds-0.6.2/ext/tiny_tds/gem_make.out
An error occurred while installing tiny_tds (0.6.2), and Bundler cannot continue.
Make sure that `gem install tiny_tds -v '0.6.2'` succeeds before bundling.

我已经阅读了关于 SO 的其他相关帖子,包括 ROR + Unable to install tiny_tds,但是,这些答案仅反映了指向我已经验证过的工作的通用答案。我找到了 FreeTDS here 的构建/配置标志参考:

--enable-dbmfix: 将 dbopen() 重命名为 tdsdbopen() 以解决 dbm 名称冲突

所以,我最终的问题是,是否有人可以告诉我这是否可以在某个配置文件中完成,或者我必须构建自己的 FreeTDS 版本来解决这个问题?

【问题讨论】:

标签: ruby-on-rails sql-server macos freetds


【解决方案1】:

好的,在花了更多时间搜索其他体验后,我发现了一个模糊的参考,即 32 位和 64 位版本的 FreeTDS。这可以通过强制指定 64 位版本来解决:

$ sudo ARCHFLAGS="-arch x86_64" gem install tiny_tds

运行捆绑安装,一切正常。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-23
    • 2015-02-28
    • 1970-01-01
    相关资源
    最近更新 更多