ERROR: Failed to > build gem native extension. - Can't install taps gem - ruby-on-rails

I cannot install the taps gem. I tried running:
sudo apt-get install libreadline-dev
sudo apt-get install libncurses-dev
cd ~/.rvm/src/ruby-1.9.2-p136/ext/readline
ruby extconf.rb
make
sudo make install
But I'm getting this error:
Building native extensions. This
could take a while... ERROR: Error
installing taps: ERROR: Failed to
build gem native extension.
~/.rvm/rubies/ruby-1.9.2-p136/bin/ruby
extconf.rb checking for sqlite3.h...
no sqlite3.h is missing. Try 'port
install sqlite3 +universal' or 'yum
install sqlite3-devel' and check your
shared library search path (the
location where your sqlite3 shared
library is located).
* extconf.rb failed *
Any idea what I did exactly/how to fix?

You need to install the SQLite3 package, with the development headers. On Ubuntu, this would be:
sudo apt-get install libsqlite3-dev

Related

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. Keep getting this message when running bundler install in VScode

I am trying to run a bundler install on vscode for windows, but every time I do, I keep getting the same message:
Fetching gem metadata from https://rubygems.org/.......
Resolving dependencies...
Using bundler 2.1.4
Fetching byebug 11.1.3
Installing byebug 11.1.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3/ext/byebug
/home/chadcunn/.rbenv/versions/2.7.1/bin/ruby -I /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/2.7.0 -r ./siteconf20200718-7409-qq2a6i.rb extconf.rb
creating Makefile
current directory: /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3/ext/byebug
make "DESTDIR=" clean
current directory: /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3/ext/byebug
make "DESTDIR="
compiling breakpoint.c
compiling byebug.c
compiling context.c
compiling locker.c
compiling threads.c
linking shared-object byebug/byebug.so
current directory: /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3/ext/byebug
make "DESTDIR=" install
/usr/bin/install -c -m 0755 byebug.so ./.gem.20200718-7409-z7mdim/byebug
Permission denied # rb_file_s_rename - (./.gem.20200718-7409-z7mdim/byebug,
/home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/byebug-11.1.3/byebug)
Gem files will remain installed in /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3 for inspection.
Results logged to /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/byebug-11.1.3/gem_make.out
An error occurred while installing byebug (11.1.3), and Bundler cannot continue.
Make sure that `gem install byebug -v '11.1.3' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
byebug
And then when I try to see if gem install byebug succeeds i get this response:
Building native extensions. This could take a while...
ERROR: Error installing byebug:
ERROR: Failed to build gem native extension.
current directory: /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3/ext/byebug
/home/chadcunn/.rbenv/versions/2.7.1/bin/ruby -I /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/2.7.0 -r ./siteconf20200718-7520-jpov6j.rb extconf.rb
creating Makefile
current directory: /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3/ext/byebug
make "DESTDIR=" clean
current directory: /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3/ext/byebug
make "DESTDIR="
compiling breakpoint.c
compiling byebug.c
compiling context.c
compiling locker.c
compiling threads.c
linking shared-object byebug/byebug.so
current directory: /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3/ext/byebug
make "DESTDIR=" install
/usr/bin/install -c -m 0755 byebug.so ./.gem.20200718-7520-b4jxqm/byebug
Permission denied # rb_file_s_rename - (./.gem.20200718-7520-b4jxqm/byebug, /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/byebug-11.1.3/byebug)
Gem files will remain installed in /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3 for inspection.
Results logged to /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/byebug-11.1.3/gem_make.out
I am not very experienced with coding or computers, I am actually now just trying to learn how to work within these programs, but I have no clue how to fix this or what to do.
Can anyone help me?
Your system is missing native packages to compile byebug etc. You need to install this and try again. e.g
apt-get update && apt-get install -y build-essential
Your system might be missing some ruby dependencies. The way I fixed this error on my Ubuntu based system was installing the ruby-dev package like this:
sudo apt update && sudo apt install ruby-dev
I am not so sure about window's systems, but I think problem is the same: missing dependencies. This link might be useful if you need more help: https://www.ruby-lang.org/en/documentation/installation/
Make sure that gem install byebug -v '11.1.3' --source 'https://rubygems.org/' succeeds before bundling.
So run gem install byebug -v '11.1.3' if the problem persists, try gem install byebug without specifying a version. Doing so, gem will search for the newest one.
However, if the problem persists, your ruby version 2.7.1 may not have support for this byebug version yet. On this case, try a stable ruby version, for now 2.6.5, 2.6.6, that is, all 2.6.x are stables at this moment.
After you succeed well running gem install byebug, run bundle install againg.
What helps me a lot with ruby and rails was taking a look on the official ruby web page. On there you'll see many links to how to use the appropriated ruby version and rails versions according to your Operation System.
These things are not shown to much on tutorials.
I solved by using below comments
sudo curl -L https://get.rvm.io | bash -s stable --ruby
Close & Reopen Terminal then
rvm use ruby-3.1.1
rvm --default use 3.1.1 
Finally,
sudo gem install cocoapods
I needed to set export BUNDLE_BUILD__SASSC=--disable-march-tune-native to workout around some compiling error in some SASS gem.
RUN
gem install bundler &&
gem install rake &&
wget -c https://github.com/wurmlab/sequenceserver/archive/1.1.0.beta12.tar.gz &&
tar xfvz 1.1.0.beta12.tar.gz &&
cd sequenceserver-1.1.0.beta12 &&
npm install -g
bundle install

Can't install Rails. ERROR: Error installing rails: ERROR: Failed to build gem native extension

I try to install rails
sudo gem install rails
But i have the error:
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.5.0/gems/nokogiri-1.10.5/ext/nokogiri
/usr/bin/ruby2.5 -I /usr/local/lib/site_ruby/2.5.0 -r ./siteconf20191108-7794-8cwt0o.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.5.0/gems/nokogiri-1.10.5 for inspection.
Results logged to /var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/nokogiri-1.10.5/gem_make.out
My OS is Linux.
How can i fix it error?
UPD.
I managed to put the rails 4 versions, but they can not be updated.
Try installing
sudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev libxml2-dev libxslt1-dev
Nokogiri needs to be compiled so needs some C definitions to work.
Do this first, install after that
sudo apt-get install zlib1g-dev liblzma-dev libxml2-dev libxslt1-dev

How to install gem pg and mysql2 in codenvy.io / goormide.io?

Log terminal:
user#c6b65b118139:/projects/rails-jafar$ gem install pg
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
current directory: /usr/local/bundle/gems/pg-1.1.4/ext
/usr/local/bin/ruby -r ./siteconf20190831-425-ife1vi.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** 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.
apt-get install libmysqlclient-dev
libmysqlclient-dev E: Could not open lock file /var/lib/dpkg/lock -
open (13: Permission denied) E: Unable to lock the administration
directory (/var/lib/dpkg/), are you root?
goorm.io
I solving with install libpq-dev
apt-get install libpq-dev
sudo apt-get update
sudo apt-get install mysql-client libmysqlclient-dev
gem install mysql2

How to install sqlite3 gem on EC2?

When I tried to:
sudo yum install ruby-devel sqlite3-devel
Amazon EC2 returns:
Loaded plugins: fastestmirror, priorities, security
Loading mirror speeds from cached hostfile
Setting up Install Process
Package ruby-devel-1.8.7.330-1.5.amzn1.i686 already installed and latest version
No package sqlite3-devel available.
Nothing to do
Any help will be appreciated.
UPDATE:
sudo gem install sqlite3-ruby
returns
Building native extensions. This could take a while...
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite3-devel' and check your shared library search path (the
location where your sqlite3 shared library is located).
*** 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.
sudo yum install sqlite3-devel should be:
sudo yum install sqlite-devel
On my Ubuntu box, I installed the following two libraries, plus the gem, in the following order:
sudo apt-get install libsqlite3-dev
sudo apt-get install sqlite3 # this installs several tools, including the command-line utility
sudo gem install sqlite3-ruby # this is going to spit out a bunch of errors, but you may be able to ignore them

Error setting up Ruby on Rails

Following this guide, I'm attempting to set up Ruby on Rails using Amazon's EC2. For my instance I've selected "Basic 32-bit Amazon Linux AMI 2010.11.1 Beta". I have ruby, sqlite, and rubygems installed. I'm on step 3.3 of the linked guide which is to run the following command
bundle install
The result is the following. I'm sure I've just missed something, but I'm at a loss. Any suggestions?
Installing sqlite3 (1.3.3) with native extensions /usr/lib/ruby/site_ruby/1.8/rubygems /installer.rb:529:in `build_extensions': ERROR: Failed to build gem native extension (Gem::Installer::ExtensionBuildError)
/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/sqlite3-1.3.3 for inspection.
EDIT: Following the suggestion below to install ruby-devel, I now get this error in addition to the original one.
Installing sqlite3 (1.3.3) with native extensions /usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:529:in `build_extensions':
ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/usr/bin/ruby extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite3-devel' and check your shared library search path (the
location where your sqlite3 shared library is located).
But when I try to run
yum install sqlite-devel
I'm told:
Package sqlite-devel-3.6.20-1.6.amzn1.i386 already installed and latest version
Nothing to do
In addition to the packages above, mas sure you have gcc and make installed.
They are needed to build the gems you are installing in addition to the development libraries.
Try to install the libsqlite3-dev before
$ sudo apt-get install libsqlite3-dev
and retry to install the gem after
$ gem install sqlite3-ruby
This worked for me:
yum install ruby-devel
yum install sqlite-devel
NOT sqlite3-devel
Venturing a guess here, but you might be missing a few development packages. Try running:
yum install ruby-devel sqlite3-devel

Resources