我已经在我的mac上成功安装了free_tds,并且可以使用tsql来访问db和查询表。 但是,当我尝试在rails 3上使用gem tiny_tds gem时,我收到以下错误:
Installing tiny_tds (0.4.5) with native extensions /Users/gugguson/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:552:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/Users/gugguson/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
extconf.rb:12: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
looking for library directory /Users/gugguson/.rvm/gems/ruby-1.9.2-p290@rails31/lib ... no
looking for library directory /Users/gugguson/.rvm/gems/ruby-1.9.2-p290@rails31/lib/freetds ... no
looking for library directory /Users/gugguson/.rvm/gems/ruby-1.9.2-p290@global/lib ... no
looking for library directory /Users/gugguson/.rvm/gems/ruby-1.9.2-p290@global/lib/freetds ... no
looking for library directory /Users/gugguson/.rvm/rubies/ruby-1.9.2-p290/lib ... yes
checking for main() in -lsybdb... no
looking for library directory /Users/gugguson/.rvm/rubies/ruby-1.9.2-p290/lib/freetds ... no
looking for library directory /Users/gugguson/.rvm/lib ... yes
checking for main() in -lsybdb... no
looking for library directory /Users/gugguson/.rvm/lib/freetds ... no
looking for library directory /usr/lib ... yes
checking for main() in -lsybdb... no
looking for library directory /usr/lib/freetds ... no
looking for library directory /usr/local/lib ... yes
checking for main() in -lsybdb... no
looking for library directory /usr/local/lib/freetds ... no
looking for library directory /usr/X11/lib ... yes
checking for main() in -lsybdb... no
-----
Can not find FreeTDS's db-lib or include directory.
-----
*** 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=/Users/gugguson/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
--enable-iconv
--disable-iconv
--enable-iconv
--disable-iconv
--with-freetds-dir
--without-freetds-dir
--with-freetds-include
--without-freetds-include=${freetds-dir}/include
--with-freetds-lib
--without-freetds-lib=${freetds-dir}/lib
--enable-lookup
--disable-lookup
--with-sybdblib
--without-sybdblib
--with-sybdblib
--without-sybdblib
--with-sybdblib
--without-sybdblib
--with-sybdblib
--without-sybdblib
--with-sybdblib
--without-sybdblib
looking for library directory /usr/X11/lib/freetds ... no
Gem files will remain installed in /Users/gugguson/.rvm/gems/ruby-1.9.2-p290@rails31/gems/tiny_tds-0.4.5 for inspection.
Results logged to /Users/gugguson/.rvm/gems/ruby-1.9.2-p290@rails31/gems/tiny_tds-0.4.5/ext/tiny_tds/gem_make.out
from /Users/gugguson/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:530:in `block in build_extensions'
from /Users/gugguson/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:505:in `each'
from /Users/gugguson/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:505:in `build_extensions'
from /Users/gugguson/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:180:in `install'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290@rails31/gems/bundler-1.0.15/lib/bundler/source.rb:101:in `block in install'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290@rails31/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb:78:in `preserve_paths'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290@rails31/gems/bundler-1.0.15/lib/bundler/source.rb:91:in `install'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290@rails31/gems/bundler-1.0.15/lib/bundler/installer.rb:58:in `block (2 levels) in run'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290@rails31/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb:93:in `with_build_args'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290@rails31/gems/bundler-1.0.15/lib/bundler/installer.rb:57:in `block in run'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290@rails31/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `block in each'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290@rails31/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `each'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290@rails31/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `each'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290@rails31/gems/bundler-1.0.15/lib/bundler/installer.rb:49:in `run'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290@rails31/gems/bundler-1.0.15/lib/bundler/installer.rb:8:in `install'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290@rails31/gems/bundler-1.0.15/lib/bundler/cli.rb:270:in `update'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290@rails31/gems/bundler-1.0.15/lib/bundler/vendor/thor/task.rb:22:in `run'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290@rails31/gems/bundler-1.0.15/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290@rails31/gems/bundler-1.0.15/lib/bundler/vendor/thor.rb:246:in `dispatch'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290@rails31/gems/bundler-1.0.15/lib/bundler/vendor/thor/base.rb:389:in `start'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290@rails31/gems/bundler-1.0.15/bin/bundle:13:in `<top (required)>'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290@rails31/bin/bundle:19:in `load'
from /Users/gugguson/.rvm/gems/ruby-1.9.2-p290@rails31/bin/bundle:19:in `<main>'
有人知道造成这种情况的原因吗?
答案 0 :(得分:2)
消息Can not find FreeTDS's db-lib or include directory
表示您必须安装FreeTDS。
如果您使用的是Homebrew,您可以轻松安装FreeTDS:
brew install freetds
希望它有所帮助。
答案 1 :(得分:0)
或者在Linux中安装FreeTDS就像这样:
sudo apt-get install freetds-dev
:)