4

问题

我正在尝试在 heroku 上安装 ruby​​ gem proj4rb,它需要C 库的proj_api头文件。PROJ.4

推送到heroku,我收到以下错误(仅显示相关行):

    Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/tmp/build_2701eb422e13f4f8f7a20fe030059498/vendor/ruby-2.1.5/bin/ruby extconf.rb
checking for proj_api.h... no
extconf.rb:6:in `<main>': Cannot find proj_api.h header (RuntimeError)
extconf failed, exit code 1
Gem files will remain installed in /tmp/build_2701eb422e13f4f8f7a20fe030059498/vendor/bundle/ruby/2.1.0/gems/proj4rb-1.0.0 for inspection.
Results logged to /tmp/build_2701eb422e13f4f8f7a20fe030059498/vendor/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0-static/proj4rb-1.0.0/gem_make.out
An error occurred while installing proj4rb (1.0.0), and Bundler cannot continue.
Make sure that `gem install proj4rb -v '1.0.0'` succeeds before bundling.
Bundler Output: Fetching gem metadata from https://rubygems.org/...........

...

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

/tmp/build_2701eb422e13f4f8f7a20fe030059498/vendor/ruby-2.1.5/bin/ruby extconf.rb
checking for proj_api.h... no
extconf.rb:6:in `<main>': Cannot find proj_api.h header (RuntimeError)

extconf failed, exit code 1

Gem files will remain installed in /tmp/build_2701eb422e13f4f8f7a20fe030059498/vendor/bundle/ruby/2.1.0/gems/proj4rb-1.0.0 for inspection.
Results logged to /tmp/build_2701eb422e13f4f8f7a20fe030059498/vendor/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0-static/proj4rb-1.0.0/gem_make.out
An error occurred while installing proj4rb (1.0.0), and Bundler cannot continue.
Make sure that `gem install proj4rb -v '1.0.0'` succeeds before bundling.
!
!     Failed to install gems via Bundler.
!
!     Push rejected, failed to compile Ruby app

我知道构建确实发生在一个特殊的容器上,然后部署到 heroku。这就是为什么我将 buildpacks 与下面显示的两个 buildpacks 一起使用,其中包括 . 当 Heroku 编译 ruby​​ 时,我得到了提到的错误。

跑步让我有点困惑

heroku run bash

接着

gem install proj4rb

工作没有错误。因此,我假设 buildpack 的安装确实有效,并且正在以这种方式找到标头。

问题

可以做些什么来消除这个问题?有没有一种简单的方法——我可能使用了错误的 geo-buildpack 吗?还是我必须为 ruby​​ 编写自己的 buildpack?还是只是配置的问题ruby-buildpack/geo-buildpack

任何帮助都将不胜感激。如果缺少输出信息,请告诉我。

环境

我正在使用默认的heroku getting-startet rails-project 以通过自定义构建包获得更好的“可重复性”。

Gemfile

source 'https://rubygems.org'

ruby '2.1.5'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.8'
# Use postgresql as the database for Active Record
gem 'pg'
gem 'rails_12factor', group: :production
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# 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'

# 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'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0',          group: :doc

# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring',        group: :development

# Use unicorn as the app server
gem 'unicorn'

gem 'proj4rb', '~> 1.0.0'

.buildpacks

https://github.com/cyberdelia/heroku-geo-buildpack.git#1.3
https://github.com/heroku/heroku-buildpack-ruby#v129
4

0 回答 0