0

我的 Rails 应用程序通过 localhost 在我的机器上运行良好,但是当我将它部署到 Heroku 时,我得到了以下错误列表:

2012-11-11T04:59:20+00:00 heroku[web.1]: Starting process with command `bundle exec thin start -R config.ru -e production -p 38941`
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/ffi-inline-0.0.4/lib/ffi/inline/builders/c.rb:114:in `shared_object'
2012-11-11T04:59:33+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/ffi-inline-0.0.4/lib/ffi/inline/compilers/gcc.rb:29:in `compile': compile error: see logs at /tmp/.ffi-inline-18803/85aad7364f11885370e58c4391df70e29ef22bbe.log (CompilationError)
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/ffi-inline-0.0.4/lib/ffi/inline/builders.rb:87:in `instance_eval'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/ffi-inline-0.0.4/lib/ffi/inline/builders.rb:87:in `build'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/ffi-inline-0.0.4/lib/ffi/inline/inline.rb:39:in `inline'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/ffi-inline-0.0.4/lib/ffi/inline/inline.rb:54:in `singleton_inline'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/tesseract-ocr-0.1.5/lib/tesseract/c.rb:34:in `<module:C>'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/tesseract-ocr-0.1.5/lib/tesseract/c.rb:31:in `<module:Tesseract>'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/tesseract-ocr-0.1.5/lib/tesseract/c.rb:29:in `<top (required)>'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `block in require'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/tesseract-ocr-0.1.5/lib/tesseract/api.rb:26:in `<top (required)>'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/ffi-inline-0.0.4/lib/ffi/inline/builders.rb:90:in `block in build'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/tesseract-ocr-0.1.5/lib/tesseract-ocr.rb:35:in `<top (required)>'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in `each'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `block in require'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in `require'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in `each'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in `require'
2012-11-11T04:59:33+
00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/bundler-1.2.1/lib/bundler.rb:128:in `require'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/config/application.rb:7:in `<top (required)>'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/config/environment.rb:2:in `require'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in `block in require'
2012-11-11T04:59:33+00:00 app[web.1]:   from config.ru:3:in `require'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/config/environment.rb:2:in `<top (required)>'
2012-11-11T04:59:33+00:00 app[web.1]:   from config.ru:3:in `block in <main>'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/controllers/controller.rb:181:in `load_rackup_config'
2012-11-11T04:59:33+00:00 app[web.1]:   from config.ru:1:in `new'
2012-11-11T04:59:33+00:00 app[web.1]:   from config.ru:1:in `<main>'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/bin/thin:6:in `<top (required)>'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/bin/thin:19:in `load'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/bin/thin:19:in `<main>'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/rack/adapter/loader.rb:33:in `eval'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/rack/adapter/loader.rb:33:in `load'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/controllers/controller.rb:71:in `start'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/runner.rb:185:in `run_command'
2012-11-11T04:59:33+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/runner.rb:151:in `run!'
2012-11-11T04:59:34+00:00 heroku[web.1]: Process exited with status 1
2012-11-11T04:59:38+00:00 heroku[router]: Error H10 (App crashed)

除了 Heroku 可能对我正在使用的Ruby Tesseract gem有一些问题之外,我似乎无法对此做出正面或反面。也许依赖关系有问题?

更新:

经过进一步搜索,事实证明该问题与 Tesseract gem 有关

根据支持票我需要设置这些路径......

ENV['CFLAGS'] = '-I/path/to/the/headers'
ENV['LDFLAGS'] = '-L/path/to/the/libs'

...但我不知道如何设置它们,或者头文件/库的路径实际上应该在部署到 Heroku 的 Rails 应用程序上。有什么见解吗?

4

2 回答 2

3

以下是 Heroku 对我向他们提出的一张票的回复:


你好,

不幸的是,我们不支持在我们的堆栈中安装额外的库或二进制文件。最好的解决方法是将这些供应商到您的项目中。您需要使用 64 位 Linux 版本才能使它们在 Heroku 上运行;静态编译还可以帮助确保包含所需的任何依赖项。同样,对于依赖于外部库的 gem,我们建议静态编译 gem 并将其出售到您的项目中。

我们意识到这不是一项微不足道的任务,而且可能很难开始工作,我们希望在未来提供一种更简单的方法来做到这一点。不幸的是,我们没有关于何时可以使用此改进功能的 ETA。

如果您确实希望尝试提供您的二进制文件、库或 gem,您可以使用 Heroku 作为您的构建环境。我们的一位工程师创建了一个构建服务器,允许您上传源代码、运行编译步骤,然后下载生成的二进制文件。你可以在这里找到这个项目: https ://github.com/heroku/vulcan

谢谢,Heroku 支持


换句话说,去其他地方部署。

于 2012-11-20T00:07:33.450 回答
1

我也面临同样的问题,希望我们能互相帮助。

我找到了一种在 Heroku 上设置 config var 的方法。根据 meh 在 github 上的评论,看起来它需要在 Heroku 上安装 Tesseract。也许你可以问 Heroku 的安装位置在哪里?

我还发现提到的其他 gem可以成功集成到 Heroku。不幸的是,它仍然使用 tesseract 2.04。

于 2012-11-12T07:57:49.143 回答