Closed jvenezia closed 8 years ago
Noticing the same with ruby 2.3.0
same here with ruby 2.1.5
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
/Users/vibolteav/.rvm/rubies/ruby-2.1.5/bin/ruby -r ./siteconf20151228-94622-1iz1rss.rb 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++: error: unrecognized command line option ‘-rdynamic’
make: *** [accessor.o] Error 1
make failed, exit code 2
Same thing but with slightly different versions: OSX - 10.11.1 Ruby - 2.0.0-p648
$ gem uninstall therubyracer
$ gem uninstall libv8
$ gem install libv8 -v '3.16.14.3' -- --with-system-v8
$ gem install therubyracer -v '0.12.0'
Then last command give me:
Building native extensions. This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
/Users/javid/.rvm/rubies/ruby-2.0.0-p648/bin/ruby -r ./siteconf20151229-25686-qzrrwt.rb extconf.rb
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
checking for v8.h... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling accessor.cc
clang: warning: argument unused during compilation: '-rdynamic'
In file included from accessor.cc:1:
In file included from ./rr.h:4:
/usr/local/include/v8.h:353:33: error: use of undeclared identifier 'nullptr'
V8_INLINE MaybeLocal() : val_(nullptr) {}
^
...
And, when I try with the versions others posted above, I get the same thing. For example:
$ gem install libv8 -v '3.16.14.13' -- --with-system-v8
$ gem install therubyracer -v '0.12.2'
Got it! This worked for me:
$ brew upgrade gcc
$ gem uninstall therubyracer
$ gem uninstall libv8
$ gem install therubyracer -v '0.12.0'
Fetching: therubyracer-0.12.0.gem (100%)
Building native extensions. This could take a while...
Successfully installed therubyracer-0.12.0
1 gem installed
$ gem install libv8 -v '3.16.14.3' -- --with-system-v8
Fetching: libv8-3.16.14.3.gem (100%)
Building native extensions with: '--with-system-v8'
This could take a while...
Successfully installed libv8-3.16.14.3
1 gem installed
I posted an answer on this related StackOverflow question as well: http://stackoverflow.com/a/34523788/254046
Credit for the solution goes to @arthurnn: https://github.com/cowboyd/therubyracer/issues/288#issuecomment-63923606
Also failing on Ruby 2.1.2 on OSX 10.9.4 with rbenv 1.0.0
/Users/lancejordan/.rbenv/versions/2.1.2/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++: error: unrecognized command line option ‘-rdynamic’
make: *** [accessor.o] Error 1
make failed, exit code 2
Solved the same problem
brew tap homebrew/versions
brew install v8-315
brew link --force v8-315
bundle install
brew unlink v8-315
If you also cannot install libv8,
gem install libv8 --with-system-v8
or
bundle config build.libv8 --with-system-v8
@javidjamae are you using rbenv or rvm? I've been stuck on this for over two days, can't get it working.
@lacostenycoder I'm using rvm. My issue was specifically around not having the latest gcc version though. I would concentrate my energy around making sure the compiler is up to date, available on the expected path, etc.
none of the symlinking or environment variable settings in this post worked for me. http://stackoverflow.com/questions/19630154/gem-install-therubyracer-v-0-10-2-on-osx-mavericks-not-installing/20145328#20145328
@javidjamae thanks. I managed to solve my issue by editing my $PATH. Something was throwing off my compiler settings. My problem was this.
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin14.0.0/4.9.2/lto-wrapper
Target: x86_64-apple-darwin14.0.0
Configured with: ../gcc-4.9-20141029/configure --enable-languages=c++,fortran
Thread model: posix
gcc version 4.9.2 20141029 (prerelease) (GCC)
after fix i got to this:
gcc -v
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-darwin13.3.0
Thread model: posix
Removing this from bottom of .bash_profile seems to have fixed it.
PATH="/usr/local/bin:$PATH"
@lacostenycoder :+1: glad you figured it out. It's almost always the path and/or the compiler version when native libraries don't compile.
I installed the lastest gcc and still got the issue.
$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin15.2.0
Thread model: posix
Any idea ?
@jvenezia are you getting the exact same error as your original post? Are you using homebrew? If so can you post a gist pasting the output of the following? Use pbcopy to pipe output to you clipboard
echo $PATH | pbcopy
brew list | pbcopy
brew config | pbcopy
Are you using rbenv or rvm?
I don't know if this would impact anything, but another thing I did was to tell RVM to use brew for package management by doing:
rvm autolibs homebrew
Hi @lacostenycoder , I'm using rvm. Yes I am getting the exact same error.
$ echo $PATH
/Users/jeremyvenezia/.rvm/gems/ruby-2.3.0/bin:/Users/jeremyvenezia/.rvm/gems/ruby-2.3.0@global/bin:/Users/jeremyvenezia/.rvm/rubies/ruby-2.3.0/bin:/Users/jeremyvenezia/.rvm/bin:/Users/jeremyvenezia/anaconda/bin:/usr/local/git/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/local/heroku/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Users/jeremyvenezia/bin:/usr/local/share/npm/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin
$ brew list
apple-gcc42 curl-ca-bundle git isl libiconv libtool memcached nmap ossp-uuid qt v8
autoconf elasticsearch gmp jpeg libksba libxml2 mozilla-addon-sdk node phantomjs readline xz
automake freetype htop-osx libevent libmpc libxslt mpfr openssl pkg-config redis youtube-dl
bash-completion gcc imagemagick libgpg-error libpng libyaml mysql openssl-osx-ca postgresql tree
$ brew config
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew.git
HEAD: d875c556f92df2bc88d987be16b685a40154d0e6
Last commit: 3 weeks ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: 8-core 64-bit ivybridge
OS X: 10.11.2-x86_64
Xcode: 6.3.1
CLT: 7.2.0.0.1.1447826929
Clang: 6.1 build 602
MacPorts/Fink: /opt/local/bin/port
X11: 2.7.7 => /opt/X11
System Ruby: 2.0.0-p645
Perl: /usr/bin/perl
Python: /Users/jeremyvenezia/anaconda/bin/python => /Users/jeremyvenezia/anaconda/bin/python3.4
Ruby: /Users/jeremyvenezia/.rvm/rubies/ruby-2.3.0/bin/ruby
Java: 1.8.0, 1.7.0_51
@jvenezia First of all looks like you have both macports and homebrew. recommend to only use one not both. I would suggest removing mac ports. Also it looks like your PATH has a lot of duplicate entries that might be messing things up. A quick split sort shows this:
"/Library/Frameworks/Python.framework/Versions/3.4/bin",
"/Library/Frameworks/Python.framework/Versions/3.5/bin",
"/Users/jeremyvenezia/.rvm/bin",
"/Users/jeremyvenezia/.rvm/gems/ruby-2.3.0/bin",
"/Users/jeremyvenezia/.rvm/gems/ruby-2.3.0@global/bin",
"/Users/jeremyvenezia/.rvm/rubies/ruby-2.3.0/bin",
"/Users/jeremyvenezia/anaconda/bin",
"/Users/jeremyvenezia/bin",
"/bin",
"/bin",
"/opt/X11/bin",
"/opt/X11/bin",
"/opt/local/bin",
"/opt/local/sbin",
"/sbin",
"/sbin",
"/usr/bin",
"/usr/bin",
"/usr/bin",
"/usr/local/bin",
"/usr/local/bin",
"/usr/local/bin",
"/usr/local/bin",
"/usr/local/git/bin",
"/usr/local/git/bin",
"/usr/local/heroku/bin",
"/usr/local/sbin",
"/usr/local/share/npm/bin",
"/usr/sbin",
"/usr/sbin"
It also looks like you have multiple versions of python, might be causing problems. Try removing all ""/usr/local/bin" from path and see if it works. But you should probably clean everything up and delete anything you're not using. You may also find the answers here helpful: http://superuser.com/questions/7150/mac-os-x-conventional-places-where-binary-files-should-live
@tertom's solution worked for me as well. Same system/gem versions, but ruby 2.1.2
.
It is pulling in the wrong directory for me when compiling (using ia32.release instead of what is installed x64.release):
linking shared-object v8/init.so
g++: error: /usr/local/rvm/gems/ruby-2.2.4/gems/libv8-3.16.14.3-x86_64-linux/vendor/v8/out/ia32.release/obj.target/tools/gyp/libv8_base.a: No such file or directory
g++: error: /usr/local/rvm/gems/ruby-2.2.4/gems/libv8-3.16.14.3-x86_64-linux/vendor/v8/out/ia32.release/obj.target/tools/gyp/libv8_snapshot.a: No such file or directory
the directory should be:
/usr/local/rvm/gems/ruby-2.2.4/gems/libv8-3.16.14.3-x86_64-linux/vendor/v8/out/x64.release/obj.target/tools/gyp
props to @tertom that worked for me
I was encountering this issue as well. I didn't quite want to force the old version of v8
over the newer version as per @tertom suggestion.
Instead I did the following:
brew tap homebrew/versions
brew install v8-315
gem install libv8 -v '3.16.14.13' -- --with-system-v8
gem install therubyracer -- --with-v8-dir=/usr/local/opt/v8-315
bundle install
At least now the bundle installs. I haven't entirely tested therubyracer though.
@adamcooper's solution worked for me :tada:
OSX 10.11.3 rbenv ruby 2.2.2 libv8 3.16.14.7 therubyracer 0.12.2
EDIT: The issue below was fixed by completely nuking the rbenv
rubies and reinstalling libv8
and therubycracer
gem. Now this solutions works again.
Strangely, both @tertom's solution and @adamcooper's solution don't work for me anymore....
$ bundle exec rake
dyld: lazy symbol binding failed: Symbol not found: _rb_str_new_static
Referenced from: /Users/jottr/dev/mge/mge-rails/vendor/bundle/gems/json-1.8.2/lib/json/ext/parser.bundle
Expected in: flat namespace
dyld: Symbol not found: _rb_str_new_static
Referenced from: /Users/jottr/dev/mge/mge-rails/vendor/bundle/gems/json-1.8.2/lib/json/ext/parser.bundle
Expected in: flat namespace
After running gem pristine --all
, the problem remains:
Restoring gems to pristine condition...
Skipped bigdecimal-1.2.4, it is a default gem
Restored bundler-1.11.2
Skipped io-console-0.4.2, it is a default gem
Skipped json-1.8.1, it is a default gem
Building native extensions with: '--with-system-v8'
This could take a while...
Restored libv8-3.16.14.13
Skipped minitest-4.7.5, it is a default gem
Skipped psych-2.0.5, it is a default gem
Skipped rake-10.1.0, it is a default gem
Skipped rdoc-4.1.0, it is a default gem
Restored ref-2.0.0
Skipped test-unit-2.1.2.0, it is a default gem
Building native extensions with: '--with-v8-dir=/usr/local/opt/v8-315'
This could take a while...
Restored therubyracer-0.12.2
$ rbenv local
ruby-2.1.2
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.11.3
BuildVersion: 15D21
@tertom +1
Thanks.
@lacostenycoder I cleaned PATH, removed macports, tryed to remove /usr/local/bin from PATH... Nothing worked :(
@tertom 's solution worked!
I guess I can close this now. Thanks all!
@adamcooper Thanks! Your solution worked for me :tada:
@adamcooper Thanks for your solution!
@jottr
Strangely, both @tertom's solution and @adamcooper's solution don't work for me anymore....
I'm having this same problem. There's a solution that's claimed to work, but it doesn't work for me:
gem uninstall libv8
gem uninstall therubyracer
bundle config --local build.libv8 --with-cxx=/usr/local/bin/g++-4.2
bundle install
All workarounds and black African voodoo magic solutions should be irrelevant since there are binary versions of libv8 for practically all versions of OS X in production AND the source version SHOULD now be compilable on all supported OS X versions with the default xcode compiler.
@equivalentideas if you are having an issue, please try removing all the hacks in your bundle config and updating your bundle.
If you are still having problems, please open a new issue with more info about your environment and logs from the build failure.
Works great with ruby 2.2.3, but not ruby 2.2.4.
EDIT : Exact same problem with ruby 2.3.0.