Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error installing REE 1.8.7-2009.10 — ossl.c:119:1: error: unknown type name ‘STACK’ #445

Closed
skinnyfit opened this issue Nov 4, 2013 · 7 comments

Comments

@skinnyfit
Copy link

Hi!

I'm trying to use this bad-ass tool to install REE 1.8.7-2009.10 (don't ask!) on our Ubuntu 13.04 Jenkins CI server. I appreciate that this Ruby version is mega-old, but I'm seriously stuck with trying to get it to compile and wondered if anyone had any clues?

I've cleared a couple of hurdles so far, but stumbled on the third. Here's where I've managed to get up to:

jenkins@jenkins:~$ export CONFIGURE_OPTS="--no-tcmalloc -c --with-readline=/usr/share/readline"
jenkins@jenkins:~$ rbenv install ree-1.8.7-2009.10
Downloading ruby-enterprise-1.8.7-2009.10.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/3727eef7b6b1b2f31db7d091328d966e
Installing ruby-enterprise-1.8.7-2009.10...

BUILD FAILED

Inspect or clean up the working tree at /tmp/ruby-build.20131104122418.19336
Results logged to /tmp/ruby-build.20131104122418.19336.log

Last 10 log lines:
ossl_x509crl.c: In function ‘ossl_x509crl_get_revoked’:
ossl_x509crl.c:265:11: warning: pointer type mismatch in conditional expression [enabled by default]
ossl_x509crl.c:273:24: warning: pointer type mismatch in conditional expression [enabled by default]
/usr/bin/gcc -I. -I../.. -I../../. -I../.././ext/openssl -DRUBY_EXTCONF_H=\"extconf.h\" -I/var/lib/jenkins/.rbenv/versions/ree-1.8.7-2009.10/include   -I/var/lib/jenkins/.rbenv/versions/ree-1.8.7-2009.10/include  -fPIC -g -Os -fno-strict-aliasing    -c ossl.c
ossl.c:118:1: error: unknown type name ‘STACK’
ossl.c:119:1: error: unknown type name ‘STACK’
make[1]: *** [ossl.o] Error 1
make[1]: Leaving directory `/tmp/ruby-build.20131104122418.19336/ruby-enterprise-1.8.7-2009.10/source/ext/openssl'
make: *** [all] Error 1

I have libssl-dev installed, and /usr/include/openssl/stack.h is present, but I just can't figure out how to get it recognised (if that's even the right answer!)

I can compile other rubies OK (e.g., 2.0.0-p247 is running like a dream). I found some solutions for RVM, but nothing for rbenv / ruby-build. Any ideas how I might get past this problem?

Thanks in advance,
Richard

@mislav
Copy link
Member

mislav commented Nov 4, 2013

From what I quickly looked up for you, it seems that this is a problem of the OpenSSL version (1.0.1) shipping with systems nowadays being too new for that ancient version of Ruby. You need to patch Ruby.

The way you do what with ruby-build right now is to save the following as a file e.g. my-ree-patched:

before_install_package() {
  case "$1" in
  ruby-* )
    curl -fsSL https://github.com/wayneeseguin/rvm/raw/187ab4c/patches/ree/1.8.6/openssl-1.0.patch | patch -p0
    ;;
  esac
}

require_gcc
install_package "ruby-enterprise-1.8.7-2009.10" "http://files.rubyforge.vm.bytemark.co.uk/emm-ruby/ruby-enterprise-1.8.7-2009.10.tar.gz#3727eef7b6b1b2f31db7d091328d966e" ree_installer
install_package "rubygems-1.6.2" "http://production.cf.rubygems.org/rubygems/rubygems-1.6.2.tgz#0c95a9869914ba1a45bf71d3b8048420" ruby

And then:

$ rbenv install /path/to/my-ree-patched

# or, if you're using ruby-build directly:
$ ruby-build /path/to/my-ree-patched /path/to/install

Can you try that and let me know if it works?

@skinnyfit
Copy link
Author

Wowzer! Thanks so much for the detailed help. I followed those steps, they seemed to be successful and now I have a different error 😉

# ...snip...
Hunk #1 succeeded at 262 (offset -2 lines).
Hunk #2 succeeded at 270 (offset -2 lines).
Installing ruby-enterprise-1.8.7-2009.10...

BUILD FAILED

Inspect or clean up the working tree at /tmp/ruby-build.20131104135531.31271
Results logged to /tmp/ruby-build.20131104135531.31271.log

Last 10 log lines:
ossl_ssl.c:111:5: warning: initialization from incompatible pointer type [enabled by default]
ossl_ssl.c:111:5: warning: (near initialization for ‘ossl_ssl_method_tab[10].func’) [enabled by default]
ossl_ssl.c:112:5: warning: initialization from incompatible pointer type [enabled by default]
ossl_ssl.c:112:5: warning: (near initialization for ‘ossl_ssl_method_tab[11].func’) [enabled by default]
ossl_ssl.c: In function ‘ossl_ssl_get_cipher’:
ossl_ssl.c:1224:12: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
make[1]: *** [ossl_ssl.o] Error 1
make[1]: Leaving directory `/tmp/ruby-build.20131104135531.31271/ruby-enterprise-1.8.7-2009.10/source/ext/openssl'
make: *** [all] Error 1

