Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

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
    
share|improve this answer

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.

share|improve this answer
    
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. –  Patrick Gates Apr 20 '11 at 8:27
    
Well, do a search on sqlite and see what pops up –  wzzrd Apr 20 '11 at 8:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.