I'm out of my depth here as I don't know jack about C and such compilers, except that as per tut's I've read - I've homebrew installed gcc-4.9, linked it, and in my .bash_profile have cc=gcc-4.9 - hoping this would allow me to install Ruby 2.1.1, as previous attempts have failed, complaining about the following:
note: unrestricted unions only available with -std=c++11 or -std=gnu++11
I've visited the gcc site and seen that 4.9 includes c++11 support, so I'm confused as to why it's failing to make Ruby as per above error, and full error output below:
make
CC = /usr/local/bin/g++-4.9
LD = ld
LDSHARED = /usr/local/bin/g++-4.9 -dynamic -bundle
CFLAGS = -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -pipe
XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT -fPIE
CPPFLAGS = -I/usr/local/Cellar/openssl/1.0.1g/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I. -I.ext/include/x86_64-darwin13.0 -I./include -I.
DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -L/usr/local/Cellar/openssl/1.0.1g/lib -fstack-protector -Wl,-u,_objc_msgSend -pie -framework CoreFoundation
SOLIBS = -lgmp
Using built-in specs.
COLLECT_GCC=/usr/local/bin/g++-4.9
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc49/4.9.0/libexec/gcc/x86_64-apple-darwin13.1.0/4.9.0/lto-wrapper
Target: x86_64-apple-darwin13.1.0
Configured with: ../configure --build=x86_64-apple-darwin13.1.0 --prefix=/usr/local/Cellar/gcc49/4.9.0 --enable-languages=c,c++,objc,obj-c++ --program-suffix=-4.9 --with-gmp=/usr/local/opt/gmp4 --with-mpfr=/usr/local/opt/mpfr2 --with-mpc=/usr/local/opt/libmpc08 --with-cloog=/usr/local/opt/cloog018 --with-isl=/usr/local/opt/isl011 --with-system-zlib --enable-version-specific-runtime-libs --enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release --enable-lto --disable-werror --enable-plugin --disable-nls --enable-multilib
Thread model: posix
gcc version 4.9.0 (GCC)
compiling miniprelude.c
In file included from vm_core.h:24:0,
from miniprelude.c:8:
method.h:84:19: error: member 'rb_method_attr_t rb_method_definition_struct::<anonymous union>::attr' with copy assignment operator not allowed in union
rb_method_attr_t attr;
^
method.h:84:19: note: unrestricted unions only available with -std=c++11 or -std=gnu++11
In file included from miniprelude.c:8:0:
vm_core.h:674:59: error: use of enum 'iseq_type' without previous declaration
VALUE rb_iseq_new(NODE*, VALUE, VALUE, VALUE, VALUE, enum iseq_type);
^
vm_core.h:677:76: error: use of enum 'iseq_type' without previous declaration
VALUE rb_iseq_new_with_bopt(NODE*, VALUE, VALUE, VALUE, VALUE, VALUE, enum iseq_type, VALUE);
^
vm_core.h:678:75: error: use of enum 'iseq_type' without previous declaration
VALUE rb_iseq_new_with_opt(NODE*, VALUE, VALUE, VALUE, VALUE, VALUE, enum iseq_type, const rb_compile_option_t*);
^
make: *** [miniprelude.o] Error 1
As I wrote, I'm really out of my depth here, so would appreciate any help resolving this so I can install Ruby 2.1.1.
My ./configure command used is:
./configure --prefix="$HOME/.rbenv/versions/2.1.1" --with-opt-dir=/usr/local/Cellar/openssl/1.0.1g
I installed Rbenv via homebrew, so it's bin isn't in ~./rbenv but in my PATH and sym linked by homebrew from:
/usr/local/bin/rbenv -> ../Cellar/rbenv/0.4.0/bin/rbenv
I can't see any complaints about that, which makes me think I'm possibly using the wrong C-compiler, but I don't see others with the same errors, and they are happy with homebrew's gcc-4.9 or apple-gcc42, but to be honest - I have no idea how to determine which to use.
Any help appreciated as I've wasted far too long on this instead of actually developing a web app.
Thanks