sqlite3-ruby install error on Ubuntu
Asked Answered
C

19

263

I have the following error during sqlite3-ruby install:

Building native extensions.  This could take a while...
ERROR:  Error installing sqlite3-ruby:
    ERROR: Failed to build gem native extension.

/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'
*** 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:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/bin/ruby1.8
    --with-sqlite3-dir
    --without-sqlite3-dir
    --with-sqlite3-include
    --without-sqlite3-include=${sqlite3-dir}/include
    --with-sqlite3-lib
    --without-sqlite3-lib=${sqlite3-dir}/lib


Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.3.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.3.1/ext/sqlite3/gem_make.out

sqlite3.h is located in /usr/include/

sudo gem install sqlite3-ruby --without-sqlite3-include=/usr/include

doesn't work


ERROR:  While executing gem ... (OptionParser::InvalidOption)
    invalid option: --without-sqlite3-include=/usr/include

Ubuntu 10.04

Catgut answered 11/8, 2010 at 13:11 Comment(4)
same issue - this is not answered. sqlite3.h is non-existent and all the above packages are installed. ubunut 10.10Braddy
Try to sudo apt-get install build-essential and then sudo gem install sqlite3-rubyCatgut
it has since changed to just sqlite3, not sqlite3-rubyAnastomosis
Worked for me on ubuntu 12.04 as marshluca suggested. sudo apt-get install libsqlite3-devGrandiloquent
C
598

You need the SQLite3 development headers for the gem’s native extension to compile against. You can install them by running (possibly with sudo):

apt-get install libsqlite3-dev
Coact answered 11/8, 2010 at 13:12 Comment(2)
I needed sudo apt-get install libsqlite3-dev . Thanks.Gyimah
Thanks—this definitely would not have been obvious.Source
F
16

You just need a -- in there.

sudo gem install sqlite3-ruby -- --with-sqlite3-include=/usr/include

That specifies that the option is not to gem directly, but the specific gem.

Flong answered 11/8, 2010 at 13:17 Comment(0)
C
10

In my case I have no basic compilers installed, so

sudo apt-get install build-essential

solved my problem, but for most the people I think https://mcmap.net/q/108985/-sqlite3-ruby-install-error-on-ubuntu is the solution.

Catgut answered 12/8, 2010 at 7:0 Comment(1)
This was my problem. Thanks.Cot
B
7

This is what I did:

wget http://www.sqlite.org/sqlite-amalgamation-3.7.2.tar.gz
tar xzf sqlite-amalgamation-3.7.2.tar.gz
cd sqlite-3.7.2/

./configure
make
make install

gem install rails sqlite3-ruby

from : http://cuasan.wordpress.com/2010/10/13/rails-3-on-debian-with-sqlite-3/

Bushore answered 31/5, 2011 at 19:0 Comment(1)
This still works 10 years later! Thanks!Hosiery
R
6

If you run in ubuntu,and using RVM for ruby on rails,please add FIRST:

sudo apt-get install libxslt-dev libxml2-dev

OR You can check with these commands:

This command will prepare for you two packages : sqllite3 and libsqlite3-dev

sudo apt-get install sqlite3 libsqlite3-dev

-Now,install sqlite gem

 [sudo] gem install sqlite3-ruby

-using Ubuntu doesn't need sudo.

Goodluck! Note: i'm using Ubuntu 10.10 and it's working.

Rodger answered 27/10, 2010 at 12:45 Comment(0)
S
6

This was simply enough to make it work

sudo apt-get install libsqlite3-dev

Thanks to marshluca

Seattle answered 6/1, 2012 at 22:29 Comment(0)
S
4

Tried ALL of other solutions, none helped.

It turned out that you also need dev package for ruby itself. For me, it helped

sudo apt-get install ruby-full

It has a lot of nasty dependencies though (like emacs, wtf?), just

sudo apt-get install ruby1.8-dev

should be fine. After it's installed (and you have the sqlite and sqlite-dev packages installed)

sudo gem install sqlite3-ruby

works like a charm.

Seer answered 13/12, 2010 at 20:43 Comment(1)
worked for me too. sudo apt-get install ruby1.9.1-dev libsqlite3-devHajj
C
2

From sqlite3-ruby gem can't find sqlite3.h on ubuntu:

You also need to install gcc itself, so in total it would be:

sudo apt-get install gcc libsqlite3-dev ruby1.8-dev
sudo gem install sqlite3

Apparently you get a wrong error pointing to a missing sqlite3.h when the actual problem is missing gcc itself.

