Installing libssl-dev on ubuntu for ruby 2.0 - ruby

I tryed to install ruby 2.0 with rbenv on Ubuntu 12.04:
rbenv install 2.0.0-p247
Now I got the following error message:
Installing ruby-2.0.0-p247...
BUILD FAILED
Inspect or clean up the working tree at /tmp/ruby-build.20130801100032.13868
Results logged to /tmp/ruby-build.20130801100032.13868.log
Last 10 log lines:
installing default gems: /home/chris/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0 (build_info, cache, doc, gems, specifications)
bigdecimal 1.2.0
io-console 0.4.2
json 1.7.7
minitest 4.3.2
psych 2.0.0
rake 0.9.6
rdoc 4.0.0
test-unit 2.0.0.0
The Ruby openssl extension was not compiled. Missing the OpenSSL lib?
In this Question Sam Ruby said I should install libssl-dev and I try it with:
sudo apt-get install libssl-dev
Now I got this error:
dpkg: Fehler: Parsen der Datei »/var/lib/dpkg/available«, nahe Zeile 10:
package name fehlt
E: Sub-process /usr/bin/dpkg returned an error code (2)
Could somebody explain me what is the problem and how can I solve it, please.

Your /var/lib/dpkg/available file got corrupted. You can fix it with the following:
Backup your existing /var/lib/dpkg/available via: sudo cp /var/lib/dpkg/available /var/lib/dpkg/available.backup
Then run the following, this will clear the file:
sudo dpkg --clear-avail
You should be able to install packages again as usual: sudo apt-get update && sudo install libssl-dev
Source: Ubuntu dpkg manpage
If none of the above helps, try asking on AskUbuntu

Related

Error occured while installing unf_ext (0.0.7.4), and Bundler cannot continue

My ultimate goal is to get this to work in an Ubuntu 14.04 Docker container: https://github.com/byalextran/autoluv
When I run
m1#9bdc67007b49:~/autoluv$ bundle install --deployment
It says:
Fetching unf_ext 0.0.7.4
Installing unf_ext 0.0.7.4 with native extensions
Errno::EACCES: Permission denied # rb_sysopen - /home/m1/autoluv/vendor/bundle/ruby/2.4.0/gems/unf_ext-0.0.7.4/.document
An error occurred while installing unf_ext (0.0.7.4), and Bundler cannot continue.
Make sure that `gem install unf_ext -v '0.0.7.4' --source 'https://rubygems.org/'` succeeds before bundling.
But when I run
sudo gem install unf_ext -v '0.0.7.4' --source 'https://rubygems.org/'
unf_ext-0.0.7.4 installs fine?
Building native extensions. This could take a while...
Successfully installed unf_ext-0.0.7.4
1 gem installed
Installing ri documentation for unf_ext-0.0.7.4...
Installing RDoc documentation for unf_ext-0.0.7.4...
I cannot figure out the next step. I've tried installing ruby-dev and gcc, but neither has helped move this along :(
Any and all help is much appreciated!
I had this same problem and the reason was that I did not installed all the dependencies that bundler needs to run
just try to:
sudo apt-get install build-essential
then run again
gem install bundler
and lastly
bundler
There is a difference between running commands with sudo and without. You can get more info about this command here https://kb.iu.edu/d/amyi.
Errno::EACCES usually happens when bunder has no access to a needed folder or it doesn't exist.
Try to gem install unf_ext -v '0.0.7.4' --source 'https://rubygems.org/' without sudo.
I had same issue on Fedora.
I simply had to install the gcc-c++ package.
I solved this error on Debian 10 buster in my ChromeOS Linux container by installing rbenv: sudo aptitude install rbenv or sudo apt install rbenv.
Aptitude package manager seems to be better at resolving dependencies and allowing me to install newer packages more easily than the default apt so I thought it was worth mentioning.
Solved it after using following commands for Xcode 13, BigSur :
softwareupdate --install a
sudo port upgrade outdated
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install wget
brew install build-essentials
bundler install
If you are an iOS developer who is getting this error, this might be related to your Xcode command line tools selection.
Just run the following command with the path of the Xcode that you are using currently.
sudo xcode-select --switch /Applications/Xcode.app
You need to use the latest version of Ruby.
If you are using MacOS, system Ruby is old and outdated. you can not update the system Ruby, but you can install another version of Ruby and make it default global using rbenv ruby version manager tool.
finally you can install any ruby packages you like.

