While migrating from Heroku Bamboo to Cedar stack, some native libraries are missing! How to fix it?

前提是你 提交于 2019-12-07 10:00:26

问题


I am migrating a production app from bamboo stack to cedar, I successfully pushed the app on cedar but resulting in error like

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 `'

Looks like some native libs are missing on Cedar stack which existed on bamboo stack. In my case, its libtidy.so .

How can I fix this?


回答1:


Bamboo stack and Cedar stack are quite different in terms of whats included in it. But the underlying linux kernel & architechture is same hence it should be safe to copy over the files

(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

Lets say your app uses tidy_ffi gem which requires shared object file libtidy.so to be present in /usr/lib.

In cedar, any call like TidyFFI::Tidy.new("Hello") will fail as

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

To fix it you can obtain a copy of libtidy.so from bamboo (you can use scp to any remote box for that) and commit it in your repo (may be at RAILS_ROOT/lib/native) and add following line to environment.rb

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

This will make tidy_ffi gem to look into lib/native for shared libraries. Push these changes to cedar app and everything should work fine.



来源:https://stackoverflow.com/questions/7357760/while-migrating-from-heroku-bamboo-to-cedar-stack-some-native-libraries-are-mis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!