cyberdelia / heroku-geo-buildpack

Geo libraries for Heroku
https://github.com/heroku/heroku-geo-buildpack
114 stars 135 forks source link

Not working on cedar-14 stack #28

Closed joelmahoney closed 9 years ago

joelmahoney commented 9 years ago

I attempted to upgrade a couple of projects to the cedar-14 stack and got an rgeo build error. Works fine on cedar-10. Here's the deploy error:

$ git push staging rules:master
Fetching repository, done.
Counting objects: 28, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (28/28), done.
Writing objects: 100% (28/28), 460.97 KiB | 202.00 KiB/s, done.
Total 28 (delta 16), reused 0 (delta 0)

-----> Fetching custom git buildpack... done
-----> Multipack app detected
=====> Downloading Buildpack: https://github.com/cyberdelia/heroku-geo-buildpack.git
=====> Detected Framework: geos/gdal/proj
       Using geos version: 3.4.2
       Using gdal version: 1.11.1
       Using proj version: 4.8.0_1
-----> Fetching and vendoring geos
-----> Fetching and vendoring gdal
-----> Fetching and vendoring proj
-----> Vendoring geo libraries done
=====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-ruby.git
=====> Detected Framework: Ruby
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.2.0
-----> Installing dependencies using 1.7.12
       Purging Cache. Changing stack from cedar to cedar-14
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
       Fetching source index from https://rubygems.org/
       Fetching https://github.com/opencounter/esri-arcgis-geocoder.git
       Fetching git://github.com/thoughtbot/paperclip.git
       Using rake 10.4.2
       Installing minitest 5.5.1
       Installing i18n 0.7.0
       Installing builder 3.2.2
       Installing thread_safe 0.3.4
       Installing mini_portile 0.6.2
       Installing erubis 2.7.0
       Installing rack 1.6.0
       Installing mime-types 2.4.3
       Installing arel 6.0.0
       sh: 1: Syntax error: Unterminated quoted string
       Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
       /tmp/build_a2afdcf085e0ce85fd2eb82cbf6d4a8a/vendor/ruby-2.2.0/bin/ruby -r ./siteconf20150315-1320-1khawqe.rb extconf.rb '''''''''''''''''''''''--with-geos-dir=/tmp/build_528040c54dc7d6999b020014017b830d/.heroku/vendor --with-geos-lib=/tmp/build_528040c54dc7d6999b020014017b830d/.heroku/vendor/lib --with-proj-dir=/tmp/build_528040c54dc7d6999b020014017b830d/.heroku/vendor''''''''''''''''''''''
       extconf failed, exit code 2
       Gem files will remain installed in /tmp/build_a2afdcf085e0ce85fd2eb82cbf6d4a8a/vendor/bundle/ruby/2.2.0/gems/rgeo-0.3.20 for inspection.
       Results logged to /tmp/build_a2afdcf085e0ce85fd2eb82cbf6d4a8a/vendor/bundle/ruby/2.2.0/extensions/x86_64-linux/2.2.0-static/rgeo-0.3.20/gem_make.out
       Installing multi_json 1.11.0
       Installing json 1.8.2
       An error occurred while installing rgeo (0.3.20), and Bundler cannot continue.
       Make sure that `gem install rgeo -v '0.3.20'` succeeds before bundling.
       Bundler Output: Fetching source index from https://rubygems.org/
       Fetching https://github.com/opencounter/esri-arcgis-geocoder.git
       Fetching git://github.com/thoughtbot/paperclip.git
       Using rake 10.4.2
       Installing minitest 5.5.1
       Installing i18n 0.7.0
       Installing builder 3.2.2
       Installing thread_safe 0.3.4
       Installing mini_portile 0.6.2
       Installing erubis 2.7.0
       Installing rack 1.6.0
       Installing mime-types 2.4.3
       Installing arel 6.0.0
       sh: 1: Syntax error: Unterminated quoted string

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

       /tmp/build_a2afdcf085e0ce85fd2eb82cbf6d4a8a/vendor/ruby-2.2.0/bin/ruby -r ./siteconf20150315-1320-1khawqe.rb extconf.rb '''''''''''''''''''''''--with-geos-dir=/tmp/build_528040c54dc7d6999b020014017b830d/.heroku/vendor --with-geos-lib=/tmp/build_528040c54dc7d6999b020014017b830d/.heroku/vendor/lib --with-proj-dir=/tmp/build_528040c54dc7d6999b020014017b830d/.heroku/vendor''''''''''''''''''''''

       extconf failed, exit code 2

       Gem files will remain installed in /tmp/build_a2afdcf085e0ce85fd2eb82cbf6d4a8a/vendor/bundle/ruby/2.2.0/gems/rgeo-0.3.20 for inspection.
       Results logged to /tmp/build_a2afdcf085e0ce85fd2eb82cbf6d4a8a/vendor/bundle/ruby/2.2.0/extensions/x86_64-linux/2.2.0-static/rgeo-0.3.20/gem_make.out
       Installing multi_json 1.11.0
       Installing json 1.8.2
       An error occurred while installing rgeo (0.3.20), and Bundler cannot continue.
       Make sure that `gem install rgeo -v '0.3.20'` succeeds before bundling.
 !
 !     Failed to install gems via Bundler.
 !

 !     Push rejected, failed to compile Multipack app
joelmahoney commented 9 years ago

I was able to resolve this issue by running heroku repo:purge_cache before heroku stack:set cedar-14 and then deploying. After doing so, RGeo::Geos.supported? returned true, unlike @beejamin's report in cyberdelia/heroku-geo-buildpack#23

desaperados commented 9 years ago

I've got exactly the same issue with the same output as above on cedar-14. I'm also able resolve by running heroku repo purge:cache which results in a successful build with RGeo::Geos.supported? => true

However, the next time I deploy I'm back to the same error. So basically not able to deploy without first running heroku repo purge:cache.

ardell commented 9 years ago

Ran into something quite similar. Here's how we solved it:

  1. Put the geos buildpack before the ruby buildpack
  2. Run heroku repo:purge_cache (see: https://github.com/heroku/heroku-repo)
  3. Push to heroku (you may have to git commit --allow-empty)

Basically gems get cached between deploys, even if you add a new buildpack. So you need to clear out the gem cache, then redeploy to rebuild gems. Output should look like...

$> git push heroku
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 317 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Fetching custom git buildpack... done
remote: -----> Multipack app detected
remote: =====> Downloading Buildpack: https://github.com/cyberdelia/heroku-geo-buildpack.git
remote: =====> Detected Framework: geos/gdal/proj
remote:        Using geos version: 3.4.2
remote:        Using gdal version: 1.11.1
remote:        Using proj version: 4.8.0_1
remote: -----> Fetching and vendoring geos
remote: -----> Fetching and vendoring gdal
remote: -----> Fetching and vendoring proj
remote: -----> Vendoring geo libraries done
remote: =====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-ruby.git
remote: =====> Detected Framework: Ruby
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.1.6
remote: -----> Installing dependencies using 1.6.3
remote:        Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote:        Fetching source index from https://rubygems.org/
... [misc gem install stuff] ...

The important part here is that installing the geo buildpack comes before bundle install.

After that I get...

$> heroku run rails c
irb> require 'rgeo'
=> false
irb> RGeo::Geos.supported?
=> true
irb> RGeo::CoordSys::Proj4.supported?
=> true

Hope this helps someone!