Openssl engine driving me nuts!

_ Ever since the engine stuff was added to the openssl module
I've had a very difficult time building ruby in our local
environment. For various reasons, we have two versions of
openssl installed, I think I have finally got ruby to just
look at one, but I'm getting this puzzling error.

make[1]: Entering directory
`/home/local/local/src/ruby/ruby-1.8.2/ext/openssl'
gcc -fPIC -g -O2 -I. -I../.. -I../../. -I../.././ext/openssl
- -DHAVE_UNISTD_H -DHAVE_SYS_TIME_H -DHAVE_ASSERT_H
- -DHAVE_OPENSSL_SSL_H -DHAVE_OPENSSL_CONF_API_H -DHAVE_BN_MOD_ADD
- -DHAVE_BN_MOD_SQR -DHAVE_BN_MOD_SUB -DHAVE_BN_PSEUDO_RAND_RANGE
- -DHAVE_BN_RAND_RANGE -DHAVE_CONF_GET1_DEFAULT_CONFIG_FILE
- -DHAVE_EVP_CIPHER_CTX_SET_PADDING -DHAVE_EVP_CIPHERFINAL_EX
- -DHAVE_EVP_CIPHERINIT_EX -DHAVE_EVP_DIGESTFINAL_EX
- -DHAVE_EVP_DIGESTINIT_EX -DHAVE_EVP_MD_CTX_CLEANUP
- -DHAVE_EVP_MD_CTX_CREATE -DHAVE_EVP_MD_CTX_DESTROY
- -DHAVE_EVP_MD_CTX_INIT -DHAVE_HMAC_CTX_CLEANUP
- -DHAVE_HMAC_CTX_INIT -DHAVE_PEM_DEF_CALLBACK
- -DHAVE_X509V3_SET_NCONF -DHAVE_X509_CRL_ADD0_REVOKED
- -DHAVE_X509_CRL_SET_ISSUER_NAME -DHAVE_X509_CRL_SET_VERSION
- -DHAVE_X509_CRL_SORT -DHAVE_VA_ARGS_MACRO -DHAVE_OPENSSL_ENGINE_H
- -DHAVE_ENGINE_ADD -DHAVE_ENGINE_LOAD_BUILTIN_ENGINES
- -DHAVE_ENGINE_GET_DIGEST -DHAVE_ENGINE_GET_CIPHER
- -DHAVE_ENGINE_CLEANUP -c ossl.c
In file included from ossl.h:50,
                 from ossl.c:11:
/usr/include/openssl/engine.h:579: syntax error before '*' token
/usr/include/openssl/engine.h:580: syntax error before '*' token
/usr/include/openssl/engine.h:583: syntax error before '}' token
/usr/include/openssl/engine.h:616: syntax error before '*' token
make[1]: *** [ossl.o] Error 1
make[1]: Leaving directory
`/home/local/local/src/ruby/ruby-1.8.2/ext/openssl'
make: *** [all] Error 1

Compilation exited abnormally with code 2 at Tue Nov 30 10:21:12

_ From what I can deduce, the openssl[1] macro ERR_FNS is either
incorrectly defined or missing, but ossl.h correctly includes
openssl/err.h so I'm puzzled as to what's happening.

_ I can get the module to compile by commenting out the engine
check in extconf.rb, but it then fails "make test-all" by
complaining about missing openssl functions in the openssl
module. ( I guess it's not finding the shared library for
some reason. )

_ This is all on Red Hat Enterprise Release 3. Suggestions
as to where to start digging are welcome.

_ Booker C. Bense

[1]- <rant> arg... is that the stupidest macro name for a public
library include file you've seen or what.... </rant>

Are both versions of OpenSSL in the same prefix, (/usr by default in
Red Hat distros) or do you have the second, non-standard package
somewhere else? If so, I would recommend removing any LD_* or CFLAGS
environment variables which point to the custom install; the default
OpenSSL build provided with RHEL should be fine for building the Ruby
extension.

Alternately, you should (and I do mean *should* -- I've definitely been
bit by things in the Ruby build infrastructure that ignored sensible
overrides in the past) be able to pass a '--with-openssl-dir=[...]'
flag to the extconf.rb script in the ext/openssl directory of the
source distribution to set the default path it uses. For example, if
the OpenSSL build you need to use is in
'/usr/local/newlibs/{include,lib}', try running the following from the
top of the Ruby source tree:

cd ext/openssl
ruby extconf.rb --with-openssl-dir=/usr/local/newlibs
make
sudo make install

Hope that helps,

Lennon

In article <1101858511.328244.231320@f14g2000cwb.googlegroups.com>,

Are both versions of OpenSSL in the same prefix, (/usr by default in
Red Hat distros) or do you have the second, non-standard package
somewhere else? If so, I would recommend removing any LD_* or CFLAGS
environment variables which point to the custom install; the default
OpenSSL build provided with RHEL should be fine for building the Ruby
extension.

_ The "custom" version is in /usr/local, the RH one in /usr. I
have no LD or CFLAGs variable set. I think the problem is that
/usr/local/lib is in /etc/ld.so.conf. So far the only thing
that's worked is to unlink /usr/local ( it's a symlink to network
shared file space. )

Alternately, you should (and I do mean *should* -- I've definitely been
bit by things in the Ruby build infrastructure that ignored sensible
overrides in the past) be able to pass a '--with-openssl-dir=[...]'
flag to the extconf.rb script in the ext/openssl directory of the
source distribution to set the default path it uses. For example, if
the OpenSSL build you need to use is in
'/usr/local/newlibs/{include,lib}', try running the following from the
top of the Ruby source tree:

cd ext/openssl
ruby extconf.rb --with-openssl-dir=/usr/local/newlibs
make
sudo make install

Hope that helps,

_ I've tried that and every bit of autoconf foo I can think of
and the only thing that works is making /usr/local dissappear.

_ Booker C. Bense

···

rcoder <rcoder@gmail.com> wrote: