1

这是我的 Gemfile 的外观:

source :rubygems
gem 'sinatra'
gem 'json'
gem 'tiny_tds'

将应用推送到 Heroku 的输出:

-----> Ruby app detected
-----> Compiling Ruby/Rack
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using 1.6.3
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
       The source :rubygems is deprecated because HTTP requests are insecure.
       Please change your source to 'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
       Fetching gem metadata from http://rubygems.org/..........
       Fetching additional metadata from http://rubygems.org/..
       Installing rack 1.5.2
       Using bundler 1.6.3
       Installing sinatra 1.0
       Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
       /tmp/build_57173bf8-9a1a-4b28-8b51-57ba286f69b3/vendor/ruby-2.0.0/bin/ruby extconf.rb
       checking for iconv_open() in iconv.h... yes
       checking for sybfront.h... 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=/tmp/build_57173bf8-9a1a-4b28-8b51-57ba286f69b3/vendor/ruby-2.0.0/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}/
       Gem files will remain installed in /tmp/build_57173bf8-9a1a-4b28-8b51-57ba286f69b3/vendor/bundle/ruby/2.0.0/gems/tiny_tds-0.6.2 for inspection.
       Results logged to /tmp/build_57173bf8-9a1a-4b28-8b51-57ba286f69b3/vendor/bundle/ruby/2.0.0/gems/tiny_tds-0.6.2/ext/tiny_tds/gem_make.out
       Installing json 1.8.1
       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.
       Bundler Output: The source :rubygems is deprecated because HTTP requests are insecure.
       Please change your source to 'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
       Fetching gem metadata from http://rubygems.org/..........
       Fetching additional metadata from http://rubygems.org/..
       Installing rack 1.5.2
       Using bundler 1.6.3
       Installing sinatra 1.0

       Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

       /tmp/build_57173bf8-9a1a-4b28-8b51-57ba286f69b3/vendor/ruby-2.0.0/bin/ruby extconf.rb
       checking for iconv_open() in iconv.h... yes
       checking for sybfront.h... 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=/tmp/build_57173bf8-9a1a-4b28-8b51-57ba286f69b3/vendor/ruby-2.0.0/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}/

       Gem files will remain installed in /tmp/build_57173bf8-9a1a-4b28-8b51-57ba286f69b3/vendor/bundle/ruby/2.0.0/gems/tiny_tds-0.6.2 for inspection.
       Results logged to /tmp/build_57173bf8-9a1a-4b28-8b51-57ba286f69b3/vendor/bundle/ruby/2.0.0/gems/tiny_tds-0.6.2/ext/tiny_tds/gem_make.out
       Installing json 1.8.1
       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.
 !     Failed to install gems via Bundler.

在我的本地主机上运行完美。我尝试删除存储库并创建一个新存储库,或者重新启动 heroku。我如何在heroku上安装tiny_tds?怎么了?

编辑 14 年 7 月 25 日

发生此错误是因为您的 dyno 缺少 freetds 库。使用这样的库需要使用自定义 buildpack。互联网上有很多开源构建包。例如https://github.com/firmhouse/heroku-buildpack-ruby-freetds

tnx 到 Damien(Heroku 支持)

4

1 回答 1

0

我猜你已经使用 C 构建开关在本地机器上安装了 TinyTDS gem,但没有通过 Bundler 指定。您是否在本地主机上沙箱安装?例如

bundle install --binstubs --path=vendor

看看这是否有效。我猜它应该会失败,因为现在无法访问项目之外的其他 gem。然后使用TinyTDS README 中建议的构建开关bundle config安装FreeTDS

于 2014-07-25T01:34:33.883 回答