Trouble installing ruby1.9.2 - ruby-on-rails

I am trying to install ruby1.9.2 using rvm on my Linux system (Mint-Linux distro), but I am unable to due to some errors which I cannot debug. This is the error I am getting when I run the install command.
$ rvm install 1.9.2
Installing Ruby from source to: /home/nnn/.rvm/rubies/ruby-1.9.2-p290, this may take a while depending on your cpu(s)...
ruby-1.9.2-p290 - #fetching
ruby-1.9.2-p290 - #extracted to /home/nnn/.rvm/src/ruby-1.9.2-p290 (already extracted)
Fetching yaml-0.1.4.tar.gz to /home/nnn/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /home/nnn/.rvm/src
Configuring yaml in /home/nnn/.rvm/src/yaml-0.1.4.
Compiling yaml in /home/nnn/.rvm/src/yaml-0.1.4.
Installing yaml to /home/nnn/.rvm/usr
ruby-1.9.2-p290 - #configuring
ERROR: Error running ' ./configure --prefix=/home/nnn/.rvm/rubies/ruby-1.9.2-p290 --enable-shared --disable-install-doc --with-libyaml-dir=/home/nnn/.rvm/usr ',
please read /home/nnn/.rvm/log/ruby-1.9.2-p290/configure.log
ERROR: There has been an error while running configure. Halting the installation.
The configure.log file has the following errors.
./configure --prefix=/home/nnn/.rvm/rubies/ruby-1.9.2-p290 --enable-shared --disable-install-doc --with-libyaml-dir=/home/nnn/.rvm/usr
configure: WARNING: unrecognized options: --with-libyaml-dir
configure: error: could not determine MAJOR number from version.h
Can you please help me out ?
Thanks

If you run
./configure --help
you will see that there is indeed no option 'with-libyaml-dir', it is not supported by Ruby's main configure script.
These "with-xxx-dir" parameters are often used during the compilation of extensions, where you create a Makefile by running
ruby extconf.rb --with-libimportantforextension-dir=...
In your case a workaround solution would be to install libyaml using apt-get:
sudo apt-get install libyaml
This way RVM will probably recognize that it is already installed and will not attempt to download and install it to a custom location, so you shouldn't receive the error you currently get anymore.

Related

gem install: ERROR: Failed to build gem native extension

