libruby.so.1.8: cannot open shared object file: No such file or directory

dku.rajkumar picture dku.rajkumar · Mar 5, 2012 · Viewed 15.2k times · Source

I am getting the below error while starting server of my project. I am trying to resolve since yesterday but was not able to solve it. somebody pls help me.

=> Booting WEBrick
=> Rails 2.3.14 application starting on http://0.0.0.0:3001
Encountered error loading /home/success/prj/myprj/vendor/gems/mysql2-0.2.18/precompiled/i686-linux/1.8.7/mysql2/mysql2.so: libruby.so.1.8: cannot open shared object file: No such file or directory - /home/success/prj/myprj/vendor/gems/mysql2-0.2.18/precompiled/i686-linux/1.8.7/mysql2/mysql2.so
Encountered error loading /home/success/prj/myprj/vendor/gems/mysql2-0.2.18/precompiled/i686-linux/1.8.7/mysql2/mysql2.so: libruby.so.1.8: cannot open shared object file: No such file or directory - /home/success/prj/myprj/vendor/gems/mysql2-0.2.18/precompiled/i686-linux/1.8.7/mysql2/mysql2.so
/home/success/prj/eschool/vendor/gems/mysql2-0.2.18/lib/mysql2/mysql2.rb:13: Failed to load mysql2 binary for your platform (i686-linux/1.8.7) Run ./compile_native_library.rb (RuntimeError)
        from /home/success/prj/myprj/vendor/gems/rubygems-update-1.7.2/lib/rubygems/custom_require.rb:36:in `gem_original_require'
        from /home/success/prj/myprj/vendor/gems/rubygems-update-1.7.2/lib/rubygems/custom_require.rb:36:in `require'
        from /home/success/prj/myprj/vendor/rails/activesupport/lib/active_support/dependencies.rb:182:in `require'
        from /home/success/prj/myprj/vendor/rails/activesupport/lib/active_support/dependencies.rb:547:in `new_constants_in'
        from /home/success/prj/myprj/vendor/rails/activesupport/lib/active_support/dependencies.rb:182:in `require'
        from /home/success/prj/myprj/vendor/gems/mysql2-0.2.18/lib/mysql2.rb:9

UPDATE:

success@success-Vostro-1400:/usr/lib$ ls -l libruby*
lrwxrwxrwx 1 root root      19 2012-02-22 07:07 libruby1.8.so -> libruby1.8.so.1.8.7
lrwxrwxrwx 1 root root      19 2012-02-22 07:07 libruby1.8.so.1.8 -> libruby1.8.so.1.8.7
-rw-r--r-- 1 root root  956360 2012-02-22 07:22 libruby1.8.so.1.8.7
-rw-r--r-- 1 root root 1436438 2012-02-22 07:22 libruby1.8-static.a

Answer

dku.rajkumar picture dku.rajkumar · Mar 5, 2012

I solved this problem following below steps :

  1. uninstall all the mysql2 gems
  2. install mysql2, version < 0.3
  3. go to vendor/gems directory
  4. execute gem unpack mysql2
  5. execute rake gems:refresh_specs
  6. execute rake gems:build
  7. add config.gem mysql2 to environment.rb
  8. restart the server