Bundle install fails to install libxml-ruby - ruby

I'm a new to Ruby world and I need to clone an existing project.
The instructions are:
source .env.development
bundle install
But it fails with:
Using libv8 3.16.14.15
Fetching libxml-ruby 2.9.0
Installing libxml-ruby 2.9.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/vlad/.rvm/gems/ruby-2.3.1/gems/libxml-ruby-2.9.0/ext/libxml
/Users/vlad/.rvm/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20181109-46682-fvgifh.rb extconf.rb --use-system-libraries
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
--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/vlad/.rvm/rubies/ruby-2.3.1/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:
/Users/vlad/.rvm/gems/ruby-2.3.1/extensions/x86_64-darwin-18/2.3.0/libxml-ruby-2.9.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/vlad/.rvm/gems/ruby-2.3.1/gems/libxml-ruby-2.9.0 for inspection.
Results logged to /Users/vlad/.rvm/gems/ruby-2.3.1/extensions/x86_64-darwin-18/2.3.0/libxml-ruby-2.9.0/gem_make.out
An error occurred while installing libxml-ruby (2.9.0), and Bundler cannot continue.
Make sure that `gem install libxml-ruby -v '2.9.0'` succeeds before bundling.
In Gemfile:
upnxt_community_lib_common was resolved to 1.7.49, which depends on
upnxt_processing_lib_document was resolved to 2.0.0, which depends on
libxml-
If I want to execute the command that is suggested "gem install libxml-ruby -v '2.9.0'" I get the same error.
Operating System: MacOS Mojave, version 10.14.
Ruby version needed for the project: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin18]
I also tried this but it didn't helped.
Thanks in advance for any help!

These steps worked for me (source)
brew install libxml2
bundle config --global build.libxml-ruby --with-xml2-config="$(brew --prefix libxml2)/bin/xml2-config"
then bundle install worked as expected

I manage to fix this with the help of a colleague, if anybody else encounter this problem:
gem install libxml-ruby -v '2.9.0' -- --use-system-libraries --with-xml2-dir=/usr/local/Cellar/libxml2/2.9.8/include/libxml2/libxml/ --with-xml2-config=/usr/bin/xml2-config
Replace '2.9.0' with the libxml version that you need!

It solved for me in mac by running
gem install libxml-ruby -v '3.0.0' -- --with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config --with-xml2-dir=/usr/local/opt/libxml2 --with-xml2-lib=/usr/local/opt/libxml2/lib --with-xml2-include=/usr/local/opt/libxml2/include

Just happened today.
$ brew link --force libxml2
Warning: Refusing to link macOS-provided software: libxml2
...
At first, I wasn't aware that there's a warning and it doesn't work anymore.
Then found this workaround and it worked for me.
bundle config build.libxml-ruby --use-system-libraries=true --with-xml2-include=/usr/local/opt/libxml2/include/libxml2/

I've encountered many tips while googling around today. I've tried to compile them into a logical order of some things to try:
Installing/debugging libxml on mac for ruby/rails.
There's a lot on this page already. But just to point out a few extra things I've gathered from elsewhere.
To me it seems more sensible to try to get a working bundle config command than to bypass this with a gem install command. So use skplunkerin's answer, or...
The following will configure it to use the system libxml headers:
bundle config --global build.libxml-ruby --with-xml2-include=`xcrun --show-sdk-path`/usr/include/libxml2
bundle install
...which worked better for me today. The libxml-ruby gem build was having issues with the latest homebrew installed libxml vs an older system libxml.

Related

Not able to install Jekyll because of therubyracer error on mac

