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 をインストールするにはどうすればよいですか? なにが問題ですか?

編集 25/7/14

このエラーは、dyno に freetds ライブラリがないために発生します。このようなライブラリを使用するには、カスタム ビルドパックを使用する必要があります。インターネット上にはオープンソースのビルドパックがたくさんあります。例: https://github.com/firmhouse/heroku-buildpack-ruby-freetds

Damien への tnx (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 に答える