How to install sqlite3 gem on EC2? - ruby-on-rails

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

Related

Chef Client Run gives 'Failed to build gem native Extension' while installing tiny_tds gem

My requirement is to use tiny_tds to connect to SQLServer Database as part of a chef client run which is running on Ubuntu OS. So, as part of this task, I have written a cookbook in which I have included the following line in the metadata.rb file:
gem 'tiny_tds'
This should install tiny_tds gem as per the chef documentation. But, I get an error saying 'Failed to build gem native Extension'. While some sites suggest on the issue being related to FreeTDS, the solutions are not clear enough to solve this issue.
Edit: Adding more info on the issue
I also tried manually installing freetds with the following commands:
sudo apt-get install wget
sudo apt-get install build-essential
sudo apt-get install libc6-dev
sudo wget http://www.freetds.org/files/stable/freetds-1.00.21.tar.gz
tar -xzf freetds-1.00.21.tar.gz
cd freetds-1.00.21
sudo ./configure --prefix=/usr/local --with-tdsver=7.3
sudo make
sudo make install
and then when I run the command
gem install tiny_tds
on the terminal, it successfully installs using native dependencies.
But the issue still exists when I do a chef client run with the command
sudo chef-client -o "recipe[tiny_tds_cookbook]"
StackTraces:
ERROR: Error installing tiny_tds:
ERROR: Failed to build gem native extension.
current directory: /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/tiny_tds-2.1.1/ext/tiny_tds
/opt/chef/embedded/bin/ruby -r ./siteconf20180121-23372-1r1mxpl.rb extconf.rb
checking for sybfront.h... yes
checking for sybdb.h... yes
checking for tdsdbopen() in -lsybdb... no
checking for dbanydatecrack() in -lsybdb... no
Failed! Do you have FreeTDS 0.95.80 or higher installed?
extconf.rb failed
You probably need to install either the compiler or the ruby development headers. We do not recommend using the gem metadata dependency system for gems that require C extensions as you would need to install the compiler before Chef starts, which is usually a thing Chef would do itself. For situations like this, the older chef_gem resource is generally better because you can use a cookbook like build-essential to install the compiler tools before installing the gem.

Gem installation ruby-audio-1.6.1 error(using Mac OS 10.9 / homebrew)

I tried other tips but didn't work. (see link below please)
ex.
Gem installation ruby-audio failing
ruby-audio 1.6.1 install error (with installed Libsndfile 1.0.25)
I want some feedback on this.
$ gem install ruby-audio<br>
Building native extensions. This could take a while...<br>
ERROR: Error installing ruby-audio:<br>
ERROR: Failed to build gem native extension.<br>
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
<br>
**checking for sndfile.h in /opt/local/include,/usr/local/include,C:/Program Files (x86)/Mega-Nerd/libsndfile/include,C:/Program Files/Mega-Nerd/libsndfile/include... yes<br>
checking for sf_open() in -lsndfile-1... no<br>
checking for sf_open() in -lsndfile... no<br>**<br>
*** extconf.rb failed ***<br>
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.<br>
<br>
Provided configuration options:<br>
--with-opt-dir<br>
--without-opt-dir<br>
--with-opt-include<br>
--without-opt-include=${opt-dir}/include<br>
--with-opt-lib<br>
--without-opt-lib=${opt-dir}/lib<br>
--with-make-prog<br>
--without-make-prog<br>
--srcdir=.<br>
--curdir<br>
--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby<br>
--with-sndfile-dir<br>
--without-sndfile-dir<br>
--with-sndfile-include<br>
--without-sndfile-include=${sndfile-dir}/include<br>
--with-sndfile-lib<br>
--without-sndfile-lib=${sndfile-dir}/<br>
--with-sndfile-1lib<br>
--without-sndfile-1lib<br>
--with-sndfilelib<br>
--without-sndfilelib<br><br>
**extconf.rb:21:in `<main>': Can't find libsndfile (http://www.mega-nerd.com/libsndfile/) (RuntimeError)**<br>
<br>
Try passing --with-sndfile-dir or --with-sndfile-lib and --with-sndfile-include<br>
options to extconf. If there are spaces in the path on windows, it may not work.<br>
<br>
<br>
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/ruby-audio-1.6.1 for inspection.<br>
Results logged to /Library/Ruby/Gems/2.0.0/gems/ruby-audio-1.6.1/ext/rubyaudio_ext/gem_make.out
You probably need to install libsndfile as a universal library - by default it doesn't compile a 32-bit slice, which is required for compatibility with the system ruby.
brew uninstall libsndfile
brew install libsndfile --universal
sudo gem install ruby-audio
For ubuntu (Ubuntu 18.04)
sudo apt-get update -y
sudo apt-get install -y libsndfile-dev

RoR install: Run 'bundle install' not working?

While trying to run a first project on Ubuntu 10.10 I got this:
antonio#antonio-desktop:~/Documents/tickets$./script/rails server
Could not find gem 'sqlite3 (>= 0)' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems.
Well, afterwards I write:
antonio#antonio-desktop:~/Documents/tickets$ bundle install
and get this in the middle of the installation process:
/usr/bin/ruby1.8 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.
So, I tried this:
sudo yum install sqlite3-devel
And got this:
Setting up Install Process
No package sqlite3-devel available.
Nothing to do
Why? I'm running Rails 3.1, btw.
try: sudo apt-get install libsqlite3-dev
Since you're using yum, I went ahead and guessed that you're on Fedora. I then Googled "fedora sqlite3" and found a blog post that recommends this:
sudo yum install sqlite-devel
Sounds like the gem doesn't have the package name quite right. Give this one a go :)

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

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

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