I have gcc6.1 installed on OS X via brew, when I tried to install sciruby-full on my Mac, always got this Error:
>Fetching: nmatrix-0.1.0.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing sciruby-full:
ERROR: Failed to build gem native extension.
/usr/local/opt/ruby/bin/ruby -r ./siteconf20150627-98945-1pk3go6.rb extconf.rb
checking for apparent GNU g++ binary with C++0x/C++11 support... Exception `RuntimeError' at extconf.rb:144 - You need a version of g++ which supports -std=c++0x or -std=c++11. If you're on a Mac and using Homebrew, we recommend using mac-brew-gcc.sh to install a more recent g++.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/Cellar/ruby/2.2.2/bin/$(RUBY_BASE_NAME)
extconf.rb:144:in `<main>': You need a version of g++ which supports -std=c++0x or -std=c++11. If you're on a Mac and using Homebrew, we recommend using mac-brew-gcc.sh to install a more recent g++. (RuntimeError)
extconf failed, exit code 1
Gem files will remain installed in /usr/local/lib/ruby/gems/2.2.0/gems/nmatrix-0.1.0 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0/nmatrix-0.1.0/gem_make.out
My ruby and OS X is always the newest: Ruby 2.2.2 on updated Yosemite.
From your error message:
extconf.rb:144:in `': You need a version of g++ which supports
-std=c++0x or -std=c++11. If you're on a Mac and using Homebrew, we recommend using mac-brew-gcc.sh to install a more recent g++.
(RuntimeError)
Do the following (using homebrew)
brew tap homebrew/versions
brew install gcc48
if this does not work, try gcc47 or gcc46.
Note: It make take a while to build. gcc is quite large.
Related
I've followed the steps to install v8 and the libv8 gem. After that, I am unable to successfully install therubyracer 0.12.3. The mkmf.log chokes when trying to validate the v8.h header and throws out an unknown type name-error.
My environment:
Ruby: 2.6.3
OSX: 10.15
xcode-select: 2373
libv8: 3.16.14.19
v8:v8#3.15 (via Homebrew)
brew info v8#3.15 = v8#3.15: stable 3.15.11.18 (bottled) [keg-only]
g++: Apple clang version 11.0.0 (clang-1100.0.33.17)
I've worked through the suggestions here. Anyone got a suggestions?
Gem install
gem install therubyracer -v '0.12.3' -- --with-v8-dir=/usr/local/opt/v8#3.15
Failure message
Building native extensions with: '--with-v8-dir=/usr/local/opt/v8#3.15'
This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
current directory: /Users/kristinsmith/.gem/ruby/2.6.0/gems/therubyracer-0.12.3/ext/v8
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I
/Library/Ruby/Site/2.6.0 -r ./siteconf20200120-16109-4pdf22.rb extconf.rb --with-v8-
dir\=/usr/local/opt/v8#3.15
checking for -lpthread... yes
checking for -lobjc... yes
checking for v8.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME)
--with-pthreadlib
--without-pthreadlib
--with-objclib
--without-objclib
--enable-debug
--disable-debug
--with-v8-dir
--with-v8-include
--without-v8-include=${v8-dir}/include
--with-v8-lib
--without-v8-lib=${v8-dir}/lib
/Users/kristinsmith/.gem/ruby/2.6.0/gems/libv8-3.16.14.19/ext/libv8/location.rb:50:in
`configure': By using --with-system-v8, you have chosen to use the version
(Libv8::Location::System::NotFoundError)
of V8 found on your system and *not* the one that is bundled with
the libv8 rubygem.
However, your system version of v8 could not be located.
Please make sure your system version of v8 that is compatible
with 3.16.14.19 installed. You may need to use the
--with-v8-dir option if it is installed in a non-standard location
from /Users/kristinsmith/.gem/ruby/2.6.0/gems/libv8-3.16.14.19/lib/libv8.rb:7:in
`configure_makefile'
from extconf.rb:32:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/kristinsmith/.gem/ruby/2.6.0/extensions/universal-darwin-19/2.6.0/therubyracer-
0.12.3/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/kristinsmith/.gem/ruby/2.6.0/gems/therubyracer-
0.12.3 for inspection.
Results logged to /Users/kristinsmith/.gem/ruby/2.6.0/extensions/universal-darwin .
19/2.6.0/therubyracer-0.12.3/gem_make.out
mkmf.log
...
find_header: checking for v8.h... -------------------- no
"xcrun clang I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.
5.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin19 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/backward -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0 -I. -I/usr/local/opt/v8#3.15/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -Wall -g -rdynamic -g -Os -pipe -DHAVE_GCC_ATOMIC_BUILTINS -arch x86_64 -c conftest.c"
clang: warning: argument unused during compilation: '-rdynamic' [-Wunused-command-line-argument]
In file included from conftest.c:3:
/usr/local/opt/v8#3.15/include/v8.h:98:1: error: unknown type name 'namespace' namespace v8
{
^
/usr/local/opt/v8#3.15/include/v8.h:98:13: error: expected ';' after top level declarator
namespace v8 {
^
;
2 errors generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <v8.h>
/* end */
--------------------
...
I had the same error, and finally it appeared that rbenv ruby version was ignored.
Running eval "$(rbenv init -)" solved the issue and therubyracer was installed correctly.
Many thanks for the help! The final solution turned out to be:
Installing rbenv
Setting a Ruby version (2.6.3) in rbenv
Adding the following lines to my .zshrc:
eval "$(rbenv init -)" (Thanks, Mykolas Kairys)
export LDFLAGS="-L~/.rbenv/versions/2.6.3/lib"
export CPPFLAGS="-I~/.rbenv/versions/2.6.3/include"
Building native extensions. This could take a while...
ERROR: Error installing libxml-ruby:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.3.0/gems/libxml-ruby-3.1.0/ext/libxml
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20180926-80978-eoqfjh.rb extconf.rb
checking for libxml/xmlversion.h in /opt/include/libxml2,/opt/local/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/$(RUBY_BASE_NAME)
--with-xml2-config
--without-xml2-config
--with-xml2-dir
--without-xml2-dir
--with-xml2-include
--without-xml2-include=${xml2-dir}/include
--with-xml2-lib
--without-xml2-lib=${xml2-dir}/lib
extconf failure: need libxml2.
Install the library or try one of the following options to extconf.rb:
--with-xml2-config=/path/to/xml2-config
--with-xml2-dir=/path/to/libxml2
--with-xml2-lib=/path/to/libxml2/lib
--with-xml2-include=/path/to/libxml2/include
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Library/Ruby/Gems/2.3.0/extensions/universal-darwin-18/2.3.0/libxml-ruby-3.1.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.3.0/gems/libxml-ruby-3.1.0 for inspection.
Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-18/2.3.0/libxml-ruby-3.1.0/gem_make.out
Updating nokogiri
Building native extensions. This could take a while...
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.
The error is due to macOS Mojave has stopped placing the standard header files in /usr/include, keeping them only inside the XCode directory.
You can verify this by running ls /usr/include and most likely this directory does not exist anymore. On contrary, the usual trick by running xcode-select --install will not solve the problem.
The fix is to run legacy installer provided by Apple that will install the header files to /usr/include
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
If you are using homebrew, the recommended approach is to tell pkg-config where it can find the libxml2 library:
brew reinstall libxml2
export PKG_CONFIG_PATH="/usr/local/opt/libxml2/lib/pkgconfig"
Also, you may have outdated bundle config, which is in the way. Run bundle config build.nokogiri --use-system-libraries and it'll give you a warning and show what config you currently have. I was following all guides and reinstalled all gems and even ruby a few times only to find out that config was set to use a path that doesn't exist anymore.
So I'm trying to install the audite gem, but having issues with rbenv:
$ bundle install
Fetching gem metadata from https://rubygems.org/...
Installing audite (0.3.0)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/opt/boxen/rbenv/versions/1.9.3-p448/bin/ruby extconf.rb
checking for mpg123.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/opt/boxen/rbenv/versions/1.9.3-p448/bin/ruby
please install mpg123 headers
Gem files will remain installed in /opt/boxen/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/audite-0.3.0 for inspection.
Results logged to /opt/boxen/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/audite-0.3.0/ext/mpg123/gem_make. out
An error occurred while installing audite (0.3.0), and Bundler cannot continue.
Make sure that `gem install audite -v '0.3.0'` succeeds before bundling.
I know that these gems require c extensions, and I have them installed with homebrew. And if I go into the cellar for homebrew I can see the file it's looking for (mpg123.h)
/opt/boxen/homebrew/Cellar/mpg123/1.15.4/include/mpg123.h
So, is there a way to add this into the rbenv environment without just sim-linking or copying it directly into /opt/boxen/rbenv/versions/1.9.3-p448/
xcode-select --install
resolved it for me.
I ran into the same issues trying to install audite. Turns out that mkmf writes a file call mkmf.log to tell you more specifically what it does to find out if the headers are availbale or not:
>>> cat mkmf.log
have_header: checking for mpg123.h... -------------------- no
"xcrun cc -E -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common conftest.c -o conftest.i"
xcode-select: Error: No Xcode is selected. Use xcode-select -switch <path-to-xcode>, or see the xcode-select manpage (man xcode-select) for further information.
checked program was:
/* begin */
1: #include <mpg123.h>
/* end */
--------------------
Turns out that I hadn't had xcode installed yet; after installing it and running
xcode-select --print-path
I saw that the path was now set. Then I still had to run xcrun once to agree to Apple's licence agreements, but then the installed installed just fine!
Add the homebrew include directory to your path, rubygems will find it. This isn't really a problem with rbenv.
In a default install, homebrew symlinks all the include folders of the packages to /usr/local/include, in your case, those should be in /opt/boxen/homebrew/include. Just have a look around, there should a be a folder somewhere containing all includes.
So in the end one of the following things fixed it for me, I'm not sure which because I'd rebuild and changed my machine few times since I had this issue:
Switched to Ruby 2.0.0
Upgraded to Mavericks (which does change some
stuff with xcode stuff I believe)
Updated my Boxen/Brew to latest
version
I'm trying to install the FXRuby gem. I've installed Ruby and Fox with Homebrew on Mac OS 10.7 and I can't figure out how to make it work. Has anyone?
Heres the error print out I have received:
gem install fxruby
Building native extensions. This could take a while...
ERROR: Error installing fxruby:
ERROR: Failed to build gem native extension.
/usr/local/Cellar/ruby/1.9.2-p290/bin/ruby extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/Cellar/ruby/1.9.2-p290/bin/ruby
--with-fox-dir
--without-fox-dir
--with-fox-include
--without-fox-include=${fox-dir}/include
--with-fox-lib
--without-fox-lib=${fox-dir}/lib
--with-fxscintilla-dir
--without-fxscintilla-dir
--with-fxscintilla-include
--without-fxscintilla-include=${fxscintilla-dir}/include
--with-fxscintilla-lib
--without-fxscintilla-lib=${fxscintilla-dir}/lib
extconf.rb:31:in `find_installed_fox_version': couldn't find FOX header files (RuntimeError)
from extconf.rb:125:in `<main>'
The error was occurring because the FOX toolkit was not installed on Your machine. FXRuby is a Ruby interface to the FOX graphical toolkit, so therefore requires FOX to be installed on the machine first. For Mac OS X execute
brew install fox
This will install dependencies:
libpng, freetype, jpeg, libtiff
Then install fxruby gem
gem install fxruby
I am using yosemite (OS X 10.10) and fxruby gem version 1.6.28 get installed successfully on my system
I had the same problem and this command fixed it:
sudo apt-get install libfox-1.6-dev
Having problems installing hpricot on Mac OS X. I suspect it might be an issue between rvm and brew?
rvm 1.0.5
brew 0.7
Thoughts? Suggestions? Thanks!
$ gem install hpricot
Building native extensions. This could take a while...
ERROR: Error installing hpricot:
ERROR: Failed to build gem native extension.
/Users/dhaskin/.rvm/rubies/ruby-1.8.7-p302/bin/ruby extconf.rb
checking for stdio.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/dhaskin/.rvm/rubies/ruby-1.8.7-p302/bin/ruby
Gem files will remain installed in /Users/dhaskin/.rvm/gems/ruby-1.8.7-p302/gems/hpricot-0.8.2 for inspection.
Results logged to /Users/dhaskin/.rvm/gems/ruby-1.8.7-p302/gems/hpricot-0.8.2/ext/fast_xs/gem_make.out
ERROR: Failed to build gem native extension. and checking for stdio.h... no are suspicious. Hpricot, along with many other Ruby gems, needs to compile some code and will fail if the development package is missing.
You are running RVM and 1.8.7 is in ~/.rvm on your machine, so it looks like it is because RVM would have to compile Ruby, but the failure sounds like it isn't. Do you have Apple's XCode installed in the /Developer directory? If you didn't install it and/or the directory isn't there, you can find the installer on your MacOS install discs, or at Apple's Developer site: http://developer.apple.com/technologies/xcode.html
That aside, I'd recommend using Nokogiri over Hpricot. I ran into several bugs in Hpricot a while back that made it unusable for my needs, and switched to Nokogiri. You'll find the two gems have similar syntax. http://nokogiri.org/
Turns out this was an XCode version dependency. Updating XCode to 3.2.4 resolved this.