I am trying to run Jekyll and I have the following contents in the Gemfile
source "https://rubygems.org"
gem 'jekyll-auth'
gem 'redcarpet'
gem 'jekyll-lunr-js-search'
gem 'rouge'
gem 'jekyll-sitemap'
I am running bundle install for installing the dependencies specified. Everything works fine until it tries to install a gem called therubyracer. Then the process is stopped by throwing the following error:
Installing nokogiri 1.11.3 (x86_64-darwin)
Fetching libv8 3.16.14.19
Installing libv8 3.16.14.19 with native extensions
Fetching ref 2.0.0
Installing ref 2.0.0
Fetching therubyracer 0.12.3
Installing therubyracer 0.12.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.6.0/gems/therubyracer-0.12.3/ext/v8
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r
./siteconf20210430-34242-1i9kf2u.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
/Library/Ruby/Gems/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 /Library/Ruby/Gems/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:
/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-20/2.6.0/therubyracer-0.12.3/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/therubyracer-0.12.3 for inspection.
Results logged to
/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-20/2.6.0/therubyracer-0.12.3/gem_make.out
An error occurred while installing therubyracer (0.12.3), and Bundler cannot continue.
Make sure that `gem install therubyracer -v '0.12.3' --source 'https://rubygems.org/'` succeeds
before bundling.
In Gemfile:
jekyll-lunr-js-search was resolved to 3.3.0, which depends on
therubyracer
Now for fixing this error, I have tried the following commands as specified in some of the posts
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
But this is again giving the same error. I have tried
bundle config build.libv8 --with-system-v8
bundle config build.therubyracer --with-v8-dir=$(brew --prefix v8#3.15)
But there is no luck. I tried by specifying the brew based path for v8, in the command as follows:
sudo gem install therubyracer -- --with-v8-dir= /usr/local/Cellar/v8#3.15
Even after doing all these, I am stuck with the same error which says our system version of v8 could not be located.
I am trying this on a Mac machine with BigSur 11.2.3 is installed and the Ruby version is ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20] and gem is of version 3.0.3.
It will be of great help if someone can tell me how this error can be fixed and I can install and run Jekyll successfully.
I encountered same problem two years ago. I found that libv8 3.16.14.19 is not compatible with therubyracer 0.12.3 and wrote a post to record my solution.
Try the following steps:
Clean up your system
gem uninstall -a libv8
gem uninstall -a therubyracer
Install libv8 with specific version before installing therubyracer
gem install libv8 -v '3.16.14.15'
Install therubyracer
gem install therubyracer -v '0.12.3'
Update libv8 to the version specified in your gemfile
bundle
There may still have problem in macOS BigSur 11.2.
If it raises fatal error: 'climits' file not found in Step 2, try this:
gem install libv8 -v '3.16.14.15' -- --with-system-v8
If it raises errors in Step 3, try this:
brew install v8-315
gem install therubyracer -v '0.12.3' -- --with-v8-dir=/usr/local/opt/v8#3.15

An error occurred while installing "gem" and Bundler cannot continue. Mac OS - big sur

This error happened to me before with nio4r gem when I upgraded to Catalina and #dmitry barskov answered it. A similar issue is happening now after big sur upgrade with json, oj and therubyracer (tried using the solution from nio4r, but no luck). When I run gem list I see the gems installed but bundle install fails. So I tried bundle update json oj therubyracer. it works for json and oj but for therubyracer, it throws errors.
therubyracer error -->
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/me/.gem/gems/therubyracer-0.12.2/ext/v8
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r
./siteconf20210106-9670-edtaxk.rb extconf.rb --with-v8-dir\=/usr/local/opt/v8
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/me/.gem/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.
json error -->
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r
./siteconf20210106-29155-126itgi.rb extconf.rb
creating Makefile
current directory: /Users/me/.gem/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR=" clean
current directory: /Users/me/.gem/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
generator.c:861:25: error: use of undeclared identifier 'rb_cFixnum'
} else if (klass == rb_cFixnum) {
^
generator.c:863:25: error: use of undeclared identifier 'rb_cBignum'
} else if (klass == rb_cBignum) {
^
2 errors generated.
make: *** [generator.o] Error 1
make failed, exit code 2
*** LOCAL GEMS ***
bigdecimal (1.2.8)
bundler (1.17.3)
json (1.8.3)
libv8 (3.16.14.17)
oj (2.15.0)
rake (10.4.2)
ref (2.0.0)
therubyracer (0.12.3)
checking for v8.h... no I understand that this maybe an issue, so here's what I've tried to fix it, unsuccessfully ->
brew install v8-315
gem uninstall -a libv8
bundle config build.therubyracer --with-v8-dir=$(brew --prefix v8#3.15)
gem install libv8 -v '3.16.14.17' — —with-system-v8
gem uninstall -a therubyracer
bundle config build.libv8 --with-system-v8
gem install therubyracer -v '0.12.2' -- --with-v8-dir=$(brew --prefix v8#3.15)
When I do bundle update, it gets stuck in resolving dependencies.... I kept it running for 12 hours before I gave up.
When I delete my gemfile.lock, and run bundle install, it gets stuck in resolving dependencies... again.
I'm using ruby v 2.3.1
bundler version 1.17.3
One thing I noticed was the path /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby shows 2.6.0 but I'm using 2.3.1 (confirmed by running rbenv local and ruby -v)
If any other information is needed, please tell me. Any help will be much appreciated.
I ended up deleting the project folder and clone a new one. Removed all gems, reinstalled rbenv like #taylorthurlow pointed out.
Things worked, bundle install was green.

libxml-ruby: Failed to build gem native extension

I'm trying to install libxml-ruby.
I have installed libxml2, libxslt and coreutils
I have also read other posts regarding the issue but none solved it for me.
brew list libxslt
/opt/boxen/homebrew/Cellar/libxslt/1.1.28_1/bin/xslt-config
/opt/boxen/homebrew/Cellar/libxslt/1.1.28_1/bin/xsltproc
/opt/boxen/homebrew/Cellar/libxslt/1.1.28_1/include/libexslt/ (3 files)
/opt/boxen/homebrew/Cellar/libxslt/1.1.28_1/include/libxslt/ (21 files)
/opt/boxen/homebrew/Cellar/libxslt/1.1.28_1/lib/libexslt.0.dylib
/opt/boxen/homebrew/Cellar/libxslt/1.1.28_1/lib/libxslt.1.dylib
/opt/boxen/homebrew/Cellar/libxslt/1.1.28_1/lib/pkgconfig/ (2 files)
/opt/boxen/homebrew/Cellar/libxslt/1.1.28_1/lib/ (5 other files)
/opt/boxen/homebrew/Cellar/libxslt/1.1.28_1/share/aclocal/libxslt.m4
/opt/boxen/homebrew/Cellar/libxslt/1.1.28_1/share/doc/ (90 files)
/opt/boxen/homebrew/Cellar/libxslt/1.1.28_1/share/man/ (3 files)
brew list libxml2
/opt/boxen/homebrew/Cellar/libxml2/2.9.4/bin/xml2-config
/opt/boxen/homebrew/Cellar/libxml2/2.9.4/bin/xmlcatalog
/opt/boxen/homebrew/Cellar/libxml2/2.9.4/bin/xmllint
/opt/boxen/homebrew/Cellar/libxml2/2.9.4/include/libxml2/ (47 files)
/opt/boxen/homebrew/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib
/opt/boxen/homebrew/Cellar/libxml2/2.9.4/lib/cmake/libxml2/libxml2-config.cmake
/opt/boxen/homebrew/Cellar/libxml2/2.9.4/lib/pkgconfig/libxml-2.0.pc
/opt/boxen/homebrew/Cellar/libxml2/2.9.4/lib/ (3 other files)
/opt/boxen/homebrew/Cellar/libxml2/2.9.4/share/aclocal/libxml.m4
/opt/boxen/homebrew/Cellar/libxml2/2.9.4/share/doc/ (153 files)
/opt/boxen/homebrew/Cellar/libxml2/2.9.4/share/gtk-doc/ (55 files)
/opt/boxen/homebrew/Cellar/libxml2/2.9.4/share/man/ (4 files)
gem install libxml-ruby produces the following error:
Building native extensions. This could take a while...
ERROR: Error installing libxml-ruby:
ERROR: Failed to build gem native extension.
current directory: /opt/rubies/2.3.0/lib/ruby/gems/2.3.0/gems/libxml-ruby-2.9.0/ext/libxml
/opt/boxen/rbenv/versions/2.3.0/bin/ruby -r ./siteconf20160630-68248-1qaz7dk.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=/opt/boxen/rbenv/versions/2.3.0/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:
/opt/boxen/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-14/2.3.0-static/libxml-ruby-2.9.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /opt/boxen/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/libxml-ruby-2.9.0 for inspection.
Results logged to /opt/boxen/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-14/2.3.0-static/libxml-ruby-2.9.0/gem_make.out
I had a similar issue after I had used brew to install libxml2
Brew link solved the issue brew link --force libxml2
Life after upgrading to macOS Mojave.
xcode-select --install
brew install libxml2
brew link --force libxml2
gem install libxml-ruby -v '2.9.0' -- --use-system-libraries=true --with-xml2-include="$(xcrun --show-sdk-path)"/usr/include/libxml2
In my example I installed version 2.9.0 of the libxml-ruby gem. Change the version string to suit your needs. If available, examine the Gemfile.lock to identify which version of libxml-ruby Bundler is needs to install.
Homebrew:
libxml2 is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
So, we need to set libxml path directly
brew install libxml2
gem install libxml-ruby \
-- \
--with-xml2-config="$(brew --prefix libxml2)/bin/xml2-config"
P.S.
If you get the exception on lastest rubies:
Just ignore it. The gem was successfully installed. Just the Rdoc documentation generation failed.
The internal error was:
(NoMethodError) undefined method `[]' for nil:NilClass
ERROR: While executing gem ... (NoMethodError)
undefined method `[]' for nil:NilClass
macOS comes with libmxl2 installed, always, there is no need to use a utility like brew to install it first. Yet the headers are not found in /usr/include/libxml but in /usr/include/libxml2/libxml.
The configure script of the libxml-ruby gem tries to detect if libxml is installed by compiling code that looks like this:
#include <libxml/xmlversion.h>
But when compiling with the compiler shipped with Xcode, only this code would work:
#include <libxml2/libxml/xmlversion.h>
The trick is to let the configure script know where to find the headers. On a macOS system with Xcode installed, the following will work:
gem install libxml-ruby -v '3.1.0' -- --with-xml2-include=`xcrun --show-sdk-path`/usr/include/libxml2
The high level issue is shown here:
checking for libxml/xmlversion.h in /opt/include/libxml2,/opt/local/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... no
Basically, the installer is telling you it can't find libxml/xmlversion.h but more generally it most likely can't find your libxml2 location. It tells you which four directories it's looking in so the first step is to check those directories to see if libxml2 is there.
Assuming it's not in any of those four locations, you need to find it. Run find / -name xmlversion.h (might need sudo) to figure out where libxml2 got installed. Based on this answer I'm guessing your issue is that brew installed it to /usr/local/Cellar/libxml2 but you should confirm that. Once you have the location you can manually point your gem install command to it. Something like this: (but fill in path/to with your actual path)
gem install libxml-ruby --with-xml2-dir=/path/to/libxml2 --with-xml2-lib=/path/to/libxml2/lib --with-xml2-include=/path/to/libxml2/include
I also used brew to install libxml2 but needed the following options:
brew install libxml2 --with-xml2-config
gem install libxml-ruby -- --with-xml2-config=/usr/local/homebrew/opt/libxml2/bin/xml2-config
One solution is to:
cd /Library/Developer/CommandLineTools/Packages/ $
open macOS_SDK_headers_for_macOS_10.14.pkg
To force the reinstallation of the headers for macOS 10.14.

therubyracer installation on windows with libv8 installed --with-system-v8

I finally got libv8 installed on my windows with
gem install libv8 -- --with-system-v8
now when I am trying to install therubyracer I get
gem install therubyracer
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Building native extensions. This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb --with-system-v8
checking for main() in -lpthread... no
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=C:/Ruby193/bin/ruby
--with-pthreadlib
--without-pthreadlib
--enable-debug
--disable-debug
--with-v8-dir
--without-v8-dir
--with-v8-include
--without-v8-include=${v8-dir}/include
--with-v8-lib
--without-v8-lib=${v8-dir}/
C:/Ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.16.14.3/ext/libv8/location.rb:50:in `configure': You hav
e chosen to use the version of V8 found on your system (Libv8::Location::System::NotFoundError)
and *not* the one that is bundle with the libv8 rubygem. However,
it could not be located. please make sure you have a version of
v8 that is compatible with 3.16.14.3 installed. You may
need to special --with-v8-dir options if it is in a non-standard
location
thanks,
The Mgmt
What I want to know is what this error message really means?
Also I looked this up https://github.com/cowboyd/libv8#bring-your-own-v8
How do I install headers for v8?
When I faced this problem I found that I didn't need those gems in development, because rails use to precompile your assets, so my solution was pretty simple,
Gemfile
gem "rails"
group :production do
gem 'therubyracer'
end
Then when you bundle run this command
$ bundle install --without production
Then smile to the life :D
On Mac you can try updating the v8 library with homebrew:
gem uninstall libv8
brew install v8
gem install therubyracer
Update: Sorry, didn't realize this was a Windows only question.
#Aalap
I ran into the same problem while setting up my Ruby on Rails web application on Windows 7 64-bit. I came across this solution. This is a bit old but solved the problem. This solution provides 'therubyracer' gem file and v8.dll libs to install. The instructions are pretty much clear on the link above.
I installed 'libv8' gem just like Periback's answer on SO and when I tried to install 'therubyracer' gem, it failed with same error as yours. Now my web application is running fine and my "gem list" command shows:
libv8 (3.11.8.13)
therubyracer (0.11.0beta1 x86-mingw32)
Hope this helps.

Error installing debugger-linecache in Ruby 1.9.3

I need version 1.0.1 of debugger-linecache for a project, and I am facing the following error when trying to install.
trunk ☺ gem install debugger-linecache -v '1.0.1'
Building native extensions. This could take a while...
ERROR: Error installing debugger-linecache:
ERROR: Failed to build gem native extension.
/Users/jordanscales/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for vm_core.h... no
checking for vm_core.h... no
Makefile creation failed
**************************************************************************
No source for ruby-1.9.3-p194 provided with debugger-ruby_core_source gem.
**************************************************************************
*** 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=/Users/jordanscales/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
--with-ruby-dir
--without-ruby-dir
--with-ruby-include
--without-ruby-include=${ruby-dir}/include
--with-ruby-lib
--without-ruby-lib=${ruby-dir}/lib
Gem files will remain installed in /Users/jordanscales/.rvm/gems/ruby-1.9.3-p194/gems/debugger-linecache-1.0.1 for inspection.
Results logged to /Users/jordanscales/.rvm/gems/ruby-1.9.3-p194/gems/debugger-linecache-1.0.1/ext/trace_nums/gem_make.out
trunk ☺
Any help would be extremely appreciated, I have been searching but cannot find a working solution.
this may help you, it works for me
gem install debugger-linecache -v '1.1.2' -- --with-ruby-include=$rvm_path/src/ruby-1.9.3-p286/
This error means that the selected version of debugger does not support your current Ruby version. There are two solutions:
Update the debugger gem via bundle update debugger. New versions of debugger are backward-compatible with old Ruby versions, so this is the best way to fix it.
Downgrade your Ruby version.
Update/Install the gem debugger-ruby_core_source,
gem install debugger-ruby_core_source
it has been corrected here : https://github.com/cldwalker/debugger-ruby_core_source/pull/7
The problem was that I was using gemsets incorrectly. I knew not having permissions were an issue, as under RVM I shouldn't need sudo to install anything.
rvm gemset use global and then a bundle install did the trick.
From the below link:
https://github.com/cldwalker/debugger/issues/50
I have installed gem ruby-debug19 and problem solved for me as below:
$ bundle
... -> failed to build debugger-linecache
$ gem install ruby-debug19
$ bundle
... -> all is fine
In my case problem was not related to debugger-linecache directly. Either try upgrading debugger-ruby_core_source or downgrade Ruby by few patchlevels.
I've executed bundle update debugger-linecache. Although I had its newest version in Gemfile.lock, debugger-ruby_core_source has been upgraded to 1.1.5 and debugger-linecache has stopped complaining.
I installed debugger-ruby_core_source gem, based on perusing old answers here: https://github.com/cldwalker/debugger/issues/12
If you are using rvm, then make sure the path lead to ruby, in rvm its rubies folder
$rvm_path/rubies/ruby-1.9.3-p448
gem install debugger-linecache -v '1.1.2' -- --with-ruby-include=$rvm_path/rubies/ruby-1.9.3-p448
Your Gemfile.lock wasn't written with the same Ruby that you're trying to bundle against.
bundle update should work by making Bundler look at different versions.
manually build it. it works for me
https://gist.github.com/4060260

Resources