I'm about to tear my hair out with trying to get therubyracer
gem to install on Mavericks 10.9 - any help would be immensely appreciated.
I understand that there's a host of other questions about this subject, but literally none of the following (including various combinations and hopeful retrials which have consumed 2+ days at this point) have solved any issue
libv8
and install therubyracer
brew install libv8
instead apple-gcc
or similar Xcode
and Developer Tools
rvm
and re-building ruby 1.9.3
The latest I've been able to achieve is to get this error message:
> gem install therubyracer
Building native extensions. This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
/Users/aqua/.rvm/rubies/ruby-1.9.3-p545/bin/ruby -r ./siteconf20150127-54061-10i2fna.rb extconf.rb
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
creating Makefile
make clean
make
compiling accessor.cc
g++-4.6: error: unrecognized option '-rdynamic'
make: *** [accessor.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/aqua/.rvm/gems/ruby-1.9.3-p545/gems/therubyracer-0.12.1 for inspection.
Results logged to /Users/aqua/.rvm/gems/ruby-1.9.3-p545/extensions/x86_64-darwin-13/1.9.1/therubyracer-0.12.1/gem_make.out
There doesn't seem to be much information around g++-4.6: error: unrecognized option '-rdynamic'
. My first guess was maybe that gcc46
does not support this flag.
Based on other post suggestions I tried installing apple-gcc42
:
brew tap homebrew/dupes
brew install apple-gcc42
And executed it again with the proper enviornment context variables to point it to the new apple-gcc42
installation:
> $ CC=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2 CPP=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/cpp-4.2 CXX=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2 gem install therubyracer
Still no luck, and it was oddly still throwing the same error about gcc46
, which makes me thing that it's not picking up apple-gcc42
at all
I even tried symlinking the correct versions (backing up the originals of course)
cd /usr/bin
mv gcc gcc_backup
mv g++ g++_backup
mv cpp cpp_backup
sudo ln -s /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2 /usr/bin/gcc
sudo ln -s /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2 /usr/bin/g++
sudo ln -s /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/cpp-4.2 /usr/bin/cpp
Absolutely no luck, still throwing g++-4.6: error: unrecognized option '-rdynamic'
So.. How do you force the gem install
to use a specific compiler version? Is that even the right approach?
Thanks for the help!
I also faced the same problem. Followed the same steps you have described above. Below are the additional exports I did to install therubyracer.
export CC=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2
export CXX=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2
export CPP=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/cpp-4.2
I did not do brew install libv8
Next, uninstalled libv8 gem
gem uninstall libv8
Finally installed therubyracer
gem install therubyracer -v='0.12.2'
I am using ruby 2.2.2, hope this helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.