Rvm, rails and sqlite

i need to use old version of ruby (1.8.7) and older version of rails
(2.1.0) so i decided to use rvm. however since i’m somewhat new to ruby
and rails i’m having issues. i created a gemset with rvm for my project,
installed rails 2.1.0 into it. after that i created a project and a
scaffolding for it. however i bumped onto an issue with sqlite3 (or
sqlite3-ruby). it seems to me that sqlite3-ruby gem is not installed. i
tried installing it using

gem install sqlite3-rub

but here is what i’m getting

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

/home/cyboman/.rvm/rubies/ruby-1.8.7-p302/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.

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=/home/cyboman/.rvm/rubies/ruby-1.8.7-p302/bin/ruby
–with-sqlite3-dir
–without-sqlite3-dir
–with-sqlite3-include
–without-sqlite3-include=${sqlite3-dir}/include
–with-sqlite3-lib
–without-sqlite3-lib=${sqlite3-dir}/lib

i tried searching online but the solutions either don’t fit my needs or
they don’t work.

any help would be greatly appreciated

Rail S. wrote in post #970103:

i need to use old version of ruby (1.8.7) and older version of rails
(2.1.0)

First question: why do you need to do that?

so i decided to use rvm.

Good choice.

however since i’m somewhat new to ruby
and rails i’m having issues. i created a gemset with rvm for my project,
installed rails 2.1.0 into it. after that i created a project and a
scaffolding for it. however i bumped onto an issue with sqlite3 (or
sqlite3-ruby). it seems to me that sqlite3-ruby gem is not installed.

Why does it seem that way? What is your basis for believing this?

i
tried installing it using

gem install sqlite3-rub

but here is what i’m getting

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

/home/cyboman/.rvm/rubies/ruby-1.8.7-p302/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).

And did you follow these instructions?

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Rail S. wrote in post #970103:

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

/home/cyboman/.rvm/rubies/ruby-1.8.7-p302/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.

On which Operating System are you working? Useful to mention
in such cases of OS dependent installation problems.

In case it would be a Debian derived GNU/Linux box (e.g. Ubuntu),
my standard approach is this:

  • almost always, it is the xxxx-dev package you are missing
  • find the context with apt-cache search ‘xxxx*’ | grep dev
  • then check if installed (with dpkg -l ‘xxxx*’)
  • then check which files are in there (with dpkg -L )

So I found quickly that the sqlite3.h file (that you seem to
be missing), is in the package libsqlite3-dev (as expected actually).

The log of that is:

peterv@ASUS:/usr/lib$ apt-cache search ‘sqlite3*’ | grep dev
libsqlite0-dev - SQLite development files
libsqlite3-dev - SQLite 3 development files
libghc6-haskelldb-hdbc-sqlite3-dev - HaskellDB support for the HDBC
SQLite driver
libghc6-hdbc-sqlite3-dev - Sqlite v3 HDBC (Haskell Database
Connectivity) Driver for GHC
libghc6-hsql-dev - Multi-Database Interface System library for GHC6
libghc6-hsql-odbc-dev - UnixODBC driver of the HSQL library for GHC6
libghc6-hsql-sqlite3-dev - SQLite driver of the HSQL library for GHC6
libgnadecommon1-dev - GNat Ada Database Environment - subprograms common
to other GNADE packages
libgnadeodbc1-dev - GNat Ada Database Environment - ODBC programming
interface
libgnadesqlite3-1-dev - GNat Ada Database Environment - SQLite3
programming interface
libgopersist-1-dev - Serialisation and deserialisation of GObjects
(development files)
libhyena-cil-dev - set of utility libraries for the CLI - development
files
libkaya-sqlite3-dev - SQLite binding for kaya
liblua5.1-sql-sqlite3-dev - luasql development files for the Lua
language version 5.1
libpoco-dev - Development files for POCO - The C++ Portable Components
libspatialite-dev - Geospatial extension for SQLite - development files
libsqlite3-ocaml-dev - Embeddable SQL Database for OCaml Programs
libtntdb-dev - Development headers for tntdb
libvalhalla-dev - a tiny media scanner library – development files
libvalhalla-doc - developer documentation for libvalhalla
monodevelop-database - Database plugin for MonoDevelop
sqliteman - GUI tool for SQLite3 admin and developers alike
sqliteman-doc - GUI tool for SQLite3 admin and developers alike
sqlrelay-dev - SQL Relay C and C++ APIs

peterv@ASUS:/usr/lib$ dpkg -l libsqlite3-dev
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Description
++±===================-===================-======================================================
ii libsqlite3-dev 3.6.22-1 SQLite 3 development files

peterv@ASUS:/usr/lib$ dpkg -L libsqlite3-dev
/.
/usr
/usr/include
/usr/include/sqlite3.h #### here it is :slight_smile:
/usr/include/sqlite3ext.h
/usr/lib
/usr/lib/libsqlite3.a
/usr/lib/libsqlite3.la
/usr/lib/pkgconfig
/usr/lib/pkgconfig/sqlite3.pc
/usr/share
/usr/share/doc
/usr/share/doc/libsqlite3-dev
/usr/share/doc/libsqlite3-dev/copyright
/usr/lib/libsqlite3.so
/usr/share/doc/libsqlite3-dev/README
/usr/share/doc/libsqlite3-dev/changelog.Debian.gz

HTH,

Peter

peter thanks for the help. it turns out i needed to run

rvm notes

and there was a list of packages i need to install to successfully work
with rvm

after that i ran

sudo apt-get and everything started working

your solution was similar to what i have done

Hello Rail!

I would use this method:

  • check RVM, set all thing you need, see also this part
    http://rvm.beginrescueend.com/gemsets/basics/
  • is sqlite installed? is it running?
  • check if needed Ruby version installed and if you can switch,
  • gem version you need,
  • particular gem you need - this case sqlite3-ruby,
  • rails version you need,
  • finally .yaml

Important: If you’re on Unix, do NOT use ‘sudo’ when istalling a gem!
(And always pay attention which gem and which Rails do you intall with
a Ruby version.)

If you have further problems, it is almost surely because of old gem.
Others wrote on mailing list before that if nothing else worked, they
uninstalled then reinstalled their gem, after that it worked fine.
Please check answers before in this mailing lists, I met with these
questions several times. (Or you can write me in private also, I had
so long struggle with this.)

If you have still problem can you list me here your:
OS, rvm -v, ruby -v, rvm list, gem -v, gem list, rvm gemset list,
please. Good luck,
Zoltan

zoltan,

thanks for help. i solved the problem by doing the following:

rvm notes

returns a list of modules that needed to be installed on linux. after
that i

gem install sqlite3-ruby

and everything worked fine.