I am having problems installing the Ruby libv8 gem on OS X Mavericks(10.9.4), I get the following error:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-2.0.0-p451/bin/ruby extconf.rb
creating Makefile
/usr/local/rvm/gems/ruby-2.0.0-p451/gems/libv8-3.11.8.13/ext/libv8/compiler.rb:30: warning: Insecure world writable dir /usr/local/rvm/gems/ruby-2.0.0-p451/bin in PATH, mode 040777
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
Using compiler: g++
../src/cached-powers.cc:136:18: error: unused variable 'kCachedPowersLength' [-Werror,-Wunused-const-variable]
static const int kCachedPowersLength = ARRAY_SIZE(kCachedPowers);
I tried to tell clang not to error out when there is an unused constant using the following, but to no avail the result was the same:
ARCHFLAGS=-Wno-error=unused-const-variable gem install libv8 -v '3.11.8.13'
What command line option am I missing?
Thanks
I had the same issue on my machine. Using the --with-system-v8 flag resolved the problem. Full documentation on this flag here.
Related
I am encountered a gem install error in CentOS6.7
But when I use gcc -version it show the version of gcc is 4.4.7.
Here is the error information:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb creating Makefile Compiling v8 for ia32
Using python 2.6.6 Using compiler: /usr/bin/c++ (GCC version
1.5.0) Unable to find a compiler officially supported by v8. It is recommended to use GCC v4.4 or higher
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/libv8-3.16.14.7/ext/libv8/builder.rb:28:in
make_flags': undefined method include?' for nil:NilClass
(NoMethodError)
from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/libv8-3.16.14.7/ext/libv8/builder.rb:56:in
block in build_libv8!'
from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/libv8-3.16.14.7/ext/libv8/builder.rb:49:in
chdir'
from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/libv8-3.16.14.7/ext/libv8/builder.rb:49:in
build_libv8!'
from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/libv8-3.16.14.7/ext/libv8/location.rb:24:in
install!'
from extconf.rb:7:in '
libv8 maintainer here.
Could you please try again after updating libv8 to the latest 3.16 version available?
If you continue receiving an error, please consider opening an issue with more info about your system and the gcc --version output of your compiler in libv8's issue tracker: https://github.com/cowboyd/libv8/issues
As a side note, you should consider asking the maintainers of a project directly first, through their issue tracker for example, before shooting a question in SO. Your question probably would have remained unanswered had I not been by chance looking for recent questions about libv8 here.
Trying to install thift gem after OSX El Capitan upgrade:
$ gem install thrift
Building native extensions. This could take a while...
ERROR: Error installing thrift:
ERROR: Failed to build gem native extension.
/Users/foo/.rvm/rubies/ruby-2.1.4/bin/ruby -r ./siteconf20160402-32256-7dzqel.rb extconf.rb
checking for strlcpy() in string.h... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling binary_protocol_accelerated.c
compiling bytes.c
compiling compact_protocol.c
compact_protocol.c:442:41: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
rb_exc_raise(get_protocol_exception(INT2FIX(-1), rb_str_new2(buf)));
^~~~~~~~~~~
Compilation fails with
compact_protocol.c:442:41: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
I have a solution for you! Hopefully.
Had this same problem the other day.
The problem is in the clang compiler that El Capitan comes bundled with. I'm sure it screws up other issues but this is one point that I had a lot of issues with.
Try running the following command and let me know how it goes!
gem install thrift -- --with-cppflags=\"-D_FORTIFY_SOURCE=0 -Wno-shift-negative-value\"
You need to escape double quotes.
$ bundle config build.thrift "--with-cppflags=\"-D_FORTIFY_SOURCE=0 -Wno-shift-negative-value\""
$ cat ~/.bundle/config
BUNDLE_BUILD__THRIFT: --with-cppflags="-D_FORTIFY_SOURCE=0 -Wno-shift-negative-value"
There is help for Big Sur https://github.com/instructure/canvas-lms/issues/827#issuecomment-946388555
gem install thrift -v 0.15.0 -- --with-cppflags="-Wno-compound-token-split-by-macro"
This worked for me on mac bigsur
gem install thrift -v '0.10.0.0' -- --with-cppflags="-D_FORTIFY_SOURCE=0 -Wno-shift-negative-value -Wno-compound-token-split-by-macro"
Try this
gem install thrift -v '0.9.0' -- --with-cppflags='-D_FORTIFY_SOURCE=0'
I am unable to install my gem bundle on my new Mac running Yosemite, because one gem only installs with the C compiler that shipped with the OS, while another requires the C compiler from Homebrew.
I am unable to work at all simply because of this error that the supposedly new gcc version 4.9.1 has:
cc1: error: -Werror=shorten-64-to-32: no option -Wshorten-64-to-32
I don't understand what this error means, nor how to tell the compiler to ignore it. Or even it that's possible
My specific situation is that running bundle install fails on the v8 gem:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/me/.rbenv/versions/2.1.0/bin/ruby extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.7.6
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
Using compiler: g++
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
../src/cached-powers.cc:136:18: error: unused variable 'kCachedPowersLength' [-Werror,-Wunused-const-variable]
static const int kCachedPowersLength = ARRAY_SIZE(kCachedPowers);
The g++ compiler that ships with the new version of XCode gives this as the version:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
So, 4.2 is pretty old. If I could just configure that one gem to build with the Homebrew gcc, which is 4.9.1, I would think it would work.
I tried setting my CC and CXX variables to the Homebrew gcc, but then the Nokogiri gem would not install with the first error message above. So many more gems installed with the Yosemite cc that maybe leaving that there is the best route. I don't know.
well using bundle config you can pass compiler flags. A little more info would be helpful in giving you a better answer.
see: http://bundler.io/man/bundle-config.1.html
I just found this: How to install therubyracer gem on 10.10 Yosemite?
this will give you libv8 and then v8 should compile and gem install. While looking into this issue I found tons of problems around Yosemite and clang/gcc, etc inluding this fix for nokogiri: Installing Nokogiri on OSX 10.10 Yosemite
Basically, from what I gather the yosemite gcc compiler is too outdated (the original error means the compiler doesn't recognize the given compile option i.e. the feature doesn't exists in gcc 4.2). The best solution I think would be to install a newer gcc via homebrew and setup paths etc so gem installs only use the homebrew version.
Hope those links help.
I try to install pushmeup plugin for phonegap push notifications (ios).
When I run command sudo gem install pushmeup I get this error:
Building native extensions. This could take a while... ERROR: Error
installing pushmeup: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
extconf.rb creating Makefile
make "DESTDIR=" clean
make "DESTDIR=" compiling generator.c linking shared-object
json/ext/generator.bundle clang: error: unknown argument:
'-multiply_definedsuppress'
[-Wunused-command-line-argument-hard-error-in-future] clang: note:
this will be a hard error (cannot be downgraded to a warning) in the
future make: * [generator.bundle] Error 1
make failed, exit code 2
Gem files will remain installed in
/Library/Ruby/Gems/2.0.0/gems/json-1.8.1 for inspection. Results
logged to
/Library/Ruby/Gems/2.0.0/extensions/universal-darwin-13/2.0.0/json-1.8.1/gem_make.out
GitHub:
https://github.com/phonegap-build/PushPlugin
Params:
ruby -v ruby 2.0.0p247 (2013-06-27 revision 41674)
[universal.x86_64-darwin13]
gem -v
2.2.2
Mac OS X v 10.9.2
XCode Version 5.1 (5B130a)
cordova -v
3.4.0-0.1.3
Apparently Apple broke something on Mavericks, they removed the warning flag unused-command-line-argument-hard-error-in-future acording to this issue: #528
Please try this command:
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future sudo gem install pushmeup
what it does? this sets the environment variable: ARCHFLAGS= this adds a ignore warnings -Wno-error= and this is the warning that you don't see in mavericks unused-command-line-argument-hard-error-in-future (which should be ignored)
In Apple documentation:
Compiler
As of Apple LLVM compiler version 5.1 (clang-502) and later, the
optimization level -O4 no longer implies link time optimization (LTO).
In order to build with LTO explicitly use the -flto option in addition
to the optimization level flag. (15633276) The Apple LLVM compiler in
Xcode 5.1 treats unrecognized command-line options as errors. This
issue has been seen when building both Python native extensions and
Ruby Gems, where some invalid compiler options are currently
specified. Projects using invalid compiler options will need to be
changed to remove those options. To help ease that transition, the
compiler will temporarily accept an option to downgrade the error to a
warning:
-Wno-error=unused-command-line-argument-hard-error-in-future
Note: This option will not be supported in the future. To workaround
this issue, set the ARCHFLAGS environment variable to downgrade the
error to a warning. For example, you can install a Python native
extension with:
$ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future
easy_install ExtensionName
Similarly, you can install a Ruby Gem with:
$ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future
gem install GemName 16214764 updated
EDIT HISTORY
just tested on my machine, using same ruby:
$ gem install pushmeup
Fetching: pushmeup-0.1.2.gem (100%)
Successfully installed pushmeup-0.1.2
Parsing documentation for pushmeup-0.1.2
Installing ri documentation for pushmeup-0.1.2
Done installing documentation for pushmeup after 1 seconds
1 gem installed
From what i saw you are not using rvm or rbenv so the problem is not in gcc dependencies
Accordingly to the output provided, the error was when installing json-1.8.1.
Can you post the log located at: /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-13/2.0.0/json-1.8.1/gem_make.out ?
I've been struggling to install jekyll on my mac, don't know much about ruby or configuring/debugging these messages.
I'm getting the following when running "sudo gem install jekyll"
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
creating Makefile
make "DESTDIR="
make: *** No rule to make target `/include/universal-darwin13/ruby/config.h', needed by `porter.o'. Stop.
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/fast-stemmer-1.0.2 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/fast-stemmer-1.0.2/ext/gem_make.out
"gcc --version" returns the following:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
use this command :
$ sudo xcode-select -r
then
$ sudo gem install jekyll
Hope this help you.
Besides upgrading xcode, as rayrashmi suggested, you have to actually open it so the command-line tools are properly installed.
(I am assuming you installed the command-line tools from xcode before upgrading to mavericks, if you haven't they're under Preferences → Downloads → Components, official info here.)
Then, just upgrade gem if you haven't already done so and install jekyll and any other library you were using, like pigments.
As they say, "worked for me."