ruby-on-rails – Rails 4:安装tiny_tds gem时出错?

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – Rails 4:安装tiny_tds gem时出错?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我已经开发了一个使用 Ruby v2和Rails v4的rails web项目.这在我目前的系统中是完美的,当我尝试在另一台Linux机器(Ubuntu 12.4)上运行这个项目时,我得到一个Tidy_tds错误.

捆绑安装时出现此错误,

错误详情如下

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.                                                                                                                                

    /home/action/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb                                                                                                                                       
checking for iconv_open() in iconv.h... yes                                                                                                                                                       
checking for sybfront.h... no                                                                                                                                                                     
-----                                                                                                                                                                                             
freetds is missing.    
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-lib=${opt-dir}/lib                                                                                                                                                          
        --with-make-prog                                                                                                                                                                          
        --without-make-prog                                                                                                                                                                       
        --srcdir=.                                                                                                                                                                                
        --curdir                                                                                                                                                                                  
        --ruby=/home/action/.rvm/rubies/ruby-2.1.1/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}/lib                                                                                                                                                      
        --with-freetds-dir                                                                                                                                                                        
        --without-freetds-dir                                                                                                                                                                     
        --with-freetds-include                                                                                                                                                                    
        --without-freetds-include=${freetds-dir}/include   
--with-freetds-lib                                                                                                                                                                        
        --without-freetds-lib=${freetds-dir}/lib                                                                                                                                                  

extconf Failed,exit code 1      
Gem files will remain installed in /home/action/.rvm/gems/ruby-2.1.1/gems/tiny_tds-0.6.1 for inspection.                                                                                          
Results logged to /home/action/.rvm/gems/ruby-2.1.1/extensions/x86_64-linux/2.1.0/tiny_tds-0.6.1/gem_make.out                                                                                     
An error occurred while installing tiny_tds (0.6.1),and Bundler cannot continue.                                                                                                                 
Make sure that `gem install tiny_tds -v '0.6.1'` succeeds before bundling.

我也试过安装tiny_tds,但是我仍然遇到同样的问题

gem install tiny_tds -v '0.6.1'

我的宝石文件,

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails',github: 'rails/rails'
gem 'rails','4.0.2'

# Use SCSS for stylesheets
gem 'sass-rails','~> 4.0.0'
gem 'tiny_tds' 
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier','>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails','~> 4.0.0'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer',platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

gem 'jquery-ui-rails' # jquery ui

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder','~> 1.2'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc',require: false
end

# Use sqlserver as the database for Active Record
gem 'activerecord-sqlserver-adapter',:git => 'https://github.com/nextgearcapital/activerecord-sqlserver-adapter.git'
gem "therubyracer"
gem "less-rails" 
gem "twitter-bootstrap-rails"
gem 'bootstrap-datepicker-rails'
gem 'will_paginate'
gem 'sqlite3'
gem 'formtastic'

为什么会出现此错误以及如何解决此问题.

任何帮助是赞赏

解决方法

看来你没有在这台机器上安装freetds:
sudo apt-get install freetds-dev

如果您看到freetds-dev软件包的详细信息,您将看到它缺少文件sybfront.h

没有我知道的宝石,建立tiny_tds gem需要编译.但是,您应该可以使用MiniPortile构建您自己的宝石版本.

而不是使用正常的gem安装机制,您需要从githib克隆tiny_tds,然后为您的环境构建本机gem.此过程将包括下载用于编译宝石的特定版本的freetds.

这应该可以解决无法安装freetds-dev软件包的问题,​​但确实有缺点,如果将来更新tiny_tds gem,那么每次都需要重复这个过程 – 你不能简单地利用捆绑更新.

您需要遵循的步骤详细here.

原文链接:https://www.f2er.com/ruby/265614.html

猜你在找的Ruby相关文章