Ruby on rails OSX上的ROR FreeTDS安装失败
下午好,我正在尝试使用带有RubyonRails的MS SQL Server数据库。根据我的研究,在继续将FreeTDS和unixodbc添加到Rails项目之前,我已经安装了FreeTDS和unixodbc。我已经测试了我的安装并连接/查询了许多MSSQL数据库,没有问题:Ruby on rails OSX上的ROR FreeTDS安装失败,ruby-on-rails,sql-server,macos,freetds,Ruby On Rails,Sql Server,Macos,Freetds,下午好,我正在尝试使用带有RubyonRails的MS SQL Server数据库。根据我的研究,在继续将FreeTDS和unixodbc添加到Rails项目之前,我已经安装了FreeTDS和unixodbc。我已经测试了我的安装并连接/查询了许多MSSQL数据库,没有问题: $ sqsh -S <servername> -U <username> sqsh-2.5.16.1 Copyright (C) 1995-2001 Scott C. Gray Portions C
$ 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>;
运行bundle安装时,出现以下错误:
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.
我已经阅读了其他相关的文章,包括,但是,这些答案只反映了指向我已经验证过的工作的一般答案。我找到了FreeTDS的build/config标志引用:
--启用dbmfix:将dbopen()重命名为tdsdbopen(),作为解决dbm名称冲突的方法
所以,我的最终问题是,是否有人能告诉我这是否可以在某个配置文件中完成,或者我必须构建自己版本的FreeTDS来解决这个问题 好吧,在花了更多时间搜索其他体验之后,我发现了一个关于32位版本与64位版本FreeTDS的模糊参考。这可以通过强制指定64位版本来解决:
$ sudo ARCHFLAGS="-arch x86_64" gem install tiny_tds
运行bundle安装,一切正常。查看其他选项(unix)
$ sudo ARCHFLAGS="-arch x86_64" gem install tiny_tds