gpt4 book ai didi

ruby - 从 Heroku Bamboo 迁移到 Cedar stack 时,一些本地库丢失了!如何解决?

转载 作者:数据小太阳 更新时间:2023-10-29 07:30:57 25 4
gpt4 key购买 nike

我正在将一个生产应用程序从 bamboo stack 迁移到 cedar,我成功地将应用程序推送到 cedar 但导致错误,如

LoadError: Could not open library 'lib.so': lib.so: cannot open shared object file: No such file or directory
from /app/vendor/bundle/ruby/1.9.1/gems/ffi-1.0.9/lib/ffi/library.rb:75:in `block in ffi_lib'
from /app/vendor/bundle/ruby/1.9.1/gems/ffi-1.0.9/lib/ffi/library.rb:54:in `map'
from /app/vendor/bundle/ruby/1.9.1/gems/ffi-1.0.9/lib/ffi/library.rb:54:in `ffi_lib'

0.1.3/lib/tidy_ffi/interface.rb:5:in `'

Cedar stack 上似乎缺少一些 native 库,而 Cedar stack 存在于 bamboo stack 上。就我而言,它是 libtidy.so 。

我该如何解决这个问题?

最佳答案

竹栈和雪松栈在包含的内容方面有很大不同。但是底层的 linux 内核和架构是相同的,因此复制文件应该是安全的

(local)$ heroku run bash --app bamboo-app-name
(remote)$ uname -a
Linux 2.6.32-316-ec2 #31-Ubuntu SMP Wed May 18 14:10:36 UTC 2011 x86_64 GNU/Linux

(local)$ heroku run bash --app cedar-app-name
(remote)$ uname -a
Linux 2.6.32-316-ec2 #31-Ubuntu SMP Wed May 18 14:10:36 UTC 2011 x86_64 GNU/Linux

假设您的应用程序使用 tidy_ffi gem,它需要共享对象文件 libtidy.so 出现在/usr/lib 中。

在 Cedar 中,任何像 TidyFFI::Tidy.new("Hello") 这样的调用都会失败,因为

LoadError: Could not open library 'lib.so': lib.so: cannot open shared object file: No such file or directory

要修复它,您可以从 bamboo 获取 libtidy.so 的副本(您可以为此使用 scp 到任何远程框)并将其提交到您的 repo(可能位于 RAILS_ROOT/lib/native)并将以下行添加到环境.rb

ENV['LD_LIBRARY_PATH'] ||="/usr/lib"
ENV['LD_LIBRARY_PATH'] +=":/app/lib/native"

这将使 tidy_ffi gem 可以查看共享库的 lib/native。将这些更改推送到 cedar 应用程序,一切都会正常工作。

关于ruby - 从 Heroku Bamboo 迁移到 Cedar stack 时,一些本地库丢失了!如何解决?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7357760/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com