In attempting to build a completely static ruby, I've discovered a few issues.
The setup..
···
===========
I've built static versions of readline, zlib, iconv, dbm, and openssl. My intention is to build a completely static ruby, including all possible extensions.
Issue #1
Problem
-------
If you build openssl with zlib support, then Ruby's ext/openssl extension will not build. This is because the extconf.rb needs to include "-lz". Note, if your libssl.a is build *without* zlib, Ruby does attempt to build ext/openssl. This only happens when you build libssl.a *with* zlib support.
Resolution
----------
In the openssl extension, I suggest adding a test to see if "-lz" (zlib) exists. If it does, then include "-lz" on all of the subsequent openssl specific tests. I don't exactly know how to do this due to unfamiliarity with Ruby's extension build system.
Issue #2
Problem
-------
When using a static openssl library (libssl.a), and all static extensions (--with-static-linked-ext), the openssl digest functions (SHA) conflict with the same named symbols in ext/digest. I imagine this works fine under the *non-static* case because the symbols are resolved at runtime; however, in the *static* case, the symbols must be unique at link time -- and they are not.
Resolution
----------
I don't know about this one either - because Ruby's build system is already somewhat of a magical mystery to me. However, it seems that we need a mechanism to automagically choose which lib to link. In the case of a static libssl.a, the ext/digest functions should be considered "weak".
Closing Notes
If *anyone* knows *anything* about this, or has had similar experience, please let me know. Furthermore, if there's a more appropriate place to send this kind of thing than ruby-talk, let me know that too.
Thanks,
Steve