@mislav
Copy link
Member

mislav commented Nov 4, 2013

Seems like you need to apply one more patch. I'm tapping in the dark here, try if this helps you. Add another patch line:

curl -fsSL https://github.com/wayneeseguin/rvm/raw/187ab4cc/patches/ree/1.8.7/no_sslv2.diff | patch -p0

This is related to #75 and http://bugs.ruby-lang.org/issues/4556

@skinnyfit
Copy link
Author

Dude, thank you so much. You're a wizard! Ruby compiles now. I do get this error:

*** longjmp causes uninitialized stack frame ***: /var/lib/jenkins/.rbenv/versions/my-ree-patched/bin/ruby terminated
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x5c)[0x7f11460091bc]
/lib/x86_64-linux-gnu/libc.so.6(+0x1120cd)[0x7f11460090cd]
/lib/x86_64-linux-gnu/libc.so.6(__longjmp_chk+0x33)[0x7f1146009033]
/var/lib/jenkins/.rbenv/versions/c5-ree/bin/ruby[0x40f8fc]
======= Memory map: ========
00400000-004b5000 r-xp 00000000 fd:00 930631                             /var/lib/jenkins/.rbenv/versions/my-ree-patched/bin/ruby
006b4000-006b5000 r--p 000b4000 fd:00 930631                             /var/lib/jenkins/.rbenv/versions/my-ree-patched/bin/ruby
006b5000-006b7000 rw-p 000b5000 fd:00 930631                             /var/lib/jenkins/.rbenv/versions/my-ree-patched/bin/ruby
006b7000-006d5000 rw-p 00000000 00:00 0
01319000-01620000 rw-p 00000000 00:00 0                                  [heap]
7f11439ee000-7f1143a02000 r-xp 00000000 fd:00 655390                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7f1143a02000-7f1143c02000 ---p 00014000 fd:00 655390                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7f1143c02000-7f1143c03000 r--p 00014000 fd:00 655390                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7f1143c03000-7f1143c04000 rw-p 00015000 fd:00 655390                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7f1143c04000-7f1143c1a000 r-xp 00000000 fd:00 666770                     /lib/x86_64-linux-gnu/libresolv-2.17.so
# ...snip...

...but the installation finished OK, I can run ruby -v and get the correct version, and it only blows up when I try to use a socket. There's lots of stuff hinting to recompiling cURL, so I think this must be way outside the remit of ruby-build. Thank you so much for your time & being ridiculously helpful! I owe you a 🍺!

@mislav
Copy link
Member

mislav commented Nov 4, 2013

Dude, thank you so much. You're a wizard!

I'm just good at googling :)

and it only blows up when I try to use a socket

That's no good :( Ideally you wouldn't have such issues. Also, to my knowledge Ruby doesn't ship with bindings to libcurl, but that might be a REE thing that I'm not aware of.

@ganar
Copy link

ganar commented Oct 2, 2015

@mislav your contribution is a godsend!

I want it to add that this also works with RVM in a simpler way and without errors. In my case it was

rvm install ruby-1.8.7-p249 --patch https://github.com/wayneeseguin/rvm/raw/187ab4c/patches/ree/1.8.6/openssl-1.0.patch --patch https://github.com/wayneeseguin/rvm/raw/187ab4cc/patches/ree/1.8.7/no_sslv2.diff

your second patch gave me the following result during installation

Patch no_sslv2 was already applied.

@specialforest
Copy link

I combined both patches into a single one to be used with rbenv - https://gist.github.com/specialforest/d74b772eda5058a0f680f52d6e75bc4e/raw/004b9a457a92640d62b67a4828c6a7dd3c616d50/ruby-1.8.7.patch

cat ruby-1.8.7.patch | rbenv -p install 1.8.7

Successfully built Ruby 1.8.7 on Ubuntu 16.04.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants