ree-1.8.7-* fails to built on Yosemite
I haven't seen an issue opened for this yet but ree-1.8.7 is failing to build on Yosemite. Specifying CC=/usr/local/bin/gcc-4.2 yields the same result. Failure message below and log output: https://gist.github.com/paulbeattie/3b6931c997ee40393c06
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
couldn't understand kern.osversion `14.0.0'
Downloading ruby-enterprise-1.8.7-2012.02.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/ecf4a6d4c96b547b3bf4b6be14e082ddaa781e83ad7f69437cd3169fb7576e42
Installing ruby-enterprise-1.8.7-2012.02...
BUILD FAILED (OS X 10.10 using ruby-build 20141016)
Inspect or clean up the working tree at /var/folders/75/_yb744wd5jd1y2gf4cb4dmg80000gn/T/ruby-build.20141018115238.52997
Results logged to /var/folders/75/_yb744wd5jd1y2gf4cb4dmg80000gn/T/ruby-build.20141018115238.52997.log
Last 10 log lines:
couldn't understand kern.osversion `14.0.0'
/usr/local/bin/gcc-4.2 -g -O2 -pipe -fno-common -DRUBY_EXPORT -I. -I. -I/Users/paulbeattie/.rbenv/versions/ree-1.8.7-2012.02/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -c dmydln.c
couldn't understand kern.osversion `14.0.0'
/usr/local/bin/gcc-4.2 -g -O2 -pipe -fno-common -DRUBY_EXPORT -L. -L/Users/paulbeattie/.rbenv/versions/ree-1.8.7-2012.02/lib main.o dmydln.o libruby-static.a -L/opt/local/lib -Wl,-rpath,/Users/paulbeattie/.rbenv/versions/ree-1.8.7-2012.02/lib -L/Users/paulbeattie/.rbenv/versions/ree-1.8.7-2012.02/lib -lsystem_allocator -ldl -lobjc -o miniruby
couldn't understand kern.osversion `14.0.0'
ld: warning: directory not found for option '-L/opt/local/lib'
ld: -rpath can only be used when targeting Mac OS X 10.5 or later
collect2: ld returned 1 exit status
make: *** [miniruby] Error 1
Thanks for reporting. Unfortunately, Ruby versions prior to 1.9.3 (those that rely on gcc-4.2) seem to be broken on Yosemite and we don't know a workaround yet. See #648
I installed the REE successfully by adding MACOSX_DEPLOYMENT_TARGET=10.9. Like MACOSX_DEPLOYMENT_TARGET=10.9 CC=/usr/local/bin/gcc-4.2 rvm install ree
@wangadong thanks for that tip! It'd be good to have a warning in ruby-build for this but at least it's building now, just something to remember.
Thanks @wangadong for the workaround. Does REE built like that actually work for you? What might be potential downsides of setting MACOSX_DEPLOYMENT_TARGET like this?
Hi @mislav, it seems that currently there's no downsides for my usage. Everything acts as normal. From my perspective, this MACOSX_DEPLOYMENT_TARGET should be designed for compatibility when compiling in new mac, and I'm not sure what exactly happened in the compiler. I also heard someone has installed ree with rbenv without using this MACOSX_DEPLOYMENT_TARGET thing. But this workaround works for me with rvm.
@mislav I've not noticed any issues adding when compiling older Rubies, everything works as expected.
I can confirm that the following worked for me for 2 legacy applications that run under REE 1.8.7.
$ brew install apple-gcc42
$ MACOSX_DEPLOYMENT_TARGET=10.9 CC=/usr/local/bin/gcc-4.2 rbenv install ree-1.8.7-2011.03
If anyone gets here from the Googles like I did (searching for "couldn't understand kern.osversion `14.0.0'"), I thought I'd mention that @soupmatt's fix also worked for reinstalling 2.0.0-p353. Thanks @soupmatt.
Came here about the "couldn't understand kern.osversion" issue also - and was able to install legacy REE version like so:
$ MACOSX_DEPLOYMENT_TARGET=10.9 CC=/usr/local/bin/gcc-4.2 rbenv install ree-1.8.7-2012.02
Thank you @soupmatt
Confirmed here as well. Thanks @wangadong
Also works for 2.0.0-p247
MACOSX_DEPLOYMENT_TARGET=10.9 CC=/usr/local/bin/gcc-4.2 rbenv install 2.0.0-p247
(for those finding this via ${SEARCH_ENGINE} I was getting
num2int.c: In function ‘print_num2ll’:
num2int.c:82: error: expected ‘)’ before ‘PRI_LL_PREFIX’
num2int.c:82: warning: spurious trailing ‘%’ in format
num2int.c:82: warning: spurious trailing ‘%’ in format
num2int.c: In function ‘print_num2ull’:
num2int.c:94: error: expected ‘)’ before ‘PRI_LL_PREFIX’
num2int.c:94: warning: spurious trailing ‘%’ in format
num2int.c:94: warning: spurious trailing ‘%’ in format
ld: warning: directory not found for option '-L/Users/fstelluto/.rbenv/versions/2.0.0-p247/lib'
make[2]: *** [num2int.o] Error 1
make[1]: *** [ext/-test-/num2int/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [build-ext] Error 2
Finally, I use these steps to install ruby 1.8.7 on yosemite: brew install openssl rvm pkg install readline sudo rvm cleanup all sudo rvm reinstall all --force --with-openssl-dir=/usr/local/Cellar/openssl/1.0.1j
I found this through google searching for installation of a more modern Ruby (2.1.5) on OS X 10.10.1 and this worked for me... Using rbenv
MACOSX_DEPLOYMENT_TARGET=10.9 CC=/usr/bin/gcc rbenv install 2.1.5
i already had gcc 4.8 installed. adding the 'gcc-4.8' didn't work, this worked for me:
MACOSX_DEPLOYMENT_TARGET=10.9 CC=/usr/bin/gcc rvm install ruby-1.8.7
Setting the deployment target to 10.9 worked for me too.
MACOSX_DEPLOYMENT_TARGET=10.9 CC=/usr/bin/gcc rbenv install <ruby_version>
@juanpaulo Which version of ruby-build do you have? This shouldn't be needed since v20141028 10fd04909d3bf77bb26bf6610dbdd10940e80e09
@bliaxiong You seem to be using RVM not rbenv. You're commenting on the wrong project.
@mislav I was using ruby-build 20140702-158-g95373b4. Saw from the commit that the deployment target is already being set, thanks for the info!