Sqlite-ruby gem not building extension

Hi all

I am having troubles building the sqlite-ruby gem.
I don't think it is a gem problem, but a extconfig issue.

  % gem install sqlite-ruby -v 2.2.3
  Attempting local installation of 'sqlite-ruby'
  Local gem file not found: sqlite-ruby*.gem
  Attempting remote installation of 'sqlite-ruby'
  Select which gem to install for your platform (powerpc-darwin7.7.0)
   1. sqlite-ruby 2.2.3 (mswin32)
   2. sqlite-ruby 2.2.3 (ruby)
   3. Cancel installation
  > 2
  Building native extensions. This could take a while...
  ERROR: While executing gem ... (RuntimeError)
      ERROR: Failed to build gem native extension.
  Gem files will remain installed in
  /Users/jdf/local_ruby/ruby-1.8.2/lib/ruby/gems/1.8/gems/sqlite-ruby-2.2.3 for
  inspection.
    ruby extconf.rb install sqlite-ruby -v 2.2.3\nchecking for main() in
  -lsqlite... no
  checking for sqlite.h... no

  Results logged to
  /Users/jdf/local_ruby/ruby-1.8.2/lib/ruby/gems/1.8/gems/sqlite-ruby-2.2.3/ext/gem_make.out

For some reason, it is not finding my sqlite library and include file.
I have them, and I have even set environment variables to locate them:

  % env | grep -i flag
  CFLAGS=-I/Users/jdf/local/include
  LDFLAGS=-L/Users/jdf/local/lib

  % ls /Users/jdf/local/include/
  sqlite.h
  % ls /Users/jdf/local/lib
  libsqlite.0.8.6.dylib libsqlite.a libsqlite.la
  libsqlite.0.dylib libsqlite.dylib pkgconfig

The following should work, but does not:

  % cd /Users/jdf/local_ruby/ruby-1.8.2/lib/ruby/gems/1.8/gems/sqlite-ruby-2.2.3/ext
  % ruby extconf.rb
  checking for main() in -lsqlite... no
  checking for sqlite.h... no

Are there some tricks to get extconf to find my lib and include files?

···

--
Jim Freeze
Ruby: I can explain it to ya but I can't understand it fer ya.

--with-sqlite-dir=/Users/jdf/local

??

-a

···

On Fri, 13 May 2005, Jim Freeze wrote:

Hi all

I am having troubles building the sqlite-ruby gem.
I don't think it is a gem problem, but a extconfig issue.

% gem install sqlite-ruby -v 2.2.3
Attempting local installation of 'sqlite-ruby'
Local gem file not found: sqlite-ruby*.gem
Attempting remote installation of 'sqlite-ruby'
Select which gem to install for your platform (powerpc-darwin7.7.0)
  1. sqlite-ruby 2.2.3 (mswin32)
  2. sqlite-ruby 2.2.3 (ruby)
  3. Cancel installation
> 2
Building native extensions. This could take a while...
ERROR: While executing gem ... (RuntimeError)
     ERROR: Failed to build gem native extension.
Gem files will remain installed in
/Users/jdf/local_ruby/ruby-1.8.2/lib/ruby/gems/1.8/gems/sqlite-ruby-2.2.3 for
inspection.
   ruby extconf.rb install sqlite-ruby -v 2.2.3\nchecking for main() in
-lsqlite... no
checking for sqlite.h... no

Results logged to
/Users/jdf/local_ruby/ruby-1.8.2/lib/ruby/gems/1.8/gems/sqlite-ruby-2.2.3/ext/gem_make.out

For some reason, it is not finding my sqlite library and include file.
I have them, and I have even set environment variables to locate them:

% env | grep -i flag
CFLAGS=-I/Users/jdf/local/include
LDFLAGS=-L/Users/jdf/local/lib

% ls /Users/jdf/local/include/
sqlite.h
% ls /Users/jdf/local/lib
libsqlite.0.8.6.dylib libsqlite.a libsqlite.la
libsqlite.0.dylib libsqlite.dylib pkgconfig

The following should work, but does not:

% cd /Users/jdf/local_ruby/ruby-1.8.2/lib/ruby/gems/1.8/gems/sqlite-ruby-2.2.3/ext
% ruby extconf.rb
checking for main() in -lsqlite... no
checking for sqlite.h... no

Are there some tricks to get extconf to find my lib and include files?

--

email :: ara [dot] t [dot] howard [at] noaa [dot] gov
phone :: 303.497.6469
renunciation is not getting rid of the things of this world, but accepting
that they pass away. --aitken roshi

===============================================================================

Jim Freeze a écrit :

Hi all

I am having troubles building the sqlite-ruby gem.
I don't think it is a gem problem, but a extconfig issue.

  % gem install sqlite-ruby -v 2.2.3

....
On a parallel note, be aware that many people having tried to use SQLite3 with RoR have at some point given up.
After a good start, I had an issue with the usage of quotes around
columns name. Sometimes they were OK, sometimes they seemed missing.
I met that issue when I started using a Table.find_by_column call but couldn't make it work. The same code worked like a treat with MySQL, which unfortunately was over-dimensioned for my little hack (where SQLite would have been perfect).
Before using such constructs, the adapter behaved as expected. So your mileage may vary ...
J-P

* Ara.T.Howard@noaa.gov <Ara.T.Howard@noaa.gov> [2005-05-13 01:35:28 +0900]:

> % cd
> /Users/jdf/local_ruby/ruby-1.8.2/lib/ruby/gems/1.8/gems/sqlite-ruby-2.2.3/ext
> % ruby extconf.rb
> checking for main() in -lsqlite... no
> checking for sqlite.h... no
>
>Are there some tricks to get extconf to find my lib and include files?

--with-sqlite-dir=/Users/jdf/local

Wow, thanks.

  % ruby extconf.rb --with-sqlite-dir=/Users/jdf/local
  checking for main() in -lsqlite... yes
  checking for sqlite.h... yes
  checking for sqlite_open() in -lsqlite... yes
  creating Makefile

How do I get rubygems to do this? Chad, Jim, anyone??

···

On Fri, 13 May 2005, Jim Freeze wrote:

--
Jim Freeze
Ruby: I can explain it to ya but I can't understand it fer ya.

gem install sqlite-ruby -v 2.2.3 -- --with-sqlite-dir=/Users/jdf/local

Uses the double dash separate similar to the old startx script with X.

···

On 5/12/05, Jim Freeze <jim@freeze.org> wrote:

* Ara.T.Howard@noaa.gov <Ara.T.Howard@noaa.gov> [2005-05-13 01:35:28 +0900]:

> On Fri, 13 May 2005, Jim Freeze wrote:

> > % cd
> > /Users/jdf/local_ruby/ruby-1.8.2/lib/ruby/gems/1.8/gems/sqlite-ruby-2.2.3/ext
> > % ruby extconf.rb
> > checking for main() in -lsqlite... no
> > checking for sqlite.h... no
> >
> >Are there some tricks to get extconf to find my lib and include files?
>
> --with-sqlite-dir=/Users/jdf/local

Wow, thanks.

  % ruby extconf.rb --with-sqlite-dir=/Users/jdf/local
  checking for main() in -lsqlite... yes
  checking for sqlite.h... yes
  checking for sqlite_open() in -lsqlite... yes
  creating Makefile

How do I get rubygems to do this? Chad, Jim, anyone??

--
Jim Freeze
Ruby: I can explain it to ya but I can't understand it fer ya.

--

Chad Fowler
http://chadfowler.com

http://rubygems.rubyforge.org (over 300,000 gems served!)

thank you for that hint! has the gem team thought about rescuing unknown opts
and just putting them back into the command line?

eg:

   begin
     op.parse! ARGV
   rescue OptionParser::InvalidOption => e
     # preverve unknown options
     e.recover ARGV
   end

and then you could

   gem install sqlite-ruby -v 2.2.3 --with-sqlite-dir=3D/Users/jdf/local

??

-a

···

On Fri, 13 May 2005, Chad Fowler wrote:

gem install sqlite-ruby -v 2.2.3 -- --with-sqlite-dir=3D/Users/jdf/local

Uses the double dash separate similar to the old startx script with X.

--

email :: ara [dot] t [dot] howard [at] noaa [dot] gov
phone :: 303.497.6469
renunciation is not getting rid of the things of this world, but accepting
that they pass away. --aitken roshi

===============================================================================

Cool idea! Thanks!

···

On 5/12/05, Ara.T.Howard@noaa.gov <Ara.T.Howard@noaa.gov> wrote:

On Fri, 13 May 2005, Chad Fowler wrote:

> gem install sqlite-ruby -v 2.2.3 -- --with-sqlite-dir=3D/Users/jdf/local
>
> Uses the double dash separate similar to the old startx script with X.

thank you for that hint! has the gem team thought about rescuing unknown opts
and just putting them back into the command line?

eg:

   begin
     op.parse! ARGV
   rescue OptionParser::InvalidOption => e
     # preverve unknown options
     e.recover ARGV
   end

and then you could

   gem install sqlite-ruby -v 2.2.3 --with-sqlite-dir=3D/Users/jdf/local

??

--

Chad Fowler
http://chadfowler.com

http://rubygems.rubyforge.org (over 300,000 gems served!)