ruby-build: Unable to install REE on OS X 10.11

Hey, having an issue building (an old) version of Ruby.

Downloading ruby-enterprise-1.8.7-2011.12.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/9a8efc4befc136e17a1360de549aac9e79283c7238a13215350720e4393c5da2
Installing ruby-enterprise-1.8.7-2011.12...

BUILD FAILED (OS X 10.11 using ruby-build 20150928)

Inspect or clean up the working tree at /var/folders/wv/qw46bgcn37793q0wht63x3wr0000gn/T/ruby-build.20151023113042.56615
Results logged to /var/folders/wv/qw46bgcn37793q0wht63x3wr0000gn/T/ruby-build.20151023113042.56615.log

Last 10 log lines:
ar rcu libruby-static.a array.o bignum.o class.o compar.o dir.o dln.o enum.o enumerator.o error.o eval.o file.o gc.o hash.o inits.o io.o marshal.o math.o numeric.o object.o pack.o parse.o pointerset.o process.o prec.o random.o range.o re.o regex.o ruby.o signal.o sprintf.o st.o string.o struct.o time.o util.o variable.o version.o  dmyext.o
/usr/local/bin/gcc-4.2 -g -O2  -pipe -fno-common    -DRUBY_EXPORT  -I. -I. -I/Users/carl/.rbenv/versions/ree-1.8.7-2011.12/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -c main.c
/usr/local/bin/gcc-4.2 -g -O2  -pipe -fno-common    -DRUBY_EXPORT  -I. -I. -I/Users/carl/.rbenv/versions/ree-1.8.7-2011.12/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -c dmydln.c
/usr/local/bin/gcc-4.2 -g -O2  -pipe -fno-common    -DRUBY_EXPORT  -L. -L/Users/carl/.rbenv/versions/ree-1.8.7-2011.12/lib    main.o dmydln.o libruby-static.a -L/opt/local/lib -Wl,-rpath,/Users/carl/.rbenv/versions/ree-1.8.7-2011.12/lib -L/Users/carl/.rbenv/versions/ree-1.8.7-2011.12/lib -lsystem_allocator -ldl -lobjc   -o miniruby
ld: warning: directory not found for option '-L/opt/local/lib'
dyld: Library not loaded: @rpath/libsystem_allocator.dylib
  Referenced from: /private/var/folders/wv/qw46bgcn37793q0wht63x3wr0000gn/T/ruby-build.20151023113042.56615/ruby-enterprise-1.8.7-2011.12/source/./miniruby
  Reason: image not found
make: *** [.rbconfig.time] Trace/BPT trap: 5

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 1
  • Comments: 36 (9 by maintainers)

Most upvoted comments

@madrobby I have moved on as well…but for that certain, annoying old legacy rails 2 project which we can’t get rid of yet, I need ree-1.8.7.

In the meantime, I have found a solution for macOS Sierra to install ree-1.8.7-2012.02

  • boot with Command-R, disable system protection with csrutil disable, reboot
  • brew install openssl
  • don’t try to brew link openssl, it won’t do it anyway because openssl is keg-only
  • rather use ENV var RUBY_CONFIGURE_OPTS like this:

RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/opt/openssl rbenv install ree-1.8.7-2012.02

  • reenable System Integrity Protection - boot with Command-R, csrutil enable, reboot

done.

@jbwl This nearly worked for me. In order to get past the error * OpenSSL development headers... not found I needed to run the following:

CFLAGS=-I/usr/local/opt/openssl/include RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/opt/openssl rbenv install

@gblakeman @ngzax Thanks for your information on System Integrity Protection, using this I could compile REE 2012.02 with OpenSSL 1.0.2f, which finally makes TLSv1.2 work for HTTPS connections. I also had to set the compiler flags mentioned in the wiki in order to prevent segfaults with installing gems (and other network connections).

Here’s a complete rundown of what worked for me on OS X 10.11.2 to install REE 2012.02 w/ OpenSSL 1.0.2f.

Before you start, run brew upgrade and brew doctor to clean up any problems.

Boot into Recovery Mode (press and hold ⌘R when you hear the startup chime). In the “Utilities” menu select “Terminal”.

$ csrutil disable
$ reboot

(Wait for reboot to complete, just sign in to your Mac normally.)

Prerequisites: you’ll need the latest Xcode and command line tools installed, as well as homebrew. For completeness sake, I’ve included instructions on how to install and update rbenv and ruby-build with homebrew, this might differ if you installed them from git or otherwise.

