libv8 (3.11.8.17) bundle install error on Mac - ruby-on-rails

I upgraded ruby to 1.9.3, and now I can't get my server to start. When I run bundle install, it says
An error occurred while installing libv8 (3.11.8.17), and Bundler cannot continue.
Make sure that `gem install libv8 -v '3.11.8.17'` succeeds before bundling.
When I try to install that gem, it says
ERROR: Error installing libv8:
ERROR: Failed to build gem native extension.
/Users/Erica/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.7.1
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
Using compiler: g++
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
I'm an HTML/CSS coder, not really a Ruby developer, so any thoughts are really appreciated.

I resolved this issue by using the following command:
gem install libv8 -v 3.11.8.17 -- --with-system-v8
It works with RVM on Mavericks.
https://stackoverflow.com/a/19667419/763744

Try reinstalling v8 in homebrew:
gem uninstall libv8
brew install v8
gem install libv8

Do:
gem install rmagick -v '2.13.2'
gem install libv8 -v 3.11.8.17 -- --with-system-v8

I encountered this problem a few times already, first thing I'd try is to (re)install command line tools. Normally should work.
Another attempt that succeeded once was uninstalling libv8, and then installing it again. It takes ages...

This simple solution worked for me:
$ gem uninstall libv8 # select "All Versions" if prompted
$ gem install libv8

I had this same problem when I upgraded from OSX Mountain Lion to OSX Mavericks.
Upgrading from ruby-1.8.7-p354 to ruby-1.8.7-375 did the trick for me.
libv8 (3.16.14.3-x86_64-darwin-13) and the therubyracer (0.12.0) gems installed without problem.
assuming you use rbenv:
rbenv versions
system
* 1.8.7-p354
2.0.0-rc2
rbenv uninstall 1.8.7-p354
rbenv install 1.8.7-p375
rbenv versions
system
* 1.8.7-p375
2.0.0-rc2
bundle install

Related

error occurred while installing pg (0.17.1)

When I run a bundle on a rails project I seem to be getting the following:
Installing pg 0.17.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r
./siteconf20151024-43303-t81fnp.rb extconf.rb checking for
pg_config... yes Using config values from /usr/local/bin/pg_config An
error occurred while installing pg (0.17.1), and Bundler cannot
continue. Make sure that gem install pg -v '0.17.1' succeeds before
bundling.
I have visited the following SO questions:
An error occurred while installing pg (0.17.1), and Bundler cannot continue
Installing pg -v 0.17.1
Installing PG gem on OS X - failure to build native extension.
Additionally to this I've tried executing the following:
gem install pg
env ARCHFLAGS="-arch x86_64" gem install pg
gem install pg -- --with-pg-config=/usr/local/Cellar/postgresql/9.4.5/bin/pg_config
And I keep getting:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
FYI I have rbenv installed too. Also tried a rbenv rehash also and executed the above commands and have had no luck. I've also tried uninstalling and reinstalling Postgres and get the same. To also be on the safe side i've also ran:
brew update
brew uinstall posgresql > brew install postgresql
updated Xcode
Info:
Mac OSx Yosemite 10.10.5
Postgres v9.4.5
rbenv v0.4.0
rbenv global => 2.0.0-p247
I don't know Mac, but I've had this problem on Windows.
--
The issue is here:
Failed to build gem native extension
When you install a gem, many of the advanced ones actually compile / "build" through the extconf.rb file. I've forgotten the significance of this, but it basically allows the gem to run natively on the OS environment you're using.
In short, the error occurs because your OS does not have access to the "developer headers" the gem requires to compile.
The most common instance of this problem is with the mysql2 gem on Windows, but happens for others too.
--
What you need is to download PGSQL on your system before attempting to install the gem.
After installing PGSQL, you may need to reference the developer headers with some "switches", but it does not appear to be the case in this instance:
Installing PG gem on OS X - failure to build native extension
Install Xcode command line tools (Apple Developer site)
brew uninstall postgresql
brew install postgresql
ARCHFLAGS="-arch x86_64" gem install pg
Maybe this won't work? I don't know... I know that in Windows, you have to install the binaries before expecting the gem to work.
Greetings I hope I can help. May I ask how you created your rails project? Did you simply use:
rails new *appname*
If so maybe try creating a new rails app like so:
rails new *appname* -d postgresql
And before you create your database and run migrations/seed, you should go into "config/database.yml" and change the username and password to the postgreSQL user that you've hopefully setup after installing postgreSQL on your machine.
Good Luck!

