0

I'm trying to install sqlite3-ruby gem (or as it's now called, simply sqlite3) and whenever I run

gem install sqlite3

it spits this out

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

/usr/bin/ruby1.8 extconf.rb checking
for sqlite3.h... yes checking for
sqlite3_libversion_number() in
-lsqlite3... yes checking for rb_proc_arity()... no checking for
sqlite3_initialize()... yes checking
for sqlite3_next_stmt()... yes
checking for sqlite3_backup_init()...
yes checking for
sqlite3_column_database_name()... no
checking for
sqlite3_enable_load_extension()... yes
checking for
sqlite3_load_extension()... yes
creating Makefile

make cc -I. -I.
-I/usr/lib/ruby/1.8/x86_64-linux -I. -DHAVE_SQLITE3_INITIALIZE -DHAVE_SQLITE3_NEXT_STMT -DHAVE_SQLITE3_BACKUP_INIT -DHAVE_SQLITE3_ENABLE_LOAD_EXTENSION -DHAVE_SQLITE3_LOAD_EXTENSION -I/usr/local/include -I/opt/local/include -I/sw/local/include -I/usr/include -fPIC -fno-strict-aliasing -g -g -O2 -fPIC -c statement.c In file included from ./sqlite3_ruby.h:42, from statement.c:1: ./backup.h:7: error: expected specifier-qualifier-list before
'sqlite3_backup' make: ***
[statement.o] Error 1

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

Here's my system specs:
Debian Lenny server
Ruby 1.8.7
Rails 3.0.0
Passenger 3.0.7
Sqlite3 3.7.6.2
rubygems 1.3.7

Thank you so much

2 Answers 2

1

I needed to enable SQLITE_ENABLE_COLUMN_METADATA during compile. Found a nice tutorial here

  1. Download and Extract sqlite source code.
  2. Open sqlite.c file and find these lines

    #ifndef SQLITE_API
    # define SQLITE_API
    #endif
    

    add this line below it

    #define SQLITE_ENABLE_COLUMN_METADATA
    
  3. Compile and install

    ./configure
    make
    make check
    sudo make install #You need to run 'make install' as root or with sudo...
    sudo make clean
    
0

I expect you will need to install either or both of ruby-dev(el) and sqlite3-dev(el). It's -dev on Debian-like systems and -devel on Red Hat-like systems.

2
  • I already have ruby-dev installed. When I try apt-get install sqlite3-dev it responds "Couldn't find package sqlite3-dev" I also tried devel, and it didn't work. Apr 20, 2011 at 8:27
  • Well, do a search on sqlite and see what pops up
    – wzzrd
    Apr 20, 2011 at 8:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .