building ruby 1.8.6 with openssl 1 on Arch

If you got this error

ossl_ssl.c: In function 'ossl_sslctx_get_ciphers':
ossl_ssl.c:444:19: error: 'STACK' undeclared (first use in this function)
ossl_ssl.c:444:19: note: each undeclared identifier is reported only once for each function it appears in
ossl_ssl.c:444:25: error: expected expression before ')' token
ossl_ssl.c:447:47: error: expected expression before ')' token
ossl_ssl.c:447:47: error: too few arguments to function 'sk_value'
/usr/include/openssl/stack.h:80:7: note: declared here
ossl_ssl.c: In function 'ossl_ssl_get_peer_cert_chain':
ossl_ssl.c:794:5: warning: passing argument 1 of 'sk_num' from incompatible pointer type
/usr/include/openssl/stack.h:79:5: note: expected 'const struct _STACK *' but argument is of type 'struct stack_st_X509 *'
ossl_ssl.c:797:2: warning: passing argument 1 of 'sk_value' from incompatible pointer type
/usr/include/openssl/stack.h:80:7: note: expected 'const struct _STACK *' but argument is of type 'struct stack_st_X509 *'
ossl_ssl.c: In function 'ossl_ssl_get_cipher':
ossl_ssl.c:815:12: warning: assignment discards qualifiers from pointer target type
make[1]: *** [ossl_ssl.o] Error 1

then you probably were building ruby 1.8.6 with recently upgraded openssl-1.x.

In order to fix it you need to apply this patch. The patch extracted from ruby_1.8 upstream.

Beware that the patch breaks few ruby tests (as those tests need to be patched as well)

References

Comments