Manually Load Shared Library in Ruby

Recently I needed to run a Ruby script that required the openssl library for communications. However after setting up Ruby on Mac OS X for the first time and succeeding in installing all the required gems, the following error kept popping.

dyld: lazy symbol binding failed: Symbol not found: _SSL_library_init

I couldn’t find much help online and I have no idea yet how to actually debug linker problems with the ruby system. However I figured out a quick and easy way to overcome the error.

require 'dl'
ssl = DL::dlopen('/usr/lib/libssl.dylib');

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">