Two build issues with 1.8.4

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

Hi,

At Wed, 22 Mar 2006 04:04:12 +0900,
Stephen Waits wrote in [ruby-talk:185160]:

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.

Can you show the mkmf.log. It is important for build issues.

···

--
Nobu Nakada

Have you looked at AllInOneRuby? It may have solved some of your problems already. Technically its _not_ a static build of ruby though.

http://www.erikveen.dds.nl/allinoneruby/index.html

···

On Mar 21, 2006, at 2:04 PM, Stephen Waits wrote:

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

nobu@ruby-lang.org wrote:

Can you show the mkmf.log. It is important for build issues.

Sure.. See attached files. (This is for scenario two I mentioned, where static openssl conflicts with static digest).

Also find my script I use to build an all-static ruby. Maybe it will be useful.

--Steve

warning1.txt (545 Bytes)

linkerror.txt (1.71 KB)

mkmf.log (25.2 KB)

Thanks for the reply; however, I need an entirely static Ruby.

--Steve

···

On Mar 22, 2006, at 10:15 PM, Logan Capaldo wrote:

Have you looked at AllInOneRuby? It may have solved some of your problems already. Technically its _not_ a static build of ruby though.