An error occurred while installing libv8 (3.16.14.3), and Bundler cannot continue [duplicate]

I'm trying to install libv8 3.16.14.3 but getting an error on OSX Mavericks using latest stable rvm and ruby-1.9.3-p125.
This is the output of running the command 'gem install libv8':
~/src(branch:master) » gem install libv8
Fetching: libv8-3.16.14.3.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
/Users/me/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.7.5
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
libtool: unrecognized option `-static'
libtool: Try `libtool --help' for more information.
make[1]: *** [/Users/me/.rvm/gems/ruby-1.9.3-p125#proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/libpreparser_lib.a] Error 1
make: *** [x64.release] Error 2
/Users/me/.rvm/gems/ruby-1.9.3-p125#proj-rails3-ruby19/gems/libv8-3.16.14.3/ext/libv8/location.rb:36:in `block in verify_installation!': libv8 did not install properly, expected binary v8 archive '/Users/me/.rvm/gems/ruby-1.9.3-p125#proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a'to exist, but it was not found (Libv8::Location::Vendor::ArchiveNotFound)
from /Users/me/.rvm/gems/ruby-1.9.3-p125#proj-rails3-ruby19/gems/libv8-3.16.14.3/ext/libv8/location.rb:35:in `each'
from /Users/me/.rvm/gems/ruby-1.9.3-p125#proj-rails3-ruby19/gems/libv8-3.16.14.3/ext/libv8/location.rb:35:in `verify_installation!'
from /Users/me/.rvm/gems/ruby-1.9.3-p125#proj-rails3-ruby19/gems/libv8-3.16.14.3/ext/libv8/location.rb:26:in `install!'
from extconf.rb:7:in `<main>'
GYP_GENERATORS=make \
build/gyp/gyp --generator-output="out" build/all.gyp \
-Ibuild/standalone.gypi --depth=. \
-Dv8_target_arch=x64 \
-S.x64 -Dv8_enable_backtrace=1 -Dv8_can_use_vfp2_instructions=true -Darm_fpu=vfpv2 -Dv8_can_use_vfp3_instructions=true -Darm_fpu=vfpv3
CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125#proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o
CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125#proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o
CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125#proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum.o
CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125#proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum-dtoa.o
CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125#proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/cached-powers.o
CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125#proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/conversions.o
CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125#proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/diy-fp.o
CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125#proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/dtoa.o
CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125#proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/fast-dtoa.o
CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125#proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/fixed-dtoa.o
CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125#proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/once.o
CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125#proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparse-data.o
CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125#proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparser.o
CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125#proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparser-api.o
CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125#proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/scanner.o
CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125#proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/strtod.o
CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125#proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/token.o
CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125#proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/unicode.o
CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125#proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/utils.o
LIBTOOL-STATIC /Users/me/.rvm/gems/ruby-1.9.3-p125#proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/libpreparser_lib.a
Gem files will remain installed in /Users/me/.rvm/gems/ruby-1.9.3-p125#proj-rails3-ruby19/gems/libv8-3.16.14.3 for inspection.
Results logged to /Users/me/.rvm/gems/ruby-1.9.3-p125#proj-rails3-ruby19/gems/libv8-3.16.14.3/ext/libv8/gem_make.out
This is due to the fact that OS X 10.9+ is using version 4.8 of GCC. This is not supported officially in older versions of libv8 as mentioned in the pull request (https://github.com/cowboyd/libv8/pull/95). Please try bumping up the version of libv8 in your Gemfile (or) a bundle update should suffice.
From the libv8 README
Bring your own V8
Because libv8 is the interface for the V8 engine used by therubyracer, you may need to use libv8, even if you have V8 installed already. If you wish to use your own V8 installation, rather than have it built for you, use the --with-system-v8 option.
Using RubyGems:
gem install libv8 [-v YOUR_VERSION] -- --with-system-v8
Using Bundler (in your Gemfile):
bundle config build.libv8 --with-system-v8
Please note that if you intend to run your own V8, you must install both V8 and its headers (found in libv8-dev for Debian distros).
Bring your own compiler
You can specify a compiler of your choice by either setting the CXX environment variable before compilation, or by adding the --with-cxx= option to the bundle configuration:
bundle config build.libv8 --with-cxx=clang++
Edit:
If this issue is brought on by therubyracer, try the following as suggested by rider_on_rails here:
gem uninstall libv8
gem install therubyracer -v YOUR_RUBY_RACER_VERSION
gem install libv8 -v YOUR_VERSION -- --with-system-v8
You can actually install that version on Mavericks:
gem install libv8 -v 3.11.8.17 -- --with-system-v8
I can confirm this works with rbenv and ruby 1.9.3p448
El Capitan Solution for me:
$ brew install v8
$ gem install libv8 -v REQUIRED_LIBV8_VERSION -- --with-system-v8
Where REQUIRED_LIBV8_VERSION for me was 3.16.14.7, but you need to check which is the one you need in your bundle (this was the one for rails 4.2.5)
You may also need to run the commands above as the superuser (if your gems and system libraries are global)
You can configure bundler instead of having to know each version. #3.15 could be replaced with other versions.
$ brew install v8#3.15
$ bundle config build.libv8 --with-system-v8
$ bundle config build.therubyracer --with-v8-dir=$(brew --prefix v8#3.15)
$ bundle install
My issue is since therubyracer, when update to macOS 10.15 and ruby-2.6.5
And the following works for me:
brew install v8#3.15
gem install libv8 -v 3.16.14.19 -- --with-system-v8
gem install therubyracer -- --with-v8-dir=/usr/local/opt/v8#3.15
When I tried the accepted answer, libv8 would install successfully with gem install libv8, but bundle install would fail on libv8. I think that bundle install was trying to install a different version of libv8. I was able to find a solution that worked for me.
I needed libv8 because therubyracer depends on it. To get it to install, I noted the version that was failing to install in the gem_make.out log for therubyracer. (The path for the gem_make.out log will be in the failure message.) In my case it was 3.16.14.7. (This version will probably change over time, in case you're reading this three years from now.) Then I did this:
gem install libv8 -v 3.16.14.7 -- --with-v8-lib <-- note different flag from accepted answer
which allowed this to work:
gem install therubyracer
which allowed me to complete my bundle install.
This worked for me on OSX Yosemite.
https://github.com/cowboyd/therubyracer/issues/339
jasonlynes's solution found on that link made the trick for me. anything else didn't work.
brew install homebrew/versions/v8-315
brew link --overwrite v8-315 --force
gem install libv8 -v '3.16.14.13' -- --with-system-v8
gem install therubyracer -v '0.12.2' -- --with-system-v8
I updated to macOS Catalina # 10.15 and ruby 2.6.5. After a while got libv8 and therubyracer to install again, although I'd recommend not to update macOS yet (I heard ruby should be fine).
First, I had to update XCode
xcode-select --install
I used rbenv to update ruby, and set the ruby version manually in /Users/<username>/.rbenv/version to 2.6.5. Although this shouldn't matter if your project contains a .ruby-version file.
Then I cleaned up any version I installed fro libv8 (usually in /usr/local/opt/): brew uninstall v8, brew uninstall libv8#3.15
brew install v8#3.15
Now, following https://github.com/cowboyd/libv8#do-i-get-a-binary, I installed
gem install libv8 -v '3.16.14.19' -- --with-system-v8
and then could run bundle install without errors.
None of this helped me... no matter what I did, my gem install of therubyracer kept complaining with this error:
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
Beginning compilation. This will take some time.
Building v8 with env CXX=clang++ LINK=clang++ /usr/local/bin/gmake x64.release ARFLAGS.target=crs werror=no
GYP_GENERATORS=make \
build/gyp/gyp --generator-output="out" build/all.gyp \
-Ibuild/standalone.gypi --depth=. \
-Dv8_target_arch=x64 \
-S.x64 -Dmac_deployment_target=10.15 -Dv8_enable_backtrace=1 -Dv8_can_use_vfp2_instructions=true -Darm_fpu=vfpv2 -Dv8_can_use_vfp3_instructions=true -Darm_fpu=vfpv3 -Dwerror=''
File "build/gyp/gyp", line 12
except ImportError, e:
^
SyntaxError: invalid syntax
gmake: *** [Makefile:268: out/Makefile.x64] Error 1
What ultimately helped me was this other forum I stumbled upon at https://www.bountysource.com/issues/82833405-libv8-fails-to-build-on-catalina-10-15
The final solution that worked for me:
I had to add these lines to my .zshrc file:
export CXX=clang++
export GYPFLAGS=-Dmac_deployment_target=10.15
Then I had to run these commands:
source ~/.zshrc
brew tap homebrew/homebrew-core
brew install v8#3.15
gem uninstall therubyracer
gem uninstall libv8
gem install libv8 -v '3.16.14.19' -- --with-system-v8
gem install therubyracer -v '0.12.3' -- --with-v8-dir=/usr/local/opt/v8#3.15
bundle install
I hope someone else finds this useful!
Try with what I summarized in this question: "gem install therubyracer -v '0.10.2'" on osx mavericks not installing
It worked for me (OS X Mavericks)
I had this same problem when I upgraded from OSX Mountain Lion to OSX Mavericks.
The accepted answer worked for libv8, but not when I went to bundle install therubyracer gem.
Upgrading from ruby-1.8.7-p354 to ruby-1.8.7-375 did the trick for me.
libv8 (3.16.14.3-x86_64-darwin-13) and the therubyracer (0.12.0) gems installed without problem.
assuming you use rbenv:
rbenv versions
system
* 1.8.7-p354
2.0.0-rc2
rbenv uninstall 1.8.7-p354
rbenv install 1.8.7-p375
rbenv versions
system
* 1.8.7-p375
2.0.0-rc2
bundle install
This worked fine for me:
Try installing this pre-compiled gem:
https://dl.dropboxusercontent.com/u/7919548/gems/libv8/libv8-3.11.8.17-x86_64-darwin-13.gem
(sha1:5ce07aaf4085fff5a5e10fe018fd6b22021bef3b)
Or if you prefer to build your own:
git clone https://github.com/cowboyd/libv8.git
cd libv8
git checkout 3.11
bundle install
bundle exec rake clean build binary
gem install pkg/libv8-3.11.8.17-x86_64-darwin-13.gem
Source: https://github.com/cowboyd/libv8/issues/107
Thanks to Felix Bünemann for the fix!
I tried a number of solutions outlined in previous answers, but found that running bundle (to install other, missing gems) would attempt to re-compile libv8 (despite having already installed it successfully using --with-system-v8) and thus suffer from the same issue.
Eventually, I found that removing the libv8 gem, fetching the gem file from rubygems, and then manually installing the .gem file with the --with-system-v8 flag worked for me.
i.e.
gem uninstall libv8
gem fetch libv8 -v LIBV8_VERSION
gem install libv8-LIBV_VERSION.gem -- --with-system-v8
bundle
Thanks to
Gaurav Agarwal's answer for leading me down the right path!
You can try manually compiling and installing the gem via the method mentioned on the libv8 github site.
In MAC-Yosemite with RVM environment and ruby-2.1.1 version
gem install libv8 -v 3.16.14.3 -- --with-v8-lib
gem install therubyracer
It works with the help of above command, can confirm this.
What really worked for me was upgrading ruby to 2.2.0, removing Gemfile.lock and bundling over again.
Worked like a charm!
This is what worked for me.
replace 3.16.14.7 with your version.
bundle install
gem install libv8 -v '3.16.14.7' -- --with-system-v8
bundle install
gem uninstall libv8 -v '3.16.14.7' -- --with-system-v8
brew install homebrew/dupes/apple-gcc42
export CC=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2
export CXX=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2
export CPP=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/cpp-4.2
bundle install
I have faced a similar problem on El Cap. Here's what I did.
brew tap homebrew/dupes
brew install apple-gcc42
And then,
export CC=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2
export CXX=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2
export CPP=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/cpp-4.2
Finally,
brew uninstall v8
gem install libv8 -v 3.11.8.17 -- --with-system-v8
I was using a beta version of Xcode for another project and had forgotten. Switch back with xcode-select. Something like:
sudo xcode-select --switch /Applications/Xcode.app/
Remove from Gemfile:
gem 'therubyracer', :platforms => :ruby

Trouble with libv8 3.16.14.3 on OS X Mavericks

The Rails project I'm working on includes the gem 'therubyracer' on its Gemfile. When I do
bundle install I get the following error:
...
Using launchy 2.4.2
Using less 2.4.0
Using less-rails 2.4.2
Bundler::GemspecError: Could not read gem at /Users/Swanros/.rvm/gems/ruby-2.0.0-p353#c-bullz/cache/libv8-3.16.14.3-x86_64-darwin-12.gem. It may be corrupted.
An error occurred while installing libv8 (3.16.14.3), and Bundler cannot continue.
Make sure that `gem install libv8 -v '3.16.14.3'` succeeds before bundling.
When I do gem install libv8 -v '3.16.14.3 it succeeds, and I cant finish bundling my project.
I've already uninstalled libv8, reinstalled it again, as well as therubyracer, and I still can't manage to get this to work.
Any ideas?
This solved my problem:
rm -rf /Users/Swanros/.rvm/gems/ruby-2.0.0-p353#c-bullz/cache/
:D
I had this same problem when I upgraded from OSX Mountain Lion to OSX Mavericks.
Upgrading from ruby-1.8.7-p354 to ruby-1.8.7-375 did the trick for me.
assuming you use rbenv:
rbenv install 1.8.7-p375
rbenv rehash
rbenv global 1.8.7-p375
bundle install

bundle install issue with libv8 and rails

I'm having issues with the libv8 gem with ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10.8.0]. gem install libv8 works fine and I have
gem 'therubyracer'
in my Gemfile and this has a dependency on libv8 which is installed when I do a bundle install:
$ bundle exec gem list
*** LOCAL GEMS ***
actionmailer (3.1.3)
actionpack (3.1.3)
...
libv8 (3.3.10.4 x86_64-darwin-10)
...
but when I run:
$ rails s
Could not find libv8-3.3.10.4 in any of the sources
Run `bundle install` to install missing gems.
it can't find libv8 - is this is a 32/64 bit issue? If so, how do I solve it?
I suspect this was because I had a 32/64 bit mismatch.
I solved this with the following:
$ irb
ruby-1.9.3-p0 :001 > `gem list`.each_line {|line| `sudo env ARCHFLAGS="-arch x86_64" gem install #{line.split.first}`
I had a similar problem deploying from an x86 dev box to an x86_64 server (using capistrano)
When I did the deployment, I got the same 'Could not find libv8-3.3.10.4 in any of the sources' message. This is because running 'bundle pack' on an x86 machine only copies the x86 gem into the /vendor/cache directory!
I fixed this by explicitly adding the linux x86_64 gem file to the /vendor/cache directory, so that it would agree with the deployment server architecture. Deployment ran fine after that.
Another solution is to use nodejs instead of therubyracer. You install it on the server using apt-get/yum, so there's no need for your Gemfile to include execjs or therubyracer.
You can actually install that version on Mavericks:
gem install libv8 -v 3.11.8.17 -- --with-system-v8
You can provide whatever libv8 gem version you want to install ..
After this you might facing issue with installing therubyracer then
Update Version of Gemfile to point to the last version like so:
gem "therubyracer", "~> 0.10.2"
and I was able to successfully install the gem.
If you want to manually install the gem, you can use:
gem install therubyracer --version "~> 0.10.2"
Have you tried bundle exec rails s? It's possible that there's a conflict between the gems you have installed on your system and the gems that are required for your project to run.
I resolved this issue by installing nodejs (latest version). What it does is that it installs the libv8 -dev library along with it. Thus rather than installing the gem what you require is the native library.
You can install it directly or install nodejs as well in your system and the above error should be resolved.

Why do I get a bcrypt-ruby gem install error?

Getting an error when trying to install the gem devise, the installation is stopping on
the gem bcrypt-ruby:
$ gem install bcrypt-ruby
Error installing bcrypt-ruby:
ERROR: Failed to build gem native extension.
I'm running OSX 10.6.7 with Ruby under RVM.
I reinstalled the lastest version of xcode & reinstalled Ruby 64bit, Rails and all the gems.
I had the same problem installing under OSX 10.7.3. When installing the gem, my error message was:
Building native extensions. This could take a while...
ERROR: Error installing bcrypt-ruby:
ERROR: Failed to build gem native extension.
creating Makefile
make
compiling bcrypt_ext.c
make: /usr/bin/gcc-4.2: No such file or directory
make: *** [bcrypt_ext.o] Error 1
Looks like the gem is looking for gcc-4.2 but I only had a file called gcc. Now since I had just installed the latest Xcode (4.3), I knew that my C compiler was compliant but the gem had gcc-4.2 hardcoded into it. So my solution was:
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
The linking worked like a charm.
Looks like there might be some info missing here - for me, this was due to a brew install of gcc. gcc was in /usr/bin, but not gcc-4.2. So I just did the following:
$ cd /usr/bin
$ sudo ln -s gcc gcc-4.2
which creates a link, gcc-4.2, which the gem is looking for that goes back to gcc.
Hope that helps.
It requires to install ruby-dev before installing bcrypt-ruby.
If you are using Ubuntu, run
sudo apt-get install ruby1.9.1-dev
or
sudo apt-get install ruby1.8-dev
based on RUby version.
I'm using RVM & I kept having this issue whenever installing gems with native extensions (bcrypt-ruby, bson-ext, json, eventmachine, nokogiri, linecache19, etc.)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
Only way I could finally get things working was to uninstall then re-install ruby.
rvm remove 1.9.2
rvm install 1.9.2
Thanks to tip from #doublebee here:
https://github.com/flori/json/issues/78#issuecomment-1499920
You only need use rvm (ruby version manager)
rvm uninstall 1.9.3
and then
rvm install 1.9.3
looks this error is on build of rvm 1.9.3, but uninstall and reinstalling fix the problem with bcrypt-ruby 3.0.1
sudo apt-get install ruby1.9.1-dev
whoked charm for me! Thanks a lot
Well, it works with Ruby 1.9.2 under RVM on MacOS 10.6.7:
$ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.6.0]
$ gem install bcrypt-ruby
Fetching: bcrypt-ruby-2.1.4.gem (100%)
Building native extensions. This could take a while...
Successfully installed bcrypt-ruby-2.1.4
1 gem installed
Installing ri documentation for bcrypt-ruby-2.1.4...
Installing RDoc documentation for bcrypt-ruby-2.1.4...
Try rvm notes and see if it says you need to install anything.
If you are using version 1.8 the required packages for bcrypt are in the dev bundle. Try using
$sudo apt-get install ruby1.8-dev
then
$gem install bcrypt-ruby
This fix work for me on ubuntu on osx use homebrew, macports whatever:
sudo apt-get install ruby1.9.1-dev
I think you need to reinstall bundler gem.
gem install bundler
and then
bundle install

Resources