Installing libv8 for ree on Mountain Lion fails - ruby-on-rails

I've been trying to find a solution to this for a few days now and no luck. If anyone has been successful installing the libv8 gem for REE 1.8.7 on ML, could you please let me know the process you followed?
I have both the XCode LLVM compiler as well as the kennethreitz GCC package for 10.7+ v2 installed.
The output when trying to install with native extensions is:
Building native extensions. This could take a while...
ERROR: Error installing libv8:
ERROR: Failed to build gem native extension.
/Users/XXXXX/.rvm/rubies/ree-1.8.7-2012.02/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=/Users/XXXXX/.rvm/rubies/ree-1.8.7-2012.02/bin/ruby
extconf.rb:13: uninitialized constant Gem (NameError)
Checking for Python...
Gem files will remain installed in /Users/XXXXX/.rvm/gems/ree-1.8.7-2012.02/gems/libv8-3.3.10.4 for inspection.
Results logged to /Users/XXXXX/.rvm/gems/ree-1.8.7-2012.02/gems/libv8-3.3.10.4/ext/libv8/gem_make.out
(The results logged are the exact same as the error).

This worked for me.
RUBYOPT=-rrubygems gem install therubyracer

I was able to successfully install the libv8 gem on Mountain Lion on a freshly installed ree-1.8.7. I believe the issue you're seeing stems from the GCC version being used.
As is now described in the osx-gcc-installer's README you should switch from Kenneth Reitz's LLVM-version of GCC to the GCC 4.2 that is available via Homebrew or Macports.
Homebrew instructions:
http://coderwall.com/p/dtbuqg
MacPorts instructions:
http://coderwall.com/p/pagj2w
Note that you will want to set the CC path and establish the necessary symlink as described in those articles.

Related

Cannot install uchardet gem on Mac OS catalina

Recently I got the following errors when I tried to install the uchardet GEM in MacOS catalina,Even I specific the ICU version and lib, it still doesn't work, anyone have ideas?
Installing uchardet 0.2.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/xxx/.rvm/gems/ruby-2.6.4/gems/uchardet-0.2.0/ext
/Users/xxx/.rvm/rubies/ruby-2.6.4/bin/ruby -I /Users/xxx/.rvm/rubies/ruby-2.6.4/lib/ruby/site_ruby/2.6.0 -r ./siteconf20200420-38494-q9y0cf.rb extconf.rb
Could not find ICU libraries and/or development tools. Try installing "icu-devtools" or "icu" package.
*** 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/xxx/.rvm/rubies/ruby-2.6.4/bin/$(RUBY_BASE_NAME)
extconf failed, exit code 1
Gem files will remain installed in /Users/xxx/.rvm/gems/ruby-2.6.4/gems/uchardet-0.2.0 for inspection.
Results logged to /Users/xxx/.rvm/gems/ruby-2.6.4/extensions/x86_64-darwin-19/2.6.0/uchardet-0.2.0/gem_make.out
I was able to reproduce this on my mac:
I fixed this error by re-installing and re-linking icu4c
brew install icu4c
brew link icu4c --force # if it shows you an error and tells you to add the path manually add them
restarted my terminal then re-installed the gem (i also tried this)
you will know it's working when you have which icu-config working https://github.com/dmgk/uchardet/blob/506105c5322fe3cde7ce3e2b2868f875b9b57230/ext/extconf.rb#L3-L6
however now i have another error uchardet.c:2:10: fatal error: 'unicode/ucsdet.h' file not found i do think the gems needs better configuration around this

Can't install Rails on my system

I keep getting the following error. I have rvm 1.25.17 (stable), ruby 2.1.0p0 revision 44422. Also, I checked my Xcode install and I think it's up to date (3.2 in /Developer and 5.0.2 in /Applications). At some point, an error told me that my Xcode might not be installed. I'm getting back into programming after a long break and am at a loss. Just trying to get setup on some Ruby on Rails...
Fetching: atomic-1.1.14.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/Users/ecualombian/.rvm/rubies/ruby-2.1.0/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=/Users/ecualombian/.rvm/rubies/ruby-2.1.0/bin/ruby
--with-atomic_reference-dir
--without-atomic_reference-dir
--with-atomic_reference-include
--without-atomic_reference-include=${atomic_reference-dir}/include
--with-atomic_reference-lib
--without-atomic_reference-lib=${atomic_reference-dir}/lib
/Users/ecualombian/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/ecualombian/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:541:in `try_link0'
from /Users/ecualombian/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:840:in `try_run'
from extconf.rb:26:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/ecualombian/.rvm/rubies/ruby-2.1.0/lib/ruby/gems/2.1.0/gems/atomic-1.1.14 for inspection.
Results logged to /Users/ecualombian/.rvm/rubies/ruby-2.1.0/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-12/2.1.0-static/atomic-1.1.14/gem_make.out
From XCode 5.0.1 onwards, you can install commandline tools from the terminal. Here's the command, please run this on your Terminal:
xcode-select --install
Once it's installed, try installing the gems again.
Basically atomic gem expects you to have developer tools like gcc 4.2 which you can install view brew or simply install XCode command like tools, reinstall ruby via rvm and then install rails.
You are probably missing command line tools for Xcode, that are required for gcc and make. Install the same from Xcode-> Preferences-> Downloads, or from the command line with xcode-select --install, and then retry installing Rails.

