开发者

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

开发者 https://www.devze.com 2023-04-03 13:14 出处:网络
I am migrating a production app from bamboo stack to cedar, I successfully pushed the app on cedar but resulting in error like

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 bamb开发者_StackOverflow社区oo stack. In my case, its libtidy.so .

How can I fix this?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消