Problem
I'm trying to install the ruby gem proj4rb on heroku, which requires the proj_api
header files of the PROJ.4
C library.
Pushing to heroku, I get the following error (only relevant lines shown):
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
I know that building does happen on a special container and is then deployed to heroku. That's why I use buildpacks with the two buildpacks shown below, which include the . While Heroku compiles the ruby, I get the mentioned error.
It's confusing me a bit that running
heroku run bash
and then
gem install proj4rb
works without error. So I assume the installation of the buildpack does work and the headers are being found, this way.
Question
What can be done to eliminate this issue? Is there a simple way—did I perhaps use the wrong geo-buildpack? Or do I have to write my own buildpack for ruby? Or is it just a matter of configuration of the ruby-buildpack/geo-buildpack
?
Any help is kindly appreciated. Please let me know if output information is missing.
Setting
I'm using the default heroku getting-startet rails-project for better "reproducibility" with custom buildpacks.
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