I am using Arch Linux and installed Ruby (this is version 2.0.0).
When I installed Ruby it said I should add:
$(ruby -rubygems -e "puts Gem.user_dir")/bin
to my path, I added it to .bashrc
When I try to gem install rails or any other gem it gives the Error: Failed to build gem native extension. this is the full error:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/lib/ruby/gems/2.0.0 directory.
[alexander#localhost ~]$ sudo gem install rails --no-user-install
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
creating Makefile
make "DESTDIR="
sh: make: command not found
Gem files will remain installed in /usr/lib/ruby/gems/2.0.0/gems/atomic-1.1.10 for inspection.
When I look this error up I see that people solve this error by installing ruby-dev packages, however this does not exist for Arch Linux. Any other option that I can try?
Thanks in advance!
To build native extensions you need the c++-compiler and tools. This is said clearly:
sh: make: command not found
Except of make utility you obviously need the compiler itself (e. g. gcc) and company. Thus,
sudo apt-get install gcc
will do the trick. BTW, the properly suggested above RVM-way will definitely require build-tools as well.
try this commands
sudo apt-get install ruby1.9.1-dev build-essential
sudo apt-get install ruby-compass

how to update ruby path?

I'm reinstalling ruby with proper instructions this time
but I have paths messed up
this is what I'm getting this error
Last login: Sun Feb 24 02:06:37 on ttys000
Fawads-MacBook-Pro:~ fawadnaseer$ rvm install 1.9.3
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.8/x86_64/ruby-1.9.3-p374.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-1.9.3-p374, this may take a while depending on your cpu(s)...
ruby-1.9.3-p374 - #downloading ruby-1.9.3-p374, this may take a while depending on your connection...
######################################################################## 100.0%
ruby-1.9.3-p374 - #extracting ruby-1.9.3-p374 to /usr/local/rvm/src/ruby-1.9.3-p374
ruby-1.9.3-p374 - #extracted to /usr/local/rvm/src/ruby-1.9.3-p374
ruby-1.9.3-p374 - #configuring
Error running 'env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --disable-install-doc --prefix=/usr/local/rvm/rubies/ruby-1.9.3-p374 --with-opt-dir=/usr/local/rvm/usr --disable-shared', please read /usr/local/rvm/log/ruby-1.9.3-p374/configure.log
There has been an error while running configure. Halting the installation.
Configure.log file contents
here is the configure.log file
[2013-02-24 02:09:37] ./configure
current path: /usr/local/rvm/src/ruby-1.9.3-p374
command(7): env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --disable-install-doc --prefix=/usr/local/rvm/rubies/ruby-1.9.3-p374 --with-opt-dir=/usr/local/rvm/usr --disable-shared
checking build system type... x86_64-apple-darwin12.2.1
checking host system type... x86_64-apple-darwin12.2.1
checking target system type... x86_64-apple-darwin12.2.1
checking for C compiler default output file name...
configure: error: C compiler cannot create executables
UPDATE:
Ok guys I have RVM installed
Ruby Installed
Rails Installed
what when i put echo $PATH
echo $PATH
/Users/fawadnaseer/.rvm/gems/ruby-1.9.3-p392/bin:/Users/fawadnaseer/.rvm/gems/ruby-1.9.3-p392#global/bin:/Users/fawadnaseer/.rvm/rubies/ruby-1.9.3-p392/bin:/Users/fawadnaseer/.rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
are there any problem in this path?
Try using the clang compiler instead of the default:
rvm install 1.9.3 --with-gcc=clang

Make error - Installing RVM on Snow Leopard

I'm trying to install RVM on my Snow Leopard 10.6.8, using this:
\curl -L https://get.rvm.io | bash -s stable --ruby
And I get this error:
Installing Ruby from source to: /Users/Villa/.rvm/rubies/ruby-2.0.0-p0, this may take a while depending on your cpu(s)...
ruby-2.0.0-p0 - #downloading ruby-2.0.0-p0, this may take a while depending on your connection...
ruby-2.0.0-p0 - #extracted to /Users/Villa/.rvm/src/ruby-2.0.0-p0 (already extracted)
ruby-2.0.0-p0 - #configuring
ruby-2.0.0-p0 - #compiling
Error running 'make -j2', please read /Users/Villa/.rvm/log/ruby-2.0.0-p0/make.log
There has been an error while running make. Halting the installation.
And the make.log errors begins here:
In file included from openssl_missing.c:22:
openssl_missing.h:71: error: conflicting types for ‘HMAC_CTX_copy’
/Users/Villa/.rvm/usr/include/openssl/hmac.h:102: error: previous declaration of ‘HMAC_CTX_copy’ was here
openssl_missing.h:95: error: conflicting types for ‘EVP_CIPHER_CTX_copy’
/Users/Villa/.rvm/usr/include/openssl/evp.h:503: error: previous declaration of ‘EVP_CIPHER_CTX_copy’ was here
openssl_missing.c:27: error: conflicting types for ‘HMAC_CTX_copy’
/Users/Villa/.rvm/usr/include/openssl/hmac.h:102: error: previous declaration of ‘HMAC_CTX_copy’ was here
openssl_missing.c:122: error: conflicting types for ‘EVP_CIPHER_CTX_copy’
/Users/Villa/.rvm/usr/include/openssl/evp.h:503: error: previous declaration of ‘EVP_CIPHER_CTX_copy’ was here
make[2]: *** [openssl_missing.o] Error 1
make[1]: *** [ext/openssl/all] Error 2
make[1]: *** Waiting for unfinished jobs....
compiling psych_emitter.c
compiling psych_parser.c
compiling psych_to_ruby.c
compiling psych_yaml_tree.c
linking shared-object psych.bundle
installing default psych libraries
make: *** [build-ext] Error 2
Please tell me everything you need from me to get a solution
UPDATE #1
I try to install it doing:
rvm reinstall 1.9.3 --with-openssl-dir=/usr/bin
And I get this
Error running '__rvm_rm_rf /Users/Villa/.rvm/src/ruby-1.9.3-p392',
please read /Users/Villa/.rvm/log/ruby-1.9.3-p392/remove.src.log
/Users/Villa/.rvm/rubies/ruby-1.9.3-p392 has already been removed.
Installing requirements for osx/10.6/i386, might require sudo password
Skipping `brew update` make sure your formulas are up to date.
-bash: /usr/local/etc/openssl/cert.pem: Permission denied
-bash: /usr/local/etc/openssl/cert.pem: Permission denied
Doing /usr/local/etc/openssl
cert.pem => 77ee3751.0
Installing Ruby from source to: /Users/Villa/.rvm/rubies/ruby-1.9.3-p392, this may take a while depending on your cpu(s)...
ruby-1.9.3-p392 - #downloading ruby-1.9.3-p392, this may take a while depending on your connection...
ruby-1.9.3-p392 - #extracted to /Users/Villa/.rvm/src/ruby-1.9.3-p392 (already extracted)
ruby-1.9.3-p392 - #configuring...
Error running './configure --prefix=/Users/Villa/.rvm/rubies/ruby-1.9.3-p392 --with- openssl-dir=/usr/bin --with-opt- dir=/usr/local/opt/libyaml:/usr/local/opt/readline:/usr/local/opt/libxml2:/usr/local/opt/lib xslt:/usr/local/opt/libksba:/usr/local/opt/openssl:/usr/local/opt/sqlite --disable- install-doc --without-tcl --without-tk --enable-shared',
please read /Users/Villa/.rvm/log/ruby-1.9.3-p392/configure.log
There has been an error while running configure. Halting the installation.
Thanks!
Try installing with --with-openssl-dir=/path/to/openssl with the location of your installed openssl version.
more over you can look at this https://rvm.io/packages/openssl/
I got mine to work with the following code I found on MacRuby's site:
$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/
If you're using an Xcode version later than 4.3 this will configure the path for installations.

Updating ror 1.8.7 to 1.9.3

I'm a beginner ror programmer with a macbook air. i've just managed to upgrade my leopard to Lion. Downloaded codex 10.7 and macport and also RVM. The thing i'm trying to do now is to update my ruby from 1.8.7 to 1.9.3 but this is what i got:
I typed out: 'rvm install ruby-1.9.2-p318"
Annie-Tungs-MacBook-Air:~ annietung$ rvm install ruby-1.9.2-p318 Fetching yaml-0.1.4.tar.gz to /Users/annietung/.rvm/archives Extracting yaml-0.1.4.tar.gz to /Users/annietung/.rvm/src Configuring yaml in /Users/annietung/.rvm/src/yaml-0.1.4. Error running ' ./configure --prefix="/Users/annietung/.rvm/usr" ', please read /Users/annietung/.rvm/log/ruby-1.9.2-p318/yaml/configure.log Compiling yaml in /Users/annietung/.rvm/src/yaml-0.1.4. Error running 'make ', please read /Users/annietung/.rvm/log/ruby-1.9.2-p318/yaml/make.log
Database file /Users/annietung/.rvm/config/packages does not exist.
Installing Ruby from source to: /Users/annietung/.rvm/rubies/ruby-1.9.2-p318, this may take a while depending on your cpu(s)...
ruby-1.9.2-p318 - #fetching ruby-1.9.2-p318 - #extracted to /Users/annietung/.rvm/src/ruby-1.9.2-p318 (already extracted) ruby-1.9.2-p318 - #configuring Error running ' ./configure --prefix=/Users/annietung/.rvm/rubies/ruby-1.9.2-p318 --enable-shared --disable-install-doc --with-libyaml --with-opt-dir=/Users/annietung/.rvm/usr ', please read /Users/annietung/.rvm/log/ruby-1.9.2-p318/configure.log There has been an error while running configure. Halting the installation. ls: /Users/annietung/.rvm/rubies/*/bin/ruby: No such file or directory Annie-Tungs-MacBook-Air:~ annietung$
Looks like you need to download and install Apple's Command Line Tools for OSX Lion so that you can build Ruby properly.

Having difficulty installing rvm 1.9.3 with xcode 4.3.2

If I type xcodebuild -version it recognises that I have xcode installed:
Xcode 4.3.2
Build version 4E2002
But then when I try to check rvm requirements I get the following:
Notes for Mac OS X 10.7.3, No Xcode.
For JRuby: Install the JDK. See http://developer.apple.com/java/download/ # Current Java version "1.6.0_26"
For IronRuby: Install Mono >= 2.6
For Ruby 1.9.3: Install libksba # If using Homebrew, 'brew install libksba'
You can use & download osx-gcc-installer: https://github.com/kennethreitz/osx-gcc- installer
** NOTE: Currently, Node.js is having issues building with osx-gcc-installer. The only fix is to install Xcode over osx-gcc-installer.
We had reports of http://hpc.sourceforge.net/ making things work, but it looks like not easiest/safest to setup.
To use an RVM installed Ruby as default, instead of the system ruby:
rvm install 1.8.7 # installs patch 357: closest supported version
rvm system ; rvm gemset export system.gems ; rvm 1.8.7 ; rvm gemset import system.gems # migrate your gems
rvm alias create default 1.8.7
And reopen your terminal windows.
Xcode 4.2:
* is only supported by ruby 1.9.3+ using command line flag: --with-gcc=clang
* it breaks gems with native extensions, especially DB drivers.
It seems that it is not recognising my xcode and when I try to install rvm 1.9.3 I get:
Fetching yaml-0.1.4.tar.gz to /Users/sikandarshukla/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/sikandarshukla/.rvm/src
Configuring yaml in /Users/sikandarshukla/.rvm/src/yaml-0.1.4.
Error running ' ./configure --prefix="/Users/sikandarshukla/.rvm/usr" ', please read /Users/sikandarshukla/.rvm/log/ruby-1.9.3-p125/yaml/configure.log
Compiling yaml in /Users/sikandarshukla/.rvm/src/yaml-0.1.4.
Error running 'make ', please read /Users/sikandarshukla/.rvm/log/ruby-1.9.3- p125/yaml/make.log
Database file /Users/sikandarshukla/.rvm/config/packages does not exist.
/Users/sikandarshukla/.rvm/scripts/functions/build: line 28: --version: command not found
Installing Ruby from source to: /Users/sikandarshukla/.rvm/rubies/ruby-1.9.3-p125, this may take a while depending on your cpu(s)...
ruby-1.9.3-p125 - #fetching
ruby-1.9.3-p125 - #extracted to /Users/sikandarshukla/.rvm/src/ruby-1.9.3-p125 (already extracted)
ruby-1.9.3-p125 - #configuring
Error running ' ./configure --prefix=/Users/sikandarshukla/.rvm/rubies/ruby-1.9.3-p125 -- enable-shared --disable-install-doc --with-libyaml --with-opt- dir=/Users/sikandarshukla/.rvm/usr ', please read /Users/sikandarshukla/.rvm/log/ruby-1.9.3- p125/configure.log
There has been an error while running configure. Halting the installation.
Now if i read the log, the output of cat /Users/sikandarshukla/.rvm/log/ruby-1.9.3-p125/configure.log is the following:
./configure --prefix=/Users/sikandarshukla/.rvm/rubies/ruby-1.9.3-p125 --enable-shared -- disable-install-doc --with-libyaml --with-opt-dir=/Users/sikandarshukla/.rvm/usr
configure: WARNING: unrecognized options: --with-libyaml
checking build system type... i386-apple-darwin11.3.0
checking host system type... i386-apple-darwin11.3.0
checking target system type... i386-apple-darwin11.3.0
checking whether the C compiler works... no
configure: error: in `/Users/sikandarshukla/.rvm/src/ruby-1.9.3-p125':
configure: error: C compiler cannot create executables
See `config.log' for more details
and the output of cat /Users/sikandarshukla/.rvm/log/ruby-1.9.3-p125/yaml/configure.log is the following:
./configure --prefix="/Users/sikandarshukla/.rvm/usr"
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... config/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... no
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/Users/sikandarshukla/.rvm/src/yaml-0.1.4':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
Any ideas what to do, Thanks for your help
It's a bug in recognizing Xcode version, I have created a ticket and it should be solved shortly -> https://github.com/wayneeseguin/rvm/issues/846
All Xcode 4.2+ have the same issue:
4.2:
is only supported by ruby 1.9.3+ using command line flag: --with-gcc=clang
it breaks gems with native extensions, especially DB drivers.
To solve use osx-gcc-installer:
You can use & download osx-gcc-installer: https://github.com/kennethreitz/osx-gcc-installer

Resources