"extconf.rb failed" message while installing Rails

Newbie here. I've searched for other similar questions on the site but still wasn't able to solve the problem. I've installed Ruby 2.0.0 and RubyGem 2.0.3, but when I'm trying to install Rails 4.0.0 I got:
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0/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
--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/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0/bin/ruby
--with-atomic_reference-dir
--without-atomic_reference-dir
--with-atomic_reference-include
--without-atomic_reference-include=${atomic_reference-dir}/include
--with-atomic_reference-lib
--without-atomic_reference-lib=${atomic_reference-dir}/
/Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/mkmf.rb:431:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/mkmf.rb:516:in `try_link0'
from /Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/mkmf.rb:814:in `try_run'
from extconf.rb:22:in `<main>'
Gem files will remain installed in /Users/yuanhunglo/.rvm/gems/ruby-2.0.0-p0/gems/atomic-1.1.10 for inspection.
Results logged to /Users/yuanhunglo/.rvm/gems/ruby-2.0.0-p0/gems/atomic-1.1.10/ext/gem_make.out
I tried to install Rails by
gem install rails --version 4.0.0
I'm not sure if there's something wrong with the set up or if I still need to install something. Thanks in advance for your help.
It seems you're using OSX.
This error happens when you can't compile some extensions, in this case due to the lack of a compiler ("You have to install development tools first"). Open App Store, download XCode and, after installing it, click on "XCode" on the menu, go to Preferences -> Downloads -> Components and download "Command Line Tools".

Unable to get ImageMagick version *** extconf.rb failed ***

i've googled this error a couple of times and got instructions to install rMagick win-32 from their website. However the win32 versions looks depecrated and is made for Ruby 1.8.6 as for i have 1.9.3.
Can someone please help me install this gem? I really can't be arsed to do the imageMagick installing on my PC for this since the code will be moved to other PC's etc. a couple of times in the next few weeks (school assignment, you know how i goes). And with that it appears that imageMagick CAN be installed along with this gem(Which is by far the best option in my case). Nonetheless, i can't figure out this error since i'm a pretty big n00b when it comes to these things.
C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb
checking for Ruby version >= 1.8.5... yes
Ongeldige stationsspecificatie.
Unable to get ImageMagick version
*** 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:/RailsInstaller/Ruby1.9.3/bin/ruby
Gem files will remain installed in C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9
.1/gems/rmagick-2.13.1 for inspection.
Results logged to C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rmagick-2
.13.1/ext/RMagick/gem_make.out
An error occured while installing rmagick (2.13.1), and Bundler cannot continue.
Make sure that `gem install rmagick -v '2.13.1'` succeeds before bundling.
Here I faced the same problem. After search, I found solution from here
http://www.waydotnet.com/2010/02/12/rmagick-on-ruby-1-9-1-i386-mingw32-work-d/
http://phosphor-escence.blogspot.in/2010/12/if-you-fail-install-rmagick-on-mingw.html
You need to install dev packages:
sudo apt-get install libmagick++-dev
Hope this helps :)

fatal error while bundle install (while installing libv8)

I work on windows7 (32-bit) and I get error that while bundle install;
Installing libv8 (3.3.10.4) with native extensions Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at https://github.com/carlhuda/bundler/issues so that we can fix it. Thanks!
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:533:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
C:/Ruby192/bin/ruby.exe 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=C:/Ruby192/bin/ruby
Checking for Python... Unable to build libv8: Python not found!
So I can't complete "bundle install".
Install ActivePython version 2.7.2.5, then run:
gem install libv8 --version 3.11.8.0
to install the libv8 in Windows, the latest version 3.11.8.3 can not work in windows, but 3.11.8.0 can in Windows 7.
On windows 7, with ruby193 I installed python27, I added to the PATH variable the python's folder, I wrote gem install libv8 in the console and libv8 was succesfully installed
You need to install python since libv8 seems to depend on Python as you can see in project stats
I opened issue 29 on github and I learned that libv8 is not supported on windows. so there is no solution for the error. Just you can change your platform.

Resources