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
Hit this too. /cc @NatashaTheRobot
My solution is to work off the 1.9-redux branch...
I bet the REE installer is compiling its libsystem_allocator and trying to install in /opt/local/lib, but System Integrity Protection / rootless is preventing creation of that dir. So subsequent linking fails because the lib can't be found.
@jbwl That's the exact same error I was getting. Switching to the 1.9-redux branch fixed the issue. Not sure whether that's compatible.
My solution is to work off the 1.9-redux branch...
@NatashaTheRobot What do you mean by this? I'm not sure how to get past this issue.
I checked out the 1.9-redux branch and everything is working.
Hmm… it seems like that branch is no longer available?
Just looked, and this happened to me in the launchpad project. Here is the branch: https://github.com/basecamp/launchpad/tree/1.9-redux
@NatashaTheRobot Ah, gotcha. Thanks, but I still need ree-1.8.7-2012.02 for something else.
@gblakeman yeah, couldn't find a way to install ree-1.8.7-2012.02. Let me know if you figure it out! Good luck.
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:
openssl098 via brew (openssl created a conflict with the system openssl)brew link openssl098 --forceree (with System Integrity Protection disabled)openssl098/cc @NatashaTheRobot
@gblakeman thanks a lot, man! it helped me so much.
@terranisu 🙌
@gblakeman : Thank you, your instructions worked perfectly for me.
There is a new issue. Two days ago, Homebrew has removed openssl098 because of deprecation. See here:
Newer openssl versions don't work with ruby-build and rvm-2012.02
Is there another way to get openssl098 libs on El Capitan?
@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.
maybe you can try and do a:
brew install https://raw.githubusercontent.com/Homebrew/homebrew-versions/586b7e9012a3ed1f9df6c43d0483c65549349289/openssl098.rb
to install an old version of openssl098.
I always remove openssl098 with a brew uninstall openssl098 after ree builds and before I run any bundle install commands in projects that use ree anyway. It seems like its just to build ree and then i use a newer version to compile gems. In fact openssl098 makes excon segfault for some reason.
Disclaimer, I have not tried this yet.
@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! :)
@madrobby is my hero. Worked like a charm, and saved me ~too-many hours.
Nice instructions, @madrobby!
One thing that I'd like to point out is that one shouldn't brew link --force openssl (that's considered destructive), and that RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/Cellar/openssl/1.0.2f isn't necessary since ruby-build auto-links to Homebrew openssl if it detects it.
@mislav it wouldn't compile for me without the forced link, I'll see if I can repro that and figure out what's going on :)
@madrobby Oh I see. Unlike MRI formulas in ruby-build, REE needs explicit RUBY_CONFIGURE_OPTS=--with-openssl-dir=..., but still doesn't need force-linking. Why would you force-link openssl to your /usr/local prefix when you provide an explicit openssl location to the build process?
after it failed to install the first time, I went to the temporary folder, then into ruby-enterprise-1.8.7-2012.02/source and edited the make.sh file removing -L/opt/local/lib from the PRELIBS= section. then I ran make && make install and got it installed.
I had to install rubygems manually.
OSX 10.11.3
ruby-build 20160130
@madrobby Yes this helps! Thanks a lot :)
@madrobby I can confirm this is the only way that works for me. Thank you!
@mislav I just tested on a fresh & clean install of rbenv (via homebrew) on 10.11.3, and the brew link --force openssl is required. Otherwise, REE reports * OpenSSL development headers... not found and aborts building.
Thank you! This worked like a charm with OpenSSL 1.0.2g on OS X 10.11.1.
@madrobby There is new trouble: Homebrew doesn't allow linking openssl anymore, even by force.
@jbwl :( fwiw, we have since moved on to a much newer Ruby, so I don't have the requirement to install REE anymore.
@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
csrutil disable, rebootbrew install opensslbrew link openssl, it won't do it anyway because openssl is keg-onlyRUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/opt/openssl rbenv install ree-1.8.7-2012.02
csrutil enable, rebootdone.
@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
REE is EOL status. We will not investigate this issue.
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 [email protected] with brew AND use it to do the REE build, you should be peachy, complete with working gem install's:
$ CC=/usr/local/Cellar/[email protected]/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
Just reporting my findings for Mac OS 10.13.1 (High Sierra). I am not able to install ree-1.8.7-2012.02 using any of the methods in this thread because:
/Users/me/.rbenv/versions/ree-1.8.7-2012.02/lib/ruby/1.8/timeout.rb:60: [BUG] Segmentation fault
ruby 1.8.7 (2012-02-08 MBARI 8/0x6770 on patchlevel 358) [i686-darwin17.2.0], MBARI 0x6770, Ruby Enterprise Edition 2012.02I 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/[email protected]/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
Hey @dimvic
I'm getting the following error:
`/usr/local/opt/[email protected]/include/openssl/evp.h:501:52: note: in definition of macro 'EVP_MD_CTX_init'
define EVP_MD_CTX_init(ctx) EVP_MD_CTX_reset((ctx))
^
openssl_missing.c:98:25: error: dereferencing pointer to incomplete type
EVP_MD_CTX_init(&ctx->md_ctx);
^
/usr/local/opt/[email protected]/include/openssl/evp.h:501:52: note: in definition of macro 'EVP_MD_CTX_init'
define EVP_MD_CTX_init(ctx) EVP_MD_CTX_reset((ctx))
^
openssl_missing.c: In function 'HMAC_CTX_cleanup':
openssl_missing.c:106:28: error: dereferencing pointer to incomplete type
EVP_MD_CTX_cleanup(&ctx->i_ctx);
^
openssl_missing.c:107:28: error: dereferencing pointer to incomplete type
EVP_MD_CTX_cleanup(&ctx->o_ctx);
^
openssl_missing.c:108:28: error: dereferencing pointer to incomplete type
EVP_MD_CTX_cleanup(&ctx->md_ctx);
^
In file included from /usr/include/string.h:186:0,
from openssl_missing.c:19:
openssl_missing.c:109:27: error: invalid application of 'sizeof' to incomplete type 'HMAC_CTX'
memset(ctx, 0, sizeof(HMAC_CTX));
^
make[1]: * [openssl_missing.o] Error 1`
Did anyone get the past this issue?
Most helpful comment
@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
csrutil disable,rebootbrew install opensslbrew link openssl, it won't do it anyway because openssl is keg-onlyRUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/opt/openssl rbenv install ree-1.8.7-2012.02csrutil enable,rebootdone.