Friday, October 4, 2013

Installing Ruby: cannot load such file -- [ openssl | zlib ]

If you like me, installed Ruby by compiling from source code manually, and found that this 2 errors when trying to install bundler

  • cannot load such file -- openssl
  • cannot load such file -- zlib
You missed configure make to compile with those 2 libraries. Follow these steps to fix this issue.
  1. Remove the installed Ruby with make clean
  2. Install libssl-dev with your OS's package manager of choice. E.g. apt-get install libssl-dev
  3. Install zlib1g-dev with your OS's package manager of choice. E.g. apt-get install zlib1g-dev
  4. Config make file to include openssl by go to ext/openssl and run ruby extconf.rb
  5. Config make file to include zlib by go to ext/zlib and run ruby extconf.rb
  6. Go back to ruby source code directory run make && make install
  7. You should be able to successfully run gem install bundler
You can also do the same thing for readline. Install libreadline-dev and run extconf.rb in ext/readline

Tested with ruby 2.0.0p247
Credit:

Config number of file descriptors on Linux

Check file descriptor limit for a process. Vary depending on owner of the process $ cat /proc/{process-id}/limits Check current number of...