$ brew install rbenv ruby-build
$ brew upgrade rbenv ruby-build

$ brew tap homebrew/dupes
$ brew uninstall --force apple-gcc42
$ brew install apple-gcc42

$ brew uninstall --force openssl
$ brew install openssl
$ brew link --force openssl

$ CFLAGS="-O2 -fno-tree-dce -fno-optimize-sibling-calls" RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/Cellar/openssl/1.0.2f rbenv install ree-1.8.7-2012.02

$ rbenv local ree-1.8.7-2012.02
$ rbenv rehash
$ ruby --version
ruby 1.8.7 (2012-02-08 MBARI 8/0x6770 on patchlevel 358) [i686-darwin15.3.0], MBARI 0x6770, Ruby Enterprise Edition 2012.02

# test to see if install gems work, without the CFLAGS above, I got a segfault
$ gem install bundler

Hope this helps someone! 😃

For anyone finding this from Google, it appears that at some point in a later build of Sierra, Apple removed gcc 4.2, or made some updates to llvm-gcc which would allow “successful” REE builds (if you use the OpenSSL CFLAGS etc.), but when you would attempt to do anything with that build (such as gem install bundler), you’d get errors like:

$ gem install bundler
~/.rbenv/versions/ree-1.8.7-2012.02/lib/ruby/1.8/timeout.rb:60: [BUG] Bus Error
ruby 1.8.7 (2012-02-08 MBARI 8/0x6770 on patchlevel 358) [i686-darwin16.6.0], MBARI 0x6770, Ruby Enterprise Edition 2012.02

Abort trap: 6

If you follow the instructions from above (disable SIP, install OpenSSL) but also install gcc@4.6 with brew AND use it to do the REE build, you should be peachy, complete with working gem install’s:

$ CC=/usr/local/Cellar/gcc@4.6/4.6.4_2/bin/gcc-4.6 CFLAGS=-I/usr/local/opt/openssl/include RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/opt/openssl rbenv install ree-1.8.7-2012.02
Downloading ruby-enterprise-1.8.7-2012.02.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/ecf4a6d4c96b547b3bf4b6be14e082ddaa781e83ad7f69437cd3169fb7576e42
Installing ruby-enterprise-1.8.7-2012.02...

WARNING: ruby-enterprise-1.8.7-2012.02 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.

Installed ruby-enterprise-1.8.7-2012.02 to ~/.rbenv/versions/ree-1.8.7-2012.02

blakes-mbp ree-1.8.7-2012.02 ~= gem install bundler
Fetching: bundler-1.15.1.gem (100%)
Successfully installed bundler-1.15.1
1 gem installed

As @jeremy suspected, the issue is El Capitan’s System Integrity Protection. I was able to get ree-1.8.7-2012.02 installed by disabling it, which requires booting into Recovery Mode, installing, then re-enabling it.

I also ran into an OpenSSL issue. My process:

  • Install openssl098 via brew (openssl created a conflict with the system openssl)
  • Force-link it: brew link openssl098 --force
  • Install ree (with System Integrity Protection disabled)
  • Unlink openssl098
  • Re-enable System Integrity Protection (I suppose you could leave it off if you wanted.

/cc @NatashaTheRobot

REE is EOL status. We will not investigate this issue.

I managed to get a fully functional ree-1.8.7-2012.02 (ruby + gem) for Mac OS 10.13.1 (High Sierra) with this: CC=/usr/local/Cellar/gcc@4.9/4.9.4/bin/gcc-4.9 CFLAGS="-O2 -fno-tree-dce -fno-optimize-sibling-calls -I/usr/local/opt/openssl/include -I/usr/local/opt/zlib/include" RUBY_CONFIGURE_OPTS="--with-openssl-dir=/usr/local/opt/openssl --with-zlib-dir=/usr/local/opt/zlib" rbenv install ree-1.8.7-2012.02

https://serverfault.com/questions/456640/segfault-in-timeout-rb-using-gem-with-ruby-enterprise-edition-ree-1-8-7

@jbwl : “Newer openssl versions don’t work with ruby-build.”

I recently needed to build a version of ree-1.8.7-2012.02 linked to openssl 1.0.+ because I needed TLS 1.2 support in ree. Using @gblakeman 's instructions above to disable system protection, I was able to brew install openssl 1.0.2, brew link it, disable protection, and then “rbenv install ree” which built it with openssl 1.0.2.

So your issue may not be openssl, it may be the OS X System Integrity Protection, which needs to be disabled.