Two build issues with 1.8.4..

S

Stephen Waits

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
 
N

nobu

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

Stephen Waits

--------------000309040206090502030203
Content-Type: text/plain; name="warning1.txt"
Content-Disposition: inline; filename="warning1.txt"
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
X-Mailer: MIME-tools 5.415 (Entity 5.415)

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 <[email protected]>. For more information about MIMEDefang, see:

http://www.roaringpenguin.com/mimedefang/enduser.php3

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.


--------------000309040206090502030203
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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



--------------000309040206090502030203
Content-Type: text/plain;
name="linkerror.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="linkerror.txt"

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

--------------000309040206090502030203
Content-Type: text/x-log;
name="mkmf.log"
Content-Disposition: inline; filename="mkmf.log"
Content-Transfer-Encoding: quoted-printable

have_library: checking for t_open() in -lnsl... -------------------- no

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lrub=
y-static -lnsl -ldl -lcrypt -lm -lc"
/tmp/cc0bd2eZ.o: In function `t':
/home/swaits/rbundler/build/ruby-1.8.4/ext/openssl/conftest.c:4: undefine=
d reference to `t_open'
collect2: ld returned 1 exit status
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { t_open(); return 0; }
/* end */

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lrub=
y-static -lnsl -ldl -lcrypt -lm -lc"
conftest.c: In function =E2=80=98t=E2=80=99:
conftest.c:5: error: =E2=80=98t_open=E2=80=99 undeclared (first use in th=
is function)
conftest.c:5: error: (Each undeclared identifier is reported only once
conftest.c:5: error: for each function it appears in.)
checked program was:
/* begin */


/*top*/
int main() { return 0; }
int t() { void ((*volatile p)()); p =3D (void ((*)()))t_open; return 0; }
/* end */

--------------------

have_library: checking for socket() in -lsocket... -------------------- n=
o

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lrub=
y-static -lsocket -ldl -lcrypt -lm -lc"
/usr/bin/ld: cannot find -lsocket
collect2: ld returned 1 exit status
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { socket(); return 0; }
/* end */

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lrub=
y-static -lsocket -ldl -lcrypt -lm -lc"
conftest.c: In function =E2=80=98t=E2=80=99:
conftest.c:5: error: =E2=80=98socket=E2=80=99 undeclared (first use in th=
is function)
conftest.c:5: error: (Each undeclared identifier is reported only once
conftest.c:5: error: for each function it appears in.)
checked program was:
/* begin */


/*top*/
int main() { return 0; }
int t() { void ((*volatile p)()); p =3D (void ((*)()))socket; return 0; }
/* end */

--------------------

have_header: checking for unistd.h... -------------------- yes

"gcc -E -I../.. -I../../. -I/home/swaits/rbundler/work/include -g -O2 co=
nftest.c -o conftest.i"
checked program was:
/* begin */
#include <unistd.h>
/* end */

--------------------

have_header: checking for sys/time.h... -------------------- yes

"gcc -E -I../.. -I../../. -I/home/swaits/rbundler/work/include -g -O2 co=
nftest.c -o conftest.i"
checked program was:
/* begin */
#include <sys/time.h>
/* end */

--------------------

have_header: checking for assert.h... -------------------- yes

"gcc -E -I../.. -I../../. -I/home/swaits/rbundler/work/include -g -O2 co=
nftest.c -o conftest.i"
checked program was:
/* begin */
#include <assert.h>
/* end */

--------------------

have_header: checking for openssl/ssl.h... -------------------- yes

"gcc -E -I../.. -I../../. -I/home/swaits/rbundler/work/include -g -O2 co=
nftest.c -o conftest.i"
checked program was:
/* begin */
#include <openssl/ssl.h>
/* end */

--------------------

have_library: checking for OpenSSL_add_all_digests() in -lcrypto... -----=
--------------- yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lrub=
y-static -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { OpenSSL_add_all_digests(); return 0; }
/* end */

--------------------

have_library: checking for SSL_library_init() in -lssl... ---------------=
----- yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lcryp=
to -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { SSL_library_init(); return 0; }
/* end */

--------------------

have_header: checking for openssl/conf_api.h... -------------------- yes

"gcc -E -I../.. -I../../. -I/home/swaits/rbundler/work/include -g -O2 co=
nftest.c -o conftest.i"
checked program was:
/* begin */
#include <openssl/conf_api.h>
/* end */

--------------------

have_func: checking for ERR_peek_last_error()... -------------------- yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { ERR_peek_last_error(); return 0; }
/* end */

--------------------

have_func: checking for BN_mod_add()... -------------------- yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { BN_mod_add(); return 0; }
/* end */

--------------------

have_func: checking for BN_mod_sqr()... -------------------- yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { BN_mod_sqr(); return 0; }
/* end */

--------------------

have_func: checking for BN_mod_sub()... -------------------- yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { BN_mod_sub(); return 0; }
/* end */

--------------------

have_func: checking for BN_pseudo_rand_range()... -------------------- ye=
s

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { BN_pseudo_rand_range(); return 0; }
/* end */

--------------------

have_func: checking for BN_rand_range()... -------------------- yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { BN_rand_range(); return 0; }
/* end */

--------------------

have_func: checking for CONF_get1_default_config_file()... --------------=
------ yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { CONF_get1_default_config_file(); return 0; }
/* end */

--------------------

have_func: checking for EVP_CIPHER_CTX_copy()... -------------------- no

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
/tmp/ccUPGIFB.o: In function `t':
/home/swaits/rbundler/build/ruby-1.8.4/ext/openssl/conftest.c:4: undefine=
d reference to `EVP_CIPHER_CTX_copy'
collect2: ld returned 1 exit status
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { EVP_CIPHER_CTX_copy(); return 0; }
/* end */

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
conftest.c: In function =E2=80=98t=E2=80=99:
conftest.c:5: error: =E2=80=98EVP_CIPHER_CTX_copy=E2=80=99 undeclared (fi=
rst use in this function)
conftest.c:5: error: (Each undeclared identifier is reported only once
conftest.c:5: error: for each function it appears in.)
checked program was:
/* begin */


/*top*/
int main() { return 0; }
int t() { void ((*volatile p)()); p =3D (void ((*)()))EVP_CIPHER_CTX_copy=
; return 0; }
/* end */

--------------------

have_func: checking for EVP_CIPHER_CTX_set_padding()... -----------------=
--- yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { EVP_CIPHER_CTX_set_padding(); return 0; }
/* end */

--------------------

have_func: checking for EVP_CipherFinal_ex()... -------------------- yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { EVP_CipherFinal_ex(); return 0; }
/* end */

--------------------

have_func: checking for EVP_CipherInit_ex()... -------------------- yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { EVP_CipherInit_ex(); return 0; }
/* end */

--------------------

have_func: checking for EVP_DigestFinal_ex()... -------------------- yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { EVP_DigestFinal_ex(); return 0; }
/* end */

--------------------

have_func: checking for EVP_DigestInit_ex()... -------------------- yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { EVP_DigestInit_ex(); return 0; }
/* end */

--------------------

have_func: checking for EVP_MD_CTX_cleanup()... -------------------- yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { EVP_MD_CTX_cleanup(); return 0; }
/* end */

--------------------

have_func: checking for EVP_MD_CTX_create()... -------------------- yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { EVP_MD_CTX_create(); return 0; }
/* end */

--------------------

have_func: checking for EVP_MD_CTX_destroy()... -------------------- yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { EVP_MD_CTX_destroy(); return 0; }
/* end */

--------------------

have_func: checking for EVP_MD_CTX_init()... -------------------- yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { EVP_MD_CTX_init(); return 0; }
/* end */

--------------------

have_func: checking for HMAC_CTX_cleanup()... -------------------- yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { HMAC_CTX_cleanup(); return 0; }
/* end */

--------------------

have_func: checking for HMAC_CTX_copy()... -------------------- no

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
/tmp/ccOKuLR3.o: In function `t':
/home/swaits/rbundler/build/ruby-1.8.4/ext/openssl/conftest.c:4: undefine=
d reference to `HMAC_CTX_copy'
collect2: ld returned 1 exit status
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { HMAC_CTX_copy(); return 0; }
/* end */

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
conftest.c: In function =E2=80=98t=E2=80=99:
conftest.c:5: error: =E2=80=98HMAC_CTX_copy=E2=80=99 undeclared (first us=
e in this function)
conftest.c:5: error: (Each undeclared identifier is reported only once
conftest.c:5: error: for each function it appears in.)
checked program was:
/* begin */


/*top*/
int main() { return 0; }
int t() { void ((*volatile p)()); p =3D (void ((*)()))HMAC_CTX_copy; retu=
rn 0; }
/* end */

--------------------

have_func: checking for HMAC_CTX_init()... -------------------- yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { HMAC_CTX_init(); return 0; }
/* end */

--------------------

have_func: checking for PEM_def_callback()... -------------------- yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { PEM_def_callback(); return 0; }
/* end */

--------------------

have_func: checking for X509V3_set_nconf()... -------------------- yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { X509V3_set_nconf(); return 0; }
/* end */

--------------------

have_func: checking for X509V3_EXT_nconf_nid()... -------------------- ye=
s

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { X509V3_EXT_nconf_nid(); return 0; }
/* end */

--------------------

have_func: checking for X509_CRL_add0_revoked()... -------------------- y=
es

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { X509_CRL_add0_revoked(); return 0; }
/* end */

--------------------

have_func: checking for X509_CRL_set_issuer_name()... -------------------=
- yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { X509_CRL_set_issuer_name(); return 0; }
/* end */

--------------------

have_func: checking for X509_CRL_set_version()... -------------------- ye=
s

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { X509_CRL_set_version(); return 0; }
/* end */

--------------------

have_func: checking for X509_CRL_sort()... -------------------- yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { X509_CRL_sort(); return 0; }
/* end */

--------------------

have_func: checking for X509_STORE_get_ex_data()... -------------------- =
no

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
/tmp/ccQRarnd.o: In function `t':
/home/swaits/rbundler/build/ruby-1.8.4/ext/openssl/conftest.c:4: undefine=
d reference to `X509_STORE_get_ex_data'
collect2: ld returned 1 exit status
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { X509_STORE_get_ex_data(); return 0; }
/* end */

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
conftest.c: In function =E2=80=98t=E2=80=99:
conftest.c:5: error: =E2=80=98X509_STORE_get_ex_data=E2=80=99 undeclared =
(first use in this function)
conftest.c:5: error: (Each undeclared identifier is reported only once
conftest.c:5: error: for each function it appears in.)
checked program was:
/* begin */


/*top*/
int main() { return 0; }
int t() { void ((*volatile p)()); p =3D (void ((*)()))X509_STORE_get_ex_d=
ata; return 0; }
/* end */

--------------------

have_func: checking for X509_STORE_set_ex_data()... -------------------- =
no

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
/tmp/ccaxHnaZ.o: In function `t':
/home/swaits/rbundler/build/ruby-1.8.4/ext/openssl/conftest.c:4: undefine=
d reference to `X509_STORE_set_ex_data'
collect2: ld returned 1 exit status
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { X509_STORE_set_ex_data(); return 0; }
/* end */

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
conftest.c: In function =E2=80=98t=E2=80=99:
conftest.c:5: error: =E2=80=98X509_STORE_set_ex_data=E2=80=99 undeclared =
(first use in this function)
conftest.c:5: error: (Each undeclared identifier is reported only once
conftest.c:5: error: for each function it appears in.)
checked program was:
/* begin */


/*top*/
int main() { return 0; }
int t() { void ((*volatile p)()); p =3D (void ((*)()))X509_STORE_set_ex_d=
ata; return 0; }
/* end */

--------------------

have_func: checking for OPENSSL_cleanse()... -------------------- yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { OPENSSL_cleanse(); return 0; }
/* end */

--------------------

"gcc -c -I../.. -I../../. -I/home/swaits/rbundler/work/include -g -O2 c=
onftest.c"
checked program was:
/* begin */
#define FOO(a, ...) foo(a, ##__VA_ARGS__)
int x(){FOO(1);FOO(1,2);FOO(1,2,3);}
/* end */

have_header: checking for openssl/engine.h... -------------------- yes

"gcc -E -I../.. -I../../. -I/home/swaits/rbundler/work/include -g -O2 co=
nftest.c -o conftest.i"
checked program was:
/* begin */
#include <openssl/engine.h>
/* end */

--------------------

have_func: checking for ENGINE_add()... -------------------- yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { ENGINE_add(); return 0; }
/* end */

--------------------

have_func: checking for ENGINE_load_builtin_engines()... ----------------=
---- yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { ENGINE_load_builtin_engines(); return 0; }
/* end */

--------------------

have_func: checking for ENGINE_load_openbsd_dev_crypto()... -------------=
------- no

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
/tmp/ccEcSAx3.o: In function `t':
/home/swaits/rbundler/build/ruby-1.8.4/ext/openssl/conftest.c:4: undefine=
d reference to `ENGINE_load_openbsd_dev_crypto'
collect2: ld returned 1 exit status
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { ENGINE_load_openbsd_dev_crypto(); return 0; }
/* end */

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
conftest.c: In function =E2=80=98t=E2=80=99:
conftest.c:5: error: =E2=80=98ENGINE_load_openbsd_dev_crypto=E2=80=99 und=
eclared (first use in this function)
conftest.c:5: error: (Each undeclared identifier is reported only once
conftest.c:5: error: for each function it appears in.)
checked program was:
/* begin */


/*top*/
int main() { return 0; }
int t() { void ((*volatile p)()); p =3D (void ((*)()))ENGINE_load_openbsd=
_dev_crypto; return 0; }
/* end */

--------------------

have_func: checking for ENGINE_get_digest()... -------------------- yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { ENGINE_get_digest(); return 0; }
/* end */

--------------------

have_func: checking for ENGINE_get_cipher()... -------------------- yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { ENGINE_get_cipher(); return 0; }
/* end */

--------------------

have_func: checking for ENGINE_cleanup()... -------------------- yes

"gcc -o conftest -I../.. -I../../. -I/home/swaits/rbundler/work/include -=
g -O2 conftest.c -L"/home/swaits/rbundler/work/lib" -L"../.." -lssl =
-lcrypto -lruby-static -lssl -lcrypto -ldl -lcrypt -lm -lc"
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { ENGINE_cleanup(); return 0; }
/* end */

--------------------

"gcc -c -I../.. -I../../. -I/home/swaits/rbundler/work/include -g -O2 c=
onftest.c"
checked program was:
/* begin */
#include <openssl/opensslv.h>
#if OPENSSL_VERSION_NUMBER < 0x00907000L
# error "OpenSSL version is less than 0.9.7."
#endif
/* end */

have_header: checking for openssl/ocsp.h... -------------------- yes

"gcc -E -I../.. -I../../. -I/home/swaits/rbundler/work/include -g -O2 co=
nftest.c -o conftest.i"
checked program was:
/* begin */
#include <openssl/ocsp.h>
/* end */

--------------------

have_struct_member: checking for EVP_CIPHER_CTX.flags... ----------------=
---- yes

"gcc -c -I../.. -I../../. -I/home/swaits/rbundler/work/include -g -O2 c=
onftest.c"
checked program was:
/* begin */

#include <openssl/evp.h>

/*top*/
int main() { return 0; }
int s =3D (char *)&((EVP_CIPHER_CTX*)0)->flags - (char *)0;
/* end */

--------------------

have_struct_member: checking for EVP_CIPHER_CTX.engine... ---------------=
----- yes

"gcc -c -I../.. -I../../. -I/home/swaits/rbundler/work/include -g -O2 c=
onftest.c"
checked program was:
/* begin */

#include <openssl/evp.h>

/*top*/
int main() { return 0; }
int s =3D (char *)&((EVP_CIPHER_CTX*)0)->engine - (char *)0;
/* end */

--------------------

have_struct_member: checking for X509_ATTRIBUTE.single... ---------------=
----- yes

"gcc -c -I../.. -I../../. -I/home/swaits/rbundler/work/include -g -O2 c=
onftest.c"
checked program was:
/* begin */

#include <openssl/x509.h>

/*top*/
int main() { return 0; }
int s =3D (char *)&((X509_ATTRIBUTE*)0)->single - (char *)0;
/* end */
 
L

Logan Capaldo

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/index.html
 
S

Stephen Waits

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top