Constructing Custom Heroku Ruby/Rails Buildpack for Web App Using Taglib-Ruby

心已入冬 提交于 2020-01-01 06:39:07

问题


I've built an application using Rails 3.2 that makes use of the taglib-ruby gem.

I need to upload this app to Heroku, but it cannot successfully build the taglib-ruby gem because the associated C++ taglib library needs to be installed on the machine.

   Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
   /usr/local/bin/ruby extconf.rb
   checking for main() in -lstdc++... yes
   checking for main() in -ltag... no
   You must have taglib installed in order to use taglib-ruby.
   Debian/Ubuntu: sudo apt-get install libtag1-dev
   Fedora/RHEL: sudo yum install taglib-devel
   Brew: brew install taglib
   MacPorts: sudo port install taglib
   *** 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
   --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=/usr/local/bin/ruby
   --with-tag-dir
   --without-tag-dir
   --with-tag-include
   --without-tag-include=${tag-dir}/include
   --with-tag-lib
   --without-tag-lib=${tag-dir}/lib
   --with-stdc++lib
   --without-stdc++lib
   --with-taglib
   --without-taglib
   Gem files will remain installed in /tmp/build_1upomfnxnemtx/vendor/bundle/ruby/1.9.1/gems/taglib-ruby-0.5.2 for inspection.
   Results logged to /tmp/build_1upomfnxnemtx/vendor/bundle/ruby/1.9.1/gems/taglib-ruby-0.5.2/ext/taglib_base/gem_make.out
   An error occurred while installing taglib-ruby (0.5.2), and Bundler cannot
   continue.
   Make sure that `gem install taglib-ruby -v '0.5.2'` succeeds before bundling.

This led me to using Vulcan to construct a custom buildpack to install my app.

Following the advice at https://github.com/heroku/vulcan/issues/32 I was able to successfully install cmake and taglib using Vulcan. The resulting files that vulcan downloaded to my computer I've hosted at https://github.com/JllyGrnGiant/vulcan-buildpack

If I go into my app's directory and run

heroku create --stack cedar --buildpack [github repo].git

then try to push my app, the builder successfully finds the buildpack but doesn't know how to proceed instaling my app

Counting objects: 893, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (828/828), done.
Writing objects: 100% (893/893), 38.75 MiB | 1.03 MiB/s, done.
Total 893 (delta 480), reused 57 (delta 2)
-----> Fetching custom git buildpack... done
!     Heroku push rejected, no Cedar-supported app detected**

I believe this is because I need to fork the default ruby buildpack.

Now we reach my problem. I'm not very knowledgeable when it comes to deployment, so I don't know where to include my taglib files nor what other files to change so pushing my app finds those taglib libraries to build the taglib-ruby gem. The packaging binaries section of the help at Heroku's website doesn't make much sense to me let alone in the context of my problem where I don't have binaries, but lots of header files and libraries.

Other people who have asked this question about taglib-ruby and Heroku haven't gotten past installing cmake which completed fine for me, and I haven't been able to find resources explaining how to include libraries in a custom buildpack for a Ruby/Rails App.

Any help would be greatly appreciated. Thank you for your time.


回答1:


You need a custom buildpack. I just built a custom buildpack to install taglib on heroku it will install taglib gem with no errors. I spent about 2 weeks trying to get it installed and finally did.

https://github.com/menan/heroku-buildpack-ruby.git



来源:https://stackoverflow.com/questions/16106552/constructing-custom-heroku-ruby-rails-buildpack-for-web-app-using-taglib-ruby

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!