[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Two build issues with 1.8.4..

Stephen Waits

3/21/2006 7:04:00 PM

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



4 Answers

Nobuyoshi Nakada

3/22/2006 7:03:00 AM

0

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


Stephen Waits

3/22/2006 7:16:00 PM

0

WARNING: This e-mail has been altered by MIMEDefang. Following this
paragraph are indications of the actual changes made. For more
information about your site's MIMEDefang policy, contact
SCEA PD Postmaster <postmaster@scea.com>. For more information about MIMEDefang, see:

http://www.roaringpenguin.com/mimedefang/en...

An attachment named go.sh was removed from this document as it
constituted a security hazard. If you require this document, please contact
the sender and arrange an alternate means of receiving it.

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


gcc -g -O2 -DRUBY_EXPORT -L/home/swaits/rbundler/work/lib -rdynamic -Wl,-export-dynamic -L. -L"/home/swaits/rbundler/work/lib" main.o ext/extinit.o ext/bigdecimal/bigdecimal.a ext/curses/curses.a ext/dbm/dbm.a ext/digest/digest.a ext/digest/md5/md5.a ext/digest/rmd160/rmd160.a ext/digest/sha1/sha1.a ext/digest/sha2/sha2.a ext/dl/dl.a ext/enumerator/enumerator.a ext/etc/etc.a ext/fcntl/fcntl.a ext/gdbm/gdbm.a ext/iconv/iconv.a ext/io/wait/wait.a ext/nkf/nkf.a ext/openssl/openssl.a ext/pty/pty.a ext/racc/cparse/cparse.a ext/readline/readline.a ext/sdbm/sdbm.a ext/socket/socket.a ext/stringio/stringio.a ext/strscan/strscan.a ext/syck/syck.a ext/syslog/syslog.a ext/zlib/zlib.a -lruby-static -ldl -lcrypt -lm -lreadline -lncurses -lgdbm_compat -lgdbm -lssl -lcrypto -ldl -liconv -lutil -lz -o ruby
/home/swaits/rbundler/work/lib/libcrypto.a(sha256.o): In function `SHA256_Transform':
sha256.c:(.text+0x2460): multiple definition of `SHA256_Transform'
ext/digest/sha2/sha2.a(sha2.o):/home/swaits/rbundler/build/ruby-1.8.4/ext/digest/sha2/sha2.c:390: first defined here
/usr/bin/ld: Warning: size of symbol `SHA256_Transform' changed from 641 in ext/digest/sha2/sha2.a(sha2.o) to 26 in /home/swaits/rbundler/work/lib/libcrypto.a(sha256.o)
/home/swaits/rbundler/work/lib/libcrypto.a(sha512.o): In function `SHA512_Transform':
sha512.c:(.text+0x6870): multiple definition of `SHA512_Transform'
ext/digest/sha2/sha2.a(sha2.o):/home/swaits/rbundler/build/ruby-1.8.4/ext/digest/sha2/sha2.c:688: first defined here
/usr/bin/ld: Warning: size of symbol `SHA512_Transform' changed from 2534 in ext/digest/sha2/sha2.a(sha2.o) to 18 in /home/swaits/rbundler/work/lib/libcrypto.a(sha512.o)
collect2: ld returned 1 exit status
make[1]: *** [ruby] Error 1

Logan Capaldo

3/23/2006 6:15:00 AM

0


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
>
>


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/...




Stephen Waits

3/23/2006 3:13:00 PM

0


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.

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

--Steve