Getting Errorno-EACCES error while installing Rails on ubuntu

I successfully installed ruby on my Ubuntu server by using the following command.
1-sudo apt-get install python-software-properties
2-sudo apt-add-repository ppa:brightbox/ruby-ng
3-sudo apt-get update
4-sudo apt-get install ruby2.1
But when i tried to install Rails version 4.2.0 using the below command.
gem install rails --version=4.2.0
i got the following error.
Error:
Error:While executing gem (Errorno-EACCES)
permission denied # dir_s_mkdir - /var/lib/gems
Please help me to resolve this error and install rails successfully.I also have another doubt here.After installing ruby when i chcked the version it is showing me the ruby version 2.1.7 but here i need ruby version 2.1.5.Please also help me do this.I am using Ubuntu 14.0 version.
The issue might be because the gem executable is not installed in user directory.
You can confirm this using which gem.
Run this command for installing rails.
sudo gem install rails --version=4.2.0
UPDATE:
The error : Errror: Error installing rails Error: failed to build gem native extension might be because of lack of dev-headers.
Try running this :
sudo apt-get install ruby2.1-dev
These errors are the reasons you should probably try using rbenv or rvm to install ruby and rails.

Error in ruby: cannot load such file -- zlib

When I try to install rails in Ubuntu 12.10 I get this error:
$ gem install rails
ERROR: Loading command: install (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
So I completely removed rvm:
rvm implode
sudo rm -rf ~/.rvm
removed the script calls in my .bashrc and .bash_profile
and checked if they're really removed:
env | grep rvm #no output, so rvm is removed
ruby -v #The program 'ruby' can be found in the following packages: blabla
I already have these via sudo apt-get install:
curl zlib1g-dev zlib1g libssl-dev build-essential openssl libreadline6 libreadline6-dev curl git-core libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config
Then proceed to install from scratch
curl -L https://get.rvm.io | bash -s stable --ruby --auto-dotfiles
then run that line and restarted terminal regard to this message:
* To start using RVM you need to run `source /home/adige/.rvm/scripts/rvm`
in all your open shell windows, in rare cases you need to reopen all shell windows.
Then rvm pkg install readline but completed with error:
...
Error running 'autoreconf -is --force', please read /home/adige/.rvm/log/readline/autoreconf.log
...
Please note that it's required to reinstall all rubies:
rvm reinstall all --force
I think it's installed anyway, right? Before reinstall all rubies, I installed zlib of course:
# w/out verify, it gives checksum error
rvm pkg install zlib --verify-downloads 1
Then run rvm reinstall all --force and completed with error again:
...
Install of ruby-1.9.3-p374 - #complete
Making gemset ruby-1.9.3-p374 pristine.
Error running '' under ,
please read /home/adige/.rvm/log/ruby-1.9.3-p374/gemset.pristine.log
Making gemset ruby-1.9.3-p374#global pristine.
gemset.pristine.log
Then reinstall ruby with zlib support:
rvm reinstall 1.9.3-p374 --with-zlib-dir=$rvm_path/usr
which returned same error and same log but completed anyway.
Finally I tried to install rails gem again but cannot load such file -- zlib !
Here is the rvm info
What am I doing wrong?
You should not install readline / zlib on ubuntu, follow this steps:
rvm get head
rvm pkg remove
rvm requirements run force
rvm reinstall 1.9.3-p374
make sure to include output of the installation process if this fails, also include all mentioned log files

Failed to build gem native extension when install RedCloth-4.2.9 install Linux

I want to install Octopress in my computer.
I try to do it like
Octopress document.
When I run
bundle install
I got error message
An error occured while installing RedCloth (4.2.9), and Bundler cannot continue.
Make sure that `gem install RedCloth -v '4.2.9'` succeeds before bundling.
So, I run
sudo gem install RedCloth -v '4.2.9'
then, I got a error message again:
ERROR: Error installing RedCloth:
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:1:in `<main>'
I hadn't learn any knowledge about ruby.
My ubuntu 12.04 solution is install the ruby1.9.1-full version, that can resolve this issue.
sudo apt-get install ruby1.9.1-full
you can execute command:
sudo update-alternatives --config ruby
to select the altiernative ruby which you have installed.
and then, execute below commands to finish the octopress deploy:
git clone https://github.com/erizhang/octopress.git octopress
cd octopress/
sudo gem install bundler
sudo gem install RedCloth -v '4.2.9'
bundle install
rake install
below commands you can find from octopress deploy guideline page:
rake setup_github_pages
sudo rake setup_github_pages
sudo rake generate
sudo rake deploy
Hope it's helpful for you, thanks
I was installing Octopress too and got the same problem as yours. After checking the mkmf.log file I figured out that gcc-4.2 had not been found. I Even installed xcode with the command line tools. It worked when I made a symlink like this:
$ sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
$ bundle install
I fixed this issue by running
sudo apt-get install ruby-dev
as described in this blog post.
You've probably upgraded to Mountain Lion and have not rebuilt your ruby-1.9.2 install yet with the new development packages.
rvm --force install 1.9.2
gem install bundle --no-ri --no-rdoc
bundle install
If you don't have the Mountain Lion dev packages installed correctly, use the ThoughtBot instructions.
For Ubuntu 14.04 simply do this:
sudo apt-get install ruby1.9.3
Should work for 13.10 and 13.04 too. (Not tested)
it apears you are not using rvm for managing your ruby installation. I think best would be to try rvm, here's a very good guide, you can stop without installing rails: ruby with rvm
Then simply
$gem install RedCloth
Unmanaged ruby gems are a pain, I try to avoid them.
None of the answers worked on my Ubuntu 14.04.1 LTS. Upgrade to ruby 2.0 fixed the problem for me:
sudo apt-get install ruby2.0 ruby2.0-dev
sudo ln -s /usr/bin/ruby2.0 /usr/bin/ruby
sudo ln -s /usr/bin/gem2.0 /usr/bin/gem
sudo gem install bundler
Make sure you also have the build-essential package installed. You can check using
dpkg -l | grep build-essential
or simply install it without checking
sudo apt-get install build-essential
For me on Ubuntu 14.04.1 LTS, after making sure build-essential is installed, the bundle install command works/builds fine also with Ruby 1.9.3.

Installing OpenSSL on Ubuntu for Rails development?

I am running the latest RVM on Ubuntu 10.10 and I managed to get most of the development environment running, except for OpenSSL.
When I try to install the package I get the following error:
$ rvm package install openssl > error
ERROR: Error running 'tar zxf /home/ruby/.rvm/archives/openssl-0.9.8n.tar.gz -C
/home/ruby/.rvm/src', please read /home/ruby/.rvm/log/openssl/extract.log
ERROR: Error running './config -I/home/ruby/.rvm/usr/include -L/home/ruby/.rvm
/usr/lib
--prefix=/home/ruby/.rvm/usr zlib no-asm no-krb5 shared ', please read /home/ruby
/.rvm/log/openssl/configure.log
ERROR: Error running '/usr/bin/make ', please read /home/ruby/.rvm/log/openssl/make.log
ERROR: Error running '/usr/bin/make install', please read /home/ruby/.rvm/log/openssl
/make.install.log
It seems that the original downloaded file is corrupt when I get it via RVM. So, I downloaded and unpacked it to ~/.rvm/src/openssl0.9.8 and the first error is gone (error running tar zxf), but I still get the other ones.
Edit: my Ruby version, if anyone cares, is:
$ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]
Did you run rvm requirements after installing RVM? It shows a list of all needed dependencies, and supplies the recommended "apt-get" command.
/usr/bin/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
This will install openssl and libssl-dev, both of which are required. I've installed RVM and Ruby many times on Ubuntu and always used RVM's recommended way without a problem.
Do you have libssl installed in Ubuntu?
sudo apt-get install libssl0.9.8
Also install the development package:
sudo apt-get install libssl-dev

Resources