Error instaliling sqlite3. Failed to build gem native extension - ruby-on-rails

Everytime I try to install bundle I receive this error and I dont know what to do, I just update rails to 3.2.0. Im already on Ubuntu and my sqlite3 version is 3.37.2
I have tryed to uninstall sqlite3 and gem sqlite3-rails and then reinstall them, but nothing has change.
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
current directory: /home/computer/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/sqlite3-1.5.4/ext/sqlite3
/home/computer/.rbenv/versions/3.2.0/bin/ruby -I /home/computer/.rbenv/versions/3.2.0/lib/ruby/3.2.0 extconf.rb
Building sqlite3-ruby using packaged sqlite3.
Extracting sqlite-autoconf-3400000.tar.gz into tmp/x86_64-linux-gnu/ports/sqlite3/3.40.0... OK
Running 'configure' for sqlite3 3.40.0... OK
Running 'compile' for sqlite3 3.40.0... OK
Running 'install' for sqlite3 3.40.0... OK
Activating sqlite3 3.40.0 (from /home/computer/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/sqlite3-1.5.4/ports/x86_64-linux-gnu/sqlite3/3.40.0)...
Could not configure the build properly (pkg_config). Please install either the `pkg-config` utility or the `pkg-config` rubygem.
*** 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.
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/computer/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/extensions/x86_64-linux/3.2.0/sqlite3-1.5.4/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/computer/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/sqlite3-1.5.4 for inspection.
Results logged to /home/computer/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/extensions/x86_64-linux/3.2.0/sqlite3-1.5.4/gem_make.out```

I solved it installing pkg-config and then bundle install worked correctly
sudo apt-get update -y
sudo apt-get install -y pkg-config
bundle isntall

Related

Error Installing charlock_holmes on centos

I am trying to install charlock_holmes gem on centos but i keep on getting
Installing charlock_holmes 0.7.6 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/usr/local/rvm/gems/ruby-2.2.5/gems/charlock_holmes-
0.7.6/ext/charlock_holmes
/usr/local/rvm/rubies/ruby-2.2.5/bin/ruby -r ./siteconf20180607-1811-
1cbsady.rb
extconf.rb --with-icu-dir=C:UsersmadprogDesktopicusourcesdistusrlocal
--with-icui18nlib=icuin --with-icudatalib=icudt
checking for main() in -licuin... no
which: no brew in
(/usr/local/rvm/gems/ruby-2.2.5/bin:/usr/local/rvm/gems/ruby-
2.2.5#global/bin:/usr/local/rvm/rubies/ruby-
2.2.5/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/
rvm/bin:/root/bin)
checking for main() in -licuin... no
***** icu required (brew install icu4c or apt-get install libicu-dev)
*** 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.
To see why this extension failed to compile, please check the mkmf.log which
can be found here:
/usr/local/rvm/gems/ruby-2.2.5/extensions/x86_64-
linux/2.2.0/charlock_holmes-0.7.6/mkmf.log
extconf failed, exit code 1
An error occurred while installing charlock_holmes (0.7.6), and Bundler
cannot continue.
In Gemfile:
copyright-header was resolved to 1.0.22, which depends on
github-linguist was resolved to 6.2.0, which depends on
charlock_holmes
i also tried installing libicu-dev and this is what i get
no package libicu-dev available.
Error : nothing to do
please help, thank you.

gem install pg -v '0.17.1' not working for some reason

I'm trying to "bundle" by rails app in AWS EC2 Linux server. I'm getting this error for "pg" gem. Could someone help? Can't find solution.
This gem 'pg' has version of 0.17.1.
Ruby version is ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
$ gem install pg
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
current directory: /home/ec2-user/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/pg-0.21.0/ext
/home/ec2-user/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20180105-17661-1wdsn6j.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.
Provided configuration options:
--something something something
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/ec2-user/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/pg-0.21.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/ec2-user/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/pg-0.21.0 for inspection.
Results logged to /home/ec2-user/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/pg-0.21.0/gem_make.out
I had some problem same as you when i installed gem 'pg' on centos or ubuntu.
For centos, you can do this:
yum install postgresql-libs
yum install postgresql-devel
Then run gem install pg again.
On Ubuntu, I needed to run:
sudo apt-get install libpq-dev

Cannot get Ruby on Rails to work on Mac

Why is it so hard to get Ruby on Rails to work on a Mac? On Windows it is so easy but on my Mac, which I am now forced to use, it just doesn't want to play ball!
I cd into the project directory and run:
rails server
The the Terminal says:
You have requested:
sqlite3 >= 0
The bundle currently has sqlite3 locked at 1.3.10.
Try running `bundle update sqlite3`
Run `bundle install` to install missing gems.
So I run bundle update sqlite3 but then get:
*** 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.
...
An error occurred while installing debugger (1.6.8), and Bundler cannot
continue.
Make sure that `gem install debugger -v '1.6.8'` succeeds before bundling.
I then run gem install debugger -v '1.6.8'
Building native extensions. This could take a while...
ERROR: Error installing debugger:
ERROR: Failed to build gem native extension.
/Users/me/.rbenv/versions/2.1.5/bin/ruby extconf.rb
*** 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.
You didn't share the logs, but I suggest you to check/install Xcode command line tools, which you can do with:
xcode-select --install
Or by opening Xcode and installing them using GUI.

Error in installation of rmagick [in rails 2.3.5]

I was trying to install rmagick gem in rails 2.3.5 . but I could not install as it shows error. Same error comes in both rvm and system.
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
extconf.rb:153: undefined (?...) sequence: /^Version: ImageMagick\s+(?\d+.\d+.\d+-\d+)\s+(?\S+)\s+(?\S+)\s+(?\S+)/
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/rmagick-2.13.4 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/rmagick-2.13.4/ext/RMagick/gem_make.out
this was the error.
Already Installed imagemagick,libmagickwand-dev, libxml2-dev, libxslt-dev,libgraphics-magick-perl, libgraphicsmagick++1-dev, libgraphicsmagick++3, libgraphicsmagick1-dev, libgraphicsmagick3 (tried everything got from google)
Seems like v2.13.4 needs some extra stuff installed, simply not only install libs but also:
sudo apt-get install imagemagick
This fixed it for me.
FYI, I got the following error:
checking for ImageMagick version >= 6.4.9... *** 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.
If you don't need the very latest version, you could try:
gem install rmagick -v 2.13.3
And see if the previous one works for you.

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

Resources