Collinear answered 21/3, 2011 at 13:31 Comment(0)
V
2

Here's a better answer from HEROKU - cannot run git push heroku master

Since you can't use sqlite3 on heroku add this to your Gemfile:

group :production do
  gem 'pg'
end
group :development, :test do
  gem 'sqlite3'
end
Voigt answered 22/3, 2013 at 3:10 Comment(0)
H
2

The solution is to add -- to separate configure parameters from gem parameters.

instead of

sudo gem install sqlite3-ruby --without-sqlite3-include=/usr/include

try this, all on one line, make sure to include -- after the last gem parameter and before configure parameters:

sudo gem install sqlite3 --
--with-sqlite3-lib=/somewhere/local/lib
--with-sqlite3-include=/somewhere/local/include

This should get you around this error:

ERROR:  While executing gem ... (OptionParser::InvalidOption)
    invalid option: --without-sqlite3-include=/usr/include
Hardtack answered 18/7, 2013 at 5:12 Comment(1)
This was exactly what I needed - big thanks to this submitter!Parthenos
I
1

Had this same problem and the following worked for me:

compile sqlite3 as static library, install somewhere in your home directory and then provide that option for the gem install process.

Go to the download page and grab the source. Most recent version at this time is http://www.sqlite.org/sqlite-autoconf-3070400.tar.gz

tar -xf on the file or do whatever you normally do to uncompress; enter directory

./configure --disable-shared --enable-static --prefix=/some/path/in/my/home

compile, install, and when you're installing the gem...

gem install sqlite3-ruby -- --with-sqlite3-dir=/some/path/in/my/home

Inhabitant answered 31/12, 2010 at 7:41 Comment(0)
B
1

None of the above mentioned solution worked for me, even after installing ruby2.5-dev and libsqlite3-dev. Then tried using PostgreSql instead of sqlite. That worked fine. To use PostgreSql instead of sqlite use this command when creating rails project.

rails [_VERSION_] new project_name -d postgresql

If you want to use MySql then use mysql instead of postgresql.

rails [_VERSION_] new project_name -d mysql

Else you can try without sqlite.

bundle install --without sqlite
Bellbird answered 1/6, 2018 at 19:46 Comment(0)
T
0

Not --without-sqlite3-include=/usr/include, but --with-sqlite3-include=/usr/include.

Thoracotomy answered 11/8, 2010 at 13:14 Comment(2)
If sqlite3.h is really missing and not in /usr/include as you said, then you can install it with: sudo apt-get install libsqlite3-devFlong
I have already done this.. It doesn't help. I have sqlite3 and libsqlite3-dev installed.Catgut
B
0

This is the exact same problem I had a few weeks ago. I found out I needed to download the most recent headers/libraries from the SQLite Download Page. Try it out, hope this helps!

Buhler answered 5/2, 2011 at 16:22 Comment(0)
L
0

For me the problem was solved by getting mkmf, which is in ruby1.8-dev.

sudo apt-get install ruby1.8-dev

Thanks to mentalized for that one.

Ladino answered 18/9, 2011 at 3:40 Comment(0)
N
0

I agree with Danya Vershinin & EnotionZ.

If can't use apt-get:

  1. compile & install sqlite3 from sources by specifying your own "prefix" path. More information can be found in the README.
  2. Then passed this path to the sqlite3-ruby installer (don't forget the "--").
Nipissing answered 13/6, 2013 at 10:2 Comment(0)
R
0

You have broken version of RVM. Ubuntu does something to RVM that produces lots of errors, the only safe way of fixing for now is to: sudo apt-get --purge remove ruby-rvm sudo rm -rf /usr/share/ruby … , if it does not help then restart your computer. install RVM: \curl -L https://get.rvm.io | bash -s stable --ruby --autolibs=enable --auto-dotfiles If you find you need some hand-holding, take a look at Installing Ruby on Ubuntu 12.04, which gives a bit more explanat

Ruvalcaba answered 17/9, 2014 at 11:34 Comment(0)
P
0

Forget everything and do this,

run

yum install ruby-devel sqlite sqlite-devel ruby-rdoc
yum install make gcc
gem install sqlite3-ruby
bundle install

That's for rhel, run same for ubuntu.

Photochemistry answered 10/11, 2016 at 7:32 Comment(0)
E
0

I just downgraded to sqlite3-ruby '1.2.2'

Eleneeleni answered 8/12, 2019 at 23:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.