ZXing / FFI / Spoon Gem 导致 Heroku 推送错误

发布于 2024-12-25 12:20:38 字数 3314 浏览 3 评论 0原文

我目前正在开发一个需要 ZXing gem 的项目(http://rubydoc.info /gems/zxing/0.3.1/frames)用于解码条形码图像。在我尝试在本地安装 gem 时,我遇到了一些依赖项的复杂情况,但是通过添加 ffi (http除了 jruby-jars 之外,还将 ://rubygems.org/gems/ffi)和 Spoon(http://rubygems.org/gems/spoon)gem 添加到我的 Gemfile 中。现在,我的本地计算机(iMac 和 MacBook Pro,都运行 Lion)上一切正常。但是,当我尝试将应用程序推送到 Heroku 时,终端在以下行挂起几分钟:

-----> Writing config/database.yml to read from DATABASE_URL

然后最后给我错误消息:

/app/slug-compiler/lib/utils.rb:62:in `block (2 levels) in spawn': command='/app/slug-compiler/lib/../buildpacks/ruby/bin/compile /tmp/build_31wo219fllz4d /app/tmp/repo.git/.cache' exit_status=0 out='' event=timeout elapsed=581.3388702869415 (Utils::TimeoutError)
    from /app/slug-compiler/lib/utils.rb:48:in `loop'
    from /app/slug-compiler/lib/utils.rb:48:in `block in spawn'
    from /app/slug-compiler/lib/utils.rb:44:in `popen'
    from /app/slug-compiler/lib/utils.rb:44:in `spawn'
    from /app/slug-compiler/lib/buildpack.rb:35:in `block in compile'
    from /app/slug-compiler/lib/buildpack.rb:33:in `fork'
    from /app/slug-compiler/lib/buildpack.rb:33:in `compile'
    from /app/slug-compiler/lib/slug.rb:464:in `block in run_buildpack'
    from /app/slug-compiler/lib/utils.rb:117:in `log'
    from /app/slug-compiler/lib/slug.rb:702:in `log'
    from /app/slug-compiler/lib/slug.rb:463:in `run_buildpack'
    from /app/slug-compiler/lib/slug.rb:107:in `block (2 levels) in compile'
    from /app/slug-compiler/lib/utils.rb:98:in `block in timeout'
    from /usr/local/lib/ruby/1.9.1/timeout.rb:58:in `timeout'
    from /app/slug-compiler/lib/utils.rb:98:in `rescue in timeout'
    from /app/slug-compiler/lib/utils.rb:93:in `timeout'
    from /app/slug-compiler/lib/slug.rb:96:in `block in compile'
    from /app/slug-compiler/lib/utils.rb:117:in `log'
    from /app/slug-compiler/lib/slug.rb:702:in `log'
    from /app/slug-compiler/lib/slug.rb:95:in `compile'
    from /app/slug-compiler/bin/slugc:85:in `block in <main>'
    from /app/slug-compiler/lib/slug.rb:472:in `block in lock'
    from /app/slug-compiler/lib/repo_lock.rb:44:in `call'
    from /app/slug-compiler/lib/repo_lock.rb:44:in `run'
    from /app/slug-compiler/lib/slug.rb:472:in `lock'
    from /app/slug-compiler/bin/slugc:66:in `<main>'
 !     Heroku push rejected, failed to compile Ruby/rails app

To [email protected]:integrating-zxing-on-heroku.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:integrating-zxing-on-heroku.git'

该问题似乎是由 ZXing gem 和/或其依赖项(ffi、spoon)引起的)。如果我从 Gemfile 中删除 zxing,Heroku 会编译该应用程序并且一切正常。重新添加 gem 后,我遇到了同样的问题。我还尝试在 application.rb 中将 config.assets.initialize_on_precompile 设置为 true 和 false,但无济于事。我有点不知所措,不知道现在该怎么办。

我的应用程序位于 Cedar 堆栈上,并在开发和生产中使用 PostgreSQL。

有人可以提供任何建议吗?

I'm currently working on a project that requires the ZXing gem (http://rubydoc.info/gems/zxing/0.3.1/frames) for decoding images of barcodes. In my attempts to install the gem locally, I ran into some complications with dependencies, but those were resolved by adding the ffi (http://rubygems.org/gems/ffi) and spoon (http://rubygems.org/gems/spoon) gems to my Gemfile, in addition to jruby-jars. Now, everything is working fine on my local machines (an iMac and a MacBook Pro, both running Lion). However, when I try to push the application to Heroku, the terminal hangs on the following line for several minutes:

-----> Writing config/database.yml to read from DATABASE_URL

Then finally gives me the error message:

/app/slug-compiler/lib/utils.rb:62:in `block (2 levels) in spawn': command='/app/slug-compiler/lib/../buildpacks/ruby/bin/compile /tmp/build_31wo219fllz4d /app/tmp/repo.git/.cache' exit_status=0 out='' event=timeout elapsed=581.3388702869415 (Utils::TimeoutError)
    from /app/slug-compiler/lib/utils.rb:48:in `loop'
    from /app/slug-compiler/lib/utils.rb:48:in `block in spawn'
    from /app/slug-compiler/lib/utils.rb:44:in `popen'
    from /app/slug-compiler/lib/utils.rb:44:in `spawn'
    from /app/slug-compiler/lib/buildpack.rb:35:in `block in compile'
    from /app/slug-compiler/lib/buildpack.rb:33:in `fork'
    from /app/slug-compiler/lib/buildpack.rb:33:in `compile'
    from /app/slug-compiler/lib/slug.rb:464:in `block in run_buildpack'
    from /app/slug-compiler/lib/utils.rb:117:in `log'
    from /app/slug-compiler/lib/slug.rb:702:in `log'
    from /app/slug-compiler/lib/slug.rb:463:in `run_buildpack'
    from /app/slug-compiler/lib/slug.rb:107:in `block (2 levels) in compile'
    from /app/slug-compiler/lib/utils.rb:98:in `block in timeout'
    from /usr/local/lib/ruby/1.9.1/timeout.rb:58:in `timeout'
    from /app/slug-compiler/lib/utils.rb:98:in `rescue in timeout'
    from /app/slug-compiler/lib/utils.rb:93:in `timeout'
    from /app/slug-compiler/lib/slug.rb:96:in `block in compile'
    from /app/slug-compiler/lib/utils.rb:117:in `log'
    from /app/slug-compiler/lib/slug.rb:702:in `log'
    from /app/slug-compiler/lib/slug.rb:95:in `compile'
    from /app/slug-compiler/bin/slugc:85:in `block in <main>'
    from /app/slug-compiler/lib/slug.rb:472:in `block in lock'
    from /app/slug-compiler/lib/repo_lock.rb:44:in `call'
    from /app/slug-compiler/lib/repo_lock.rb:44:in `run'
    from /app/slug-compiler/lib/slug.rb:472:in `lock'
    from /app/slug-compiler/bin/slugc:66:in `<main>'
 !     Heroku push rejected, failed to compile Ruby/rails app

To [email protected]:integrating-zxing-on-heroku.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:integrating-zxing-on-heroku.git'

The problem seems to be caused by the ZXing gem and/or its dependencies (ffi, spoon). If I remove zxing from my Gemfile, Heroku compiles the application and everything works fine. Upon re-adding the gem, I experience the same problems. I've also tried setting config.assets.initialize_on_precompile to both true and false in my application.rb, but to no avail. I'm kind of stumped as to what to do now.

My application is on the Cedar stack and using PostgreSQL in development and production.

Could anyone offer any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

青朷 2025-01-01 12:20:38

是的,不幸的是你不能使用任何具有 C++ 或 Java 依赖项的东西。我很难找到纯 ruby​​ 的 QR 解码器(并且运行良好)。

Yeah, unfortunately you can't use anything with C++ or Java dependencies. I'm having trouble finding a QR decoder that's pure ruby (and works well).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文