Vagrant Failed to Build Gem Native Extension - ruby

I'm running Vagrant 1.8.1 on OSX 10.11.3 and I'm trying to install a plugin. While attempting to install I get the following the error:
vagrant plugin install vagrant-libvirt
............
An error occurred while installing ruby-libvirt (0.6.0), and Bundler cannot continue.
Make sure that `gem install ruby-libvirt -v '0.6.0'` succeeds before bundling.
.........
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
ruby-livirt 0.6.0 has already been installed:
# gem list | grep ruby-libvirt
# ruby-libvirt (0.6.0)
Can I bypass this error since the gem is already installed?

I had the same error while installing vagrant plugin install vagrant-libvirt it turned out that I was missing some libraries.
After installing below libraries on Ubuntu 16.04 I was able successfully install vagrant-libvirt plugin with vagrant plugin install command.
bridge-utils
build-dep
dnsmasq-base
ebtables
libguestfs-tools
libvirt-bin
libvirt-dev
libxml2-dev
libxslt-dev
qemu
qemu-kvm
ruby-dev
ruby-libvirt
virt-top
virtinst zlib1g-dev
Depends on your Linux distribution you might look at this link to find matching libraries.

Related

Failed to install dependecies on ubuntu

I want to install HospitalRun on a Ubuntu 20.04.3 LTS [HospitalRun Link][1]. I cloned the github and when I try the command bundle install I get the following error:
An error occurred while installing eventmachine (1.2.7), and Bundler cannot continue.
Make sure that `gem install eventmachine -v '1.2.7' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
jekyll-archives was resolved to 2.2.1, which depends on
jekyll was resolved to 3.9.1, which depends on
em-websocket was resolved to 0.5.2, which depends on
eventmachine
Can someone please help me what I am doing wrong?
You're probably missing the ruby-dev package needed to compile the native extension for eventmache.
sudo apt-get update
sudo apt-get install ruby-dev

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.

Error on installing gem Nokogiri-1.8.4

OS: AMI 2018.03.0 (HVM)
Ruby version: 2.3.7p456 (2018-03-28 revision 63024) [x86_64-linux-gnu] - installed using yum install ruby23
gem install nokogiri throws:
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
current directory: /home/ec2-user/.gem/ruby/2.3/gems/nokogiri-
1.8.4/ext/nokogiri
/usr/bin/ruby2.3 -r ./siteconf20180801-6218-101te4s.rb extconf.rb
mkmf.rb can't find header files for ruby at
/usr/share/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /home/ec2-
user/.gem/ruby/2.3/gems/nokogiri-1.8.4 for inspection.
Results logged to /home/ec2-user/.gem/ruby/2.3/extensions/x86_64-
linux/2.3/nokogiri-1.8.4/gem_make.out
what am i missing here?
From the error output, it would seem it can't find the development dependencies for Ruby, which Nokogiri is trying to use in order to build the gem natively.
You can run yum -y install gcc ruby-devel rubygems to make certain the dependencies are installed.
Basing my answer somewhat from https://stackoverflow.com/a/4502672/1129980
Update
Tested this now on a new EC2 instance:
yum install -y ruby23-devel gcc libxml2 libxml2-devel libxslt libxslt-devel patch
gem install nokogiri --no-ri --no-rdoc
That works :)
Try running the below mentioned commands
sudo yum -y install ruby-dev ( or ruby-devel)
sudo yum -y install libgmp-dev libgmpxx4ldbl ruby-dev ruby2.3-dev

Installing libssl-dev on ubuntu for ruby 2.0

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

Failed to build gem native extension

I want to install in my Fedora 12 based planet lab nodes one OMF RC:
It requres ruby 1.9.3. So, I installed git, then ruby-devel then rvm. With rvm i installed:
rvm install 1.9.3
After all this when i want to install:
gem install omf_rc --pre --no-ri --no-rdoc
It gives me the following error:
Building native extensions. This could take a while...
ERROR: Error installing omf_rc:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for libxml/parser.h... * extconf.rb failed *
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers
Please let me know how to solve this. Thanks
seems you need to install libxml, try:
sudo yum install -y gcc ruby-devel libxml2 libxml2-devel libxslt libxslt-devel
Also it needs the following installation:
sudo yum install -y git make gcc-c++
and
sudo yum groupinstall development-tools development-libs

Resources