I'm getting
ERROR: While executing gem ... (NameError) uninitialized constant Gem::RemoteFetcher::OpenSSL
When I try to run # gem install rails
I already have
Ruby v1.8.7
Gem (rubygems.nonarch) v1.7.2
Installed.
Any Idea what I should do?
Running sudo gem install rails now gives me:
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/json-1.7.4 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/json-1.7.4/ext/json/ext/generator/gem_make.out
Everything Installed via YUM
Running Fedora 15
I was having a similar issue while doing #gem install rake, but I found out that my system was behind a proxy server, and so I tried supplying the proxy address by this command:
gem install rake -p http//IPaddress:proxyport (put : after http)
and it worked for me, with no such error afterwards.
Hit rvm requirements. You don't have libssl-dev installed.
➜ ~ rvm requirements
Requirements for Linux ( DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.10
DISTRIB_CODENAME=maverick
DISTRIB_DESCRIPTION="Ubuntu 10.10" )
NOTE: 'ruby' represents Matz's Ruby Interpreter (MRI) (1.8.X, 1.9.X)
This is the *original* / standard Ruby Language Interpreter
'ree' represents Ruby Enterprise Edition
'rbx' represents Rubinius
bash >= 4.1 required
curl is required
git is required (>= 1.7 for ruby-head)
patch is required (for 1.8 rubies and some ruby-head's).
To install rbx and/or Ruby 1.9 head (MRI) (eg. 1.9.2-head),
then you must install and use rvm 1.8.7 first.
Additional Dependencies:
# For Ruby / Ruby HEAD (MRI, Rubinius, & REE), install the following:
ruby: /usr/bin/apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
# For JRuby, install the following:
jruby: /usr/bin/apt-get install curl g++ openjdk-6-jre-headless
jruby-head: /usr/bin/apt-get install ant openjdk-6-jdk
# For IronRuby, install the following:
ironruby: /usr/bin/apt-get install curl mono-2.0-devel
I'm not aware how Fedora's requirements differ from Ubuntu's, but that's probably only in package names.
I have just had same issue with gem install on Ubuntu. It is now working and I think that what I did to fix it was enable ssl out through the firewall.
It looks as if gem returns this error in response to failure to establish an SSL connection, presumably while trying to handle the failure.
Russell
Related
I am trying to install Ruby on Rails on my local machine for development purposes, but I have hit upon an error. I can't quite tell, but it seems like it might be a gem error. Though, this is my first time trying to use all three, Ruby, Gem and Rails, so I'm not sure.
Running the command "sudo gem install rails -V" these are the last few lines printed after the error is hit:
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:13:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/atomic-1.1.14 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/atomic-1.1.14/ext/gem_make.out
The version of Ruby installed is:
ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]
The version of gem is:
1.8.23
Install the gem as a normal user, not sudo:
gem install rails
Or install the ruby dev package. There are a lot of similar answers in SO:
Failed to build gem native extension — Rails install
Unable to install gem - Failed to build gem native extension - cannot load such file -- mkmf (LoadError)
Failed to build gem native extension (mkmf (LoadError)) - Ubuntu 12.04
From the atomic gem README.
As of 1.1.0, JDK8 is required to build the atomic gem, since it attempts to use the new atomic
Please install Java, then re-run the gem install process.
What Linux do you have?
On Mint, i did:
sudo apt-get install git
sudo apt-get install curl
curl -L https://get.rvm.io | bash -s stable --ruby
sudo apt-get install git-core
source ~/.rvm/scripts/rvm
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
rvm autolibs enable
rvm reload
rvm requirements
sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
rvm install ruby-2.0
curl -L https://get.rvm.io | bash -s stable --rails
and it works fine. This will (currently) install Ruby 2.0 and rails 4.0 however.
I'm trying to get rails up and running on my development server. It's a fedora14 box. I installed rvm, ruby 1.8.7, and rubygems 1.6.2. When I try to install rails via gem, gem install rails, i get the following error:
ERROR: Loading command: install (LoadError)
no such file to load -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
Any ideas as to what is going on. I'm 100% new to ruby/rubygems/rails and I know enough about Linux to be dangerous so any help/suggestions would be greatly appreciated.
Thanks in advance
Run rvm notes and install whatever it tells you (zlib-devel will probably be one of the packages you'll need to install via yum). The output you'll see will be similar to this:
# For Ruby (MRI & Ree) you should install the following OS dependencies:
ruby: yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel ;
yum install -y make bzip2 ;
yum install -y iconv-devel # NOTE: For centos 5.4 final iconv-devel might not be available :(
You need to install the zlib libraries. A gem is trying to use it with a C extension but it is not found. http://fr.rpmfind.net/linux/rpm2html/search.php?query=zlib-devel&system=&arch= Install zlib-devel.
What this error means is that zlib library is missing. This is a common problem and if you google for it, you'd find loads of information on the same. In ubuntu (where I work) installing the package zlib1g-dev and zlib1g fixes it. I am not sure what the equivalent package in Fedora is, but you should be able to search / find that.
I'm trying to install rails on Ubuntu 10.10, but get File not found: lib every time. Ruby and Rubygems have been installed correctly. I've seen this problem posted all over the web but no solutions work for me. I reinstalled rdoc and I still get the same result.
$ sudo gem install rails
...
Successfully installed rails-3.0.1
24 gems installed
...
Installing ri documentation for builder-2.1.2...
ERROR: While generating documentation for builder-2.1.2
... MESSAGE: Unhandled special: Special: type=17, text="<!-- HI -->"
... RDOC args: --ri --op /var/lib/gems/1.8/doc/builder-2.1.2/ri --title Builder -- Easy XML Building --main README --line-numbers --quiet lib CHANGES Rakefile README doc/releases/builder-1.2.4.rdoc doc/releases/builder-2.0.0.rdoc doc/releases/builder-2.1.1.rdoc --title builder-2.1.2 Documentation
(continuing with the rest of the installation)
...
Installing ri documentation for rails-3.0.1...
File not found: lib
$ rails -v
The program 'rails' is currently not installed. You can install it by typing:
sudo apt-get install rails
I wrote a detailed how-to guide on installing Ruby and Rails on Ubuntu 10.10 that will help you with this.
Guaranteed, or your money back!
You should avoid the packaged version of Ruby (i.e., avoid the version of Ruby that comes from apt-get install ruby). The Debian packaging system (which Ubuntu uses) conflicts with what Ruby expects.
Instead, you should install Ruby from source.
There's a nice tool called RVM to help you do this.
# Install prerequisites
$ sudo apt-get install git curl wget
# Download and install RVM
$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-latest )
# Install RVM into your .bash_profile
$ cat >> ~/.bash_profile <<-PROFILE
> [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
> PROFILE
# Load RVM into the current shell
$ rvm reload
# Install prerequisites
$ rvm notes
$ sudo apt-get install \
> build-essential bison openssl libreadline6 libreadline6-dev curl \
> git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 \
> libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev \
> ncurses-dev
# Install Ruby
$ rvm install ruby-1.9.2-p180 # latest version as of now
$ rvm use ruby-1.9.2-p180 --default
# Check it
$ ruby -v
$ which ruby
$ gem install rails
[gkaykck#main myApplication]$ rails console
/usr/local/lib/ruby/1.9.1/irb/completion.rb:9:in `require': no such file to load -- readline (LoadError)
from /usr/local/lib/ruby/1.9.1/irb/completion.rb:9:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands/console.rb:3:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands/console.rb:3:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:20:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:20:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I have installed rails 3 on ruby 1.9.2p136, which is ok i guess. But i cannot start rails console and it gives me the error i copied. The apps worked great with ruby 1.8.7 and i never saw an error like this.
Any ideas what it could be?
Apparently ubuntu and ruby don't always catch dependencies like they should.
From the first google hit (yeah, I clicked on this stack-overflow in place #2 before checking out the first result.)
Navigate to the Ruby source and enter:
sudo apt-get install libreadline5-dev
cd ext/readline
ruby extconf.rb
make
sudo make install
So, if you're on another distro, make sure you install readline somehow (source/package), then run make/install on extconf from the source. I tried what gkaykck suggested of course but got this without readline already on my system.
$ ruby extconf.rb
checking for tgetnum() in -lncurses... no
checking for tgetnum() in -ltermcap... no
checking for tgetnum() in -lcurses... no
checking for readline/readline.h... no
checking for editline/readline.h... no
Recipe for those who use rvm:
rvm pkg install readline
rvm remove 1.9.3
rvm install 1.9.3 --with-readline-dir=$rvm_path/usr
In more details about it on https://rvm.io/packages/readline/
If you want another solution to this problem do this.
sudo apt-get install libreadline6
Then in your gem file add:
gem 'rb-readline'
Then
bundle install
And you should be all set.
I'd recommend using rvm (Ruby Version Manager) to manage your different versions of Ruby and switch between them. It does a pretty good job of compiling the various versions for you too. You can even create per-directory .rvmrc files to tell rvm what version of ruby to use in which directory (as well as use per-project gem sets if you want!)
First of all uninstall every ruby version you have.
After that display rvm requirements:
rvm requirements
You will get something like:
Requirements for Linux ( DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=11.10
DISTRIB_CODENAME=oneiric
DISTRIB_DESCRIPTION="Ubuntu 11.10" )
NOTE: 'ruby' represents Matz's Ruby Interpreter (MRI) (1.8.X, 1.9.X)
This is the *original* / standard Ruby Language Interpreter
'ree' represents Ruby Enterprise Edition
'rbx' represents Rubinius
bash >= 4.1 required curl is required git is required (>= 1.7 for
ruby-head) patch is required (for 1.8 rubies and some ruby-head's).
To install rbx and/or Ruby 1.9 head (MRI) (eg. 1.9.2-head), then you
must install and use rvm 1.8.7 first.
Additional Dependencies:
# For Ruby / Ruby HEAD (MRI, Rubinius, & REE), install the following:
ruby: /usr/bin/apt-get install build-essential openssl libreadline6
libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev
libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev
ncurses-dev automake libtool bison subversion
# For JRuby, install the following:
jruby: /usr/bin/apt-get install curl g++ openjdk-6-jre-headless
jruby-head: /usr/bin/apt-get install ant openjdk-6-jdk
# For IronRuby, install the following:
ironruby: /usr/bin/apt-get install curl mono-2.0-devel
Install all dependencies via apt-get.
After that install ruby 1.8.7. This version is required if you plan to use ruby 1.9.x
Now you can install ruby 1.9.3:
rvm pkg install readline
rvm remove 1.9.3
rvm install 1.9.3 --with-readline-dir=$rvm_path/usr
Note that you dont even need to install readline package via rvm if you had installed it using apt-get.
With CentOS 6:
Remember we are working from the ruby install dir, for me it was:
/opt/ruby-1.9.3-p194/ext/readline
If you see the following output, then readline is not installed:
$ ruby extconf.rb
checking for tgetnum() in -lncurses... no
checking for tgetnum() in -ltermcap... no
checking for tgetnum() in -lcurses... no
checking for readline/readline.h... no
checking for editline/readline.h... no
To install with RPM:
yum install readline-devel
Then build it:
ruby extconf.rb
make
sudo make install
Adding in the Gemfile
gem 'rb-readline'
and then bundle install
did the trick for me
Solution is to go to the source folder you compiled ruby => ext => readline than
ruby extconf.rb
make
sudo make install
If you're using RVM you can re-make readline. This fixed the issue for me. Instructions here:
no such file to load -- readline (Load Error)
use rvm remove to remove all ruby installed.
do a "which ruby" if you still get something, you need to reinstall rvm then install ruby using rvm.
I'm setting up mod_rails on a Debian server but somehow something got screwed up (it wasn't me :P ).
gem install passenger
Building native extensions. This could take a while...
ERROR: Error installing passenger:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
creating Makefile
make
sh: make: command not found
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/fastthread-1.0.7 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/fastthread-1.0.7/ext/fastthread/gem_make.out
gem is installed:
gem -v
1.3.5
ruby also fine:
ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
Are you sure you have make, gcc et al?
$ sudo apt-get install build-essential
Does "which make" point to anything?
apt-get install build-essential zlib1g-dev libssl-dev libreadline5-dev
This should be everything you need to get passenger to build