rubyjs / therubyracer

Embed the V8 Javascript Interpreter into Ruby
1.66k stars 191 forks source link

Can't compile with gcc-4.9 on OSX #318

Closed ciembor closed 9 years ago

ciembor commented 9 years ago
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/ciembor_lunar/.rvm/rubies/ruby-2.0.0-p353/bin/ruby extconf.rb
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling accessor.cc
g++-4.9: error: unrecognized command line option '-rdynamic'
make: *** [accessor.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/ciembor_lunar/.rvm/gems/ruby-2.0.0-p353/gems/therubyracer-0.12.1 for inspection.
Results logged to /Users/ciembor_lunar/.rvm/gems/ruby-2.0.0-p353/extensions/x86_64-darwin-13/2.0.0/therubyracer-0.12.1/gem_make.out
An error occurred while installing therubyracer (0.12.1), and Bundler cannot continue.
Make sure that `gem install therubyracer -v '0.12.1'` succeeds before bundling.

My gcc:

~/p/hypoguide > gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc49/4.9.0rc1/libexec/gcc/x86_64-apple-darwin13.3.0/4.9.0/lto-wrapper
Target: x86_64-apple-darwin13.3.0
Configured with: ../configure --build=x86_64-apple-darwin13.3.0 --prefix=/usr/local/Cellar/gcc49/4.9.0rc1 --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 20140411 (prerelease) (GCC)
~/p/hypoguide >
stpn commented 9 years ago

Same problem here

jspooner commented 9 years ago

Same here

d-mart commented 9 years ago

I'm looking for a fix as well.

pabse commented 9 years ago

Same problem here. Anybody found a solution yet?

cowboyd commented 9 years ago

Taking the following steps, this was how I compiled therubyracer on OSX 10.10

  1. Install the xcode 6.1 command line utilities https://developer.apple.com/downloads/index.action?name=for%20Xcode%20-# alternatively, you can run sudo xcode-select --install
  2. recompile ruby. You can do this with the ruby build tool of your choice. This may not be necessary for you, but it has been a problem for me in the past. If you try to use a ruby that was compiled on a different major version of OSX, you are likely to encounter issues.
  3. gem install therubyracer
~ ❯❯❯ sw_vers -productVersion
10.10
~ ❯❯❯ gcc --version                                                                                                                           ⏎
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix
~ ❯❯❯ ruby --version
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin14.0]
~ ❯❯❯ gem install therubyracer
Fetching: therubyracer-0.12.1.gem (100%)
Building native extensions.  This could take a while...
Successfully installed therubyracer-0.12.1
Parsing documentation for therubyracer-0.12.1
Installing ri documentation for therubyracer-0.12.1
Done installing documentation for therubyracer after 0 seconds
1 gem installed
carlosveucv commented 9 years ago

Same here ->

$ gem install therubyracer
Building native extensions.  This could take a while...
ERROR:  Error installing therubyracer:
    ERROR: Failed to build gem native extension.

    /Users/carlosveucv/.rbenv/versions/2.1.5/bin/ruby extconf.rb
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling accessor.cc
g++-5: error: unrecognized command line option '-rdynamic'
make: *** [accessor.o] Error 1

$ gcc --version
gcc (Homebrew gcc 5.2.0) 5.2.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.