【问题标题】:Constructing Custom Heroku Ruby/Rails Buildpack for Web App Using Taglib-Ruby使用 Taglib-Ruby 为 Web 应用程序构建自定义 Heroku Ruby/Rails Buildpack
【发布时间】:2013-04-19 14:06:19
【问题描述】:

我使用 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**

我相信这是因为我需要 fork 默认的 ruby​​ buildpack。

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

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

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

【问题讨论】:

    标签: ruby-on-rails heroku taglib buildpack taglib-ruby


    【解决方案1】:

    您需要一个自定义构建包。我刚刚构建了一个自定义 buildpack 来在 heroku 上安装 taglib,它将安装 taglib gem 而没有错误。我花了大约 2 周的时间尝试安装它,终于成功了。

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

    【讨论】:

    • 太棒了!你的包为我在 Heroku 上安装了 taglib-ruby。但是,我仍然遇到错误...将我的应用程序推送到 Heroku 后,我需要运行 heroku run db:migrate 这会产生错误 rake aborted! libtag.so.1: cannot open shared object file: No such file or directory - /app/vendor/bundle/ruby/1.9.1/gems/taglib-ruby-0.5.2/lib/taglib_base.so 所以缺少一个库。你遇到过这个问题吗?再次感谢您帮助我走到这一步。
    • 这会详细告诉你如何解决这个问题:) github.com/robinst/taglib-ruby/issues/28#issuecomment-16818128
    • 先生,您是救命稻草。感谢您的所有帮助。
    • 我已经为 taglib 制作了一个更新的但不完善的 buildpack,嵌入了 taglib-ruby v1.0 所需的 1.11.1 构建的库。可在github.com/dvkch/taglib-buildpack 获得
    猜你喜欢
    • 2023-03-10
    • 1970-01-01
    • 1970-01-01
    • 2011-01-05
    • 1970-01-01
    • 1970-01-01
    • 2013-08-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多