使用Taglib-Ruby为Web应用程序构建自定义Heroku Ruby / Rails Buildpack

我使用Rails 3.2构建了一个使用taglib-ruby gem的应用程序。

我需要将此应用程序上传到Heroku,但它无法成功构建taglib-ruby gem,因为需要在计算机上安装关联的C ++ taglib库。

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. 

这导致我使用Vulcan构建自定义buildpack来安装我的应用程序。

按照https://github.com/heroku/vulcan/issues/32上的建议,我能够使用Vulcan成功安装cmake和taglib。 vulcan下载到我的计算机的结果文件我在https://github.com/JllyGrnGiant/vulcan-buildpack上托管

如果我进入我的应用程序目录并运行

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

然后尝试推送我的应用程序,构建器成功找到buildpack但不知道如何继续安装我的应用程序

 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** 

我相信这是因为我需要分叉默认的ruby buildpack。

现在我们遇到了问题。 在部署方面我不是很了解,所以我不知道在哪里包含我的taglib文件,也不知道要更改的其他文件,所以推送我的应用程序找到那些taglib库来构建taglib-ruby gem。 Heroku网站帮助的打包二进制文件部分对我来说没有多大意义,更不用说在我没有二进制文件但有大量头文件和库的问题的上下文中。

有人问过关于taglib-ruby和Heroku这个问题的其他人还没有完成安装cmake,这对我来说很好,而且我找不到解释如何在Ruby / Rails的自定义buildpack中包含库的资源应用。

任何帮助将不胜感激。 感谢您的时间。

您需要一个自定义buildpack。 我刚刚构建了一个自定义buildpack来在heroku上安装taglib,它将安装taglib gem而没有错误。 我花了大约2个星期试图安装它,最后做了。

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