[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

SQLite-Ruby and Cygwin: Problem and Solution

Erik Veenstra

1/25/2005 5:14:00 PM

I had a problem installing SQLite-Ruby under Cygwin. But we
solved the problem...

Installing SQLite (sqlite-2.8.15.tar.gz) itself was no problem:
"./configure ; make ; make install" worked, as expected.

Installing SQLite-Ruby with "gem install sqlite-ruby-2.2.2.gem"
didn't work. It couldn't find the header files or library or
whatever of SQLite, although SQLite itself (the command line
tool) worked on an existing database.

I added just one single line to ext/extconf.rb ('dir_config(
"sqlite", "/usr/local" )'), compiled the whole thing and build
the gem. This one was indeed installable!

If you encountered the same problem, here is the "script".

Maybe something for the sqlite-ruby maintainers to correct?

Thanks for this great library. I like it.

The combination of SQLite as back end, WXRuby or RubyWebDialogs
as front end and Ruby itself for the logic, gives us a 100%
platform agnostic way of building applications. We at least
cover Linux, Windows and Cygwin. I don't know anything about OS
X, Solaris or other systems.

Oh, by the way: Did I already mention that both SQLite and
WXRuby (and RubyWebDialogs, of course) are detected and
embedded by RubyScript2Exe?...

gegroet,
Erik V.

----------------------------------------------------------------

$ tar xzf sqlite-ruby-2.2.2.tar.gz

$ cd sqlite-ruby-2.2.2/

$ cd ext/

$ vi extconf.rb # !!! Add: dir_config( "sqlite", "/usr/local" ) !!!

$ ruby extconf.rb
checking for main() in -lsqlite... yes
checking for sqlite.h... yes
checking for sqlite_open() in -lsqlite... yes
creating Makefile

$ make
gcc -g -O2 -I. -I/usr/lib/ruby/1.8/i386-cygwin
-I/usr/lib/ruby/1.8/i386-cygwin -I. -DHAVE_SQLITE_H -I/usr/local/includ
e -c sqlite-api.c
gcc -shared -s -Wl,--enable-auto-import,--export-all
-L"/usr/local/lib" -L"/usr/lib" -o sqlite_api.so sqlite-api.o -lr
uby -lsqlite -lsqlite -lcrypt

$ cd ..

$ touch README

$ gem build sqlite-ruby.gemspec
Attempting to build gem spec 'sqlite-ruby.gemspec'
Successfully built RubyGem
Name: sqlite-ruby
Version: 2.2.2
File: sqlite-ruby-2.2.2.gem

$ gem install sqlite-ruby-2.2.2.gem
Attempting local installation of 'sqlite-ruby-2.2.2.gem'
Building native extensions. This could take a while...
ruby extconf.rb install sqlite-ruby-2.2.2.gem
checking for main() in -lsqlite... yes
checking for sqlite.h... yes
checking for sqlite_open() in -lsqlite... yes
creating Makefile

make
make: Nothing to be done for `all'.

make install
install -c -p -m 0755 sqlite_api.so
/usr/lib/ruby/gems/1.8/gems/sqlite-ruby-2.2.2/lib
Successfully installed sqlite-ruby, version 2.2.2
Installing RDoc documentation for sqlite-ruby-2.2.2...
----------------------------------------------------------------

9 Answers

Jamis Buck

1/25/2005 5:28:00 PM

0

On 02:15 Wed 26 Jan , Erik Veenstra wrote:
> I had a problem installing SQLite-Ruby under Cygwin. But we
> solved the problem...
>
> Installing SQLite (sqlite-2.8.15.tar.gz) itself was no problem:
> "./configure ; make ; make install" worked, as expected.
>
> Installing SQLite-Ruby with "gem install sqlite-ruby-2.2.2.gem"
> didn't work. It couldn't find the header files or library or
> whatever of SQLite, although SQLite itself (the command line
> tool) worked on an existing database.
>
> I added just one single line to ext/extconf.rb ('dir_config(
> "sqlite", "/usr/local" )'), compiled the whole thing and build
> the gem. This one was indeed installable!

Non-standard install locations are problematic for compiled gems (like
sqlite-ruby). If you installed by hand, you could easily specify the
necessary "--with-sqlite-lib" and "--with-sqlite-include" parameters
to the install script, but with gems..

Chad, Jim, et. al.: is there a way (or could there be a way) to allow
the gem command to take optional parameters that get passed through
directly to the extconf.rb script?

- Jamis

>
> If you encountered the same problem, here is the "script".
>
> Maybe something for the sqlite-ruby maintainers to correct?
>
> Thanks for this great library. I like it.
>
> The combination of SQLite as back end, WXRuby or RubyWebDialogs
> as front end and Ruby itself for the logic, gives us a 100%
> platform agnostic way of building applications. We at least
> cover Linux, Windows and Cygwin. I don't know anything about OS
> X, Solaris or other systems.
>
> Oh, by the way: Did I already mention that both SQLite and
> WXRuby (and RubyWebDialogs, of course) are detected and
> embedded by RubyScript2Exe?...
>
> gegroet,
> Erik V.
>
> ----------------------------------------------------------------
>
> $ tar xzf sqlite-ruby-2.2.2.tar.gz
>
> $ cd sqlite-ruby-2.2.2/
>
> $ cd ext/
>
> $ vi extconf.rb # !!! Add: dir_config( "sqlite", "/usr/local" ) !!!
>
> $ ruby extconf.rb
> checking for main() in -lsqlite... yes
> checking for sqlite.h... yes
> checking for sqlite_open() in -lsqlite... yes
> creating Makefile
>
> $ make
> gcc -g -O2 -I. -I/usr/lib/ruby/1.8/i386-cygwin
> -I/usr/lib/ruby/1.8/i386-cygwin -I. -DHAVE_SQLITE_H -I/usr/local/includ
> e -c sqlite-api.c
> gcc -shared -s -Wl,--enable-auto-import,--export-all
> -L"/usr/local/lib" -L"/usr/lib" -o sqlite_api.so sqlite-api.o -lr
> uby -lsqlite -lsqlite -lcrypt
>
> $ cd ..
>
> $ touch README
>
> $ gem build sqlite-ruby.gemspec
> Attempting to build gem spec 'sqlite-ruby.gemspec'
> Successfully built RubyGem
> Name: sqlite-ruby
> Version: 2.2.2
> File: sqlite-ruby-2.2.2.gem
>
> $ gem install sqlite-ruby-2.2.2.gem
> Attempting local installation of 'sqlite-ruby-2.2.2.gem'
> Building native extensions. This could take a while...
> ruby extconf.rb install sqlite-ruby-2.2.2.gem
> checking for main() in -lsqlite... yes
> checking for sqlite.h... yes
> checking for sqlite_open() in -lsqlite... yes
> creating Makefile
>
> make
> make: Nothing to be done for `all'.
>
> make install
> install -c -p -m 0755 sqlite_api.so
> /usr/lib/ruby/gems/1.8/gems/sqlite-ruby-2.2.2/lib
> Successfully installed sqlite-ruby, version 2.2.2
> Installing RDoc documentation for sqlite-ruby-2.2.2...
> ----------------------------------------------------------------
>
>
>

--
Jamis Buck
jamis_buck@byu.edu
http://jamis.jam...
------------------------------
"I am Victor of Borge. You will be assimil-nine-ed."



Erik Veenstra

1/25/2005 5:41:00 PM

0

> > I added just one single line to ext/extconf.rb
> > ('dir_config( "sqlite", "/usr/local" )'), compiled the
> > whole thing and build the gem. This one was indeed
> > installable!
>
> Non-standard install locations are problematic for compiled
> gems (like sqlite-ruby). If you installed by hand, you could
> easily specify the necessary "--with-sqlite-lib" and
> "--with-sqlite-include" parameters to the install script, but
> with gems..

Non-standard location? "/usr/local/bin" and "/usr/local/lib"
seem pretty standard to me... That's what SQLite decided to
use, anyway.

Thanks.

gegroet,
Erik V.

Jamis Buck

1/25/2005 6:24:00 PM

0

On 02:45 Wed 26 Jan , Erik Veenstra wrote:
> > > I added just one single line to ext/extconf.rb
> > > ('dir_config( "sqlite", "/usr/local" )'), compiled the
> > > whole thing and build the gem. This one was indeed
> > > installable!
> >
> > Non-standard install locations are problematic for compiled
> > gems (like sqlite-ruby). If you installed by hand, you could
> > easily specify the necessary "--with-sqlite-lib" and
> > "--with-sqlite-include" parameters to the install script, but
> > with gems..
>
> Non-standard location? "/usr/local/bin" and "/usr/local/lib"
> seem pretty standard to me... That's what SQLite decided to
> use, anyway.

As compared to "/usr/bin" and "/usr/lib", I meant. By default, that's
what the mkmf.rb lib uses. You can pass parameters to specify
otherwise (--with-sqlite-lib, etc) to extconf.rb, but not to the gem
utility. Yet. To my knowledge. :)

- Jamis

--
Jamis Buck
jamis_buck@byu.edu
http://jamis.jam...
------------------------------
"I am Victor of Borge. You will be assimil-nine-ed."



Jim Weirich

1/25/2005 6:32:00 PM

0


Jamis Buck said:
> Non-standard install locations are problematic for compiled gems (like
> sqlite-ruby). If you installed by hand, you could easily specify the
> necessary "--with-sqlite-lib" and "--with-sqlite-include" parameters
> to the install script, but with gems..
>
> Chad, Jim, et. al.: is there a way (or could there be a way) to allow
> the gem command to take optional parameters that get passed through
> directly to the extconf.rb script?

Just add the extconf.rb options to the gem install command after a "--".

See http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-t...

--
-- Jim Weirich jim@weirichhouse.org http://onest...
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)



Jamis Buck

1/25/2005 6:59:00 PM

0

On 03:32 Wed 26 Jan , Jim Weirich wrote:
>
> Jamis Buck said:
> > Non-standard install locations are problematic for compiled gems (like
> > sqlite-ruby). If you installed by hand, you could easily specify the
> > necessary "--with-sqlite-lib" and "--with-sqlite-include" parameters
> > to the install script, but with gems..
> >
> > Chad, Jim, et. al.: is there a way (or could there be a way) to allow
> > the gem command to take optional parameters that get passed through
> > directly to the extconf.rb script?
>
> Just add the extconf.rb options to the gem install command after a "--".
>
> See http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-t...

Wonderful! I should have known you gems guys would already have
figured this one out. :)

So, for future reference, if you are installing sqlite-ruby via gems
and you have sqlite installed in a location other than /usr, try:

gem install sqlite-ruby -- --with-sqlite-lib=/usr/local/lib
--with-sqlite-include=/usr/local/include

- Jamis

--
Jamis Buck
jamis_buck@byu.edu
http://jamis.jam...
------------------------------
"I am Victor of Borge. You will be assimil-nine-ed."



Erik Veenstra

1/25/2005 9:38:00 PM

0

> So, for future reference, if you are installing sqlite-ruby
> via gems and you have sqlite installed in a location other
> than /usr, try:
>
> gem install sqlite-ruby -- --with-sqlite-lib=/usr/local/lib
> --with-sqlite-include=/usr/local/include

Worked flawlessly on another machine!

I still thing that /usr/local/[bin,lib,include] are common
places for installing software and that they have to be used
automatically. I bet you have good reasons for not doing so...
Please, enlighten me!

Thanks.

gegroet,
Erik V.

Jamis Buck

1/25/2005 9:53:00 PM

0

On 06:40 Wed 26 Jan , Erik Veenstra wrote:
> > So, for future reference, if you are installing sqlite-ruby
> > via gems and you have sqlite installed in a location other
> > than /usr, try:
> >
> > gem install sqlite-ruby -- --with-sqlite-lib=/usr/local/lib
> > --with-sqlite-include=/usr/local/include
>
> Worked flawlessly on another machine!
>
> I still thing that /usr/local/[bin,lib,include] are common
> places for installing software and that they have to be used
> automatically. I bet you have good reasons for not doing so...
> Please, enlighten me!

No reason. I'm just arbitrary by nature. :)

Seriously, though, the reason it wasn't there already was because
(using Gentoo, as I do) things like sqlite on my machine get installed
into /usr/bin (etc.), and thus I've never had any problems with it.
And no one (until now) has reported problems.

So, assuming the change you recommended won't break *my* setup
(*grin*) I'll go ahead and make the change.

>
> Thanks.
>

No, thank YOU. :)

> gegroet,
> Erik V.

- Jamis

--
Jamis Buck
jamis_buck@byu.edu
http://jamis.jam...
------------------------------
"I am Victor of Borge. You will be assimil-nine-ed."



JayPee Vee

5/19/2010 7:38:00 AM

0

On 18 Mai, 02:36, "Bob" <n...@email.address> wrote:
> "Mr.B1ack" <b...@barrk.net> wrote in message
>
> news:pd4uu5lf9mdt0bipu6ovgnq9q5po44apl1@4ax.com...
>
>
>
>
>
> > "Bob" <n...@email.address> wrote:
>
> >>Auto Makers Say Timing of Changes is Unrealistic; Lawmakers Agree to
> >>Rethink
>
> >>WASHINGTON-Congressional Democrats may scale back some provisions of an
> >>auto-safety bill after car makers criticized the measure for mandating
> >>rapid
> >>and costly rollouts of new technology and eliminating their right to
> >>question government-imposed vehicle recalls.
>
> >>http://online.wsj.com/article/SB100014240527487044145045752......
>
> >   What good is an extra-safe car if you can't afford
> >   to buy it ???
>
> >   In truth, they ain't bad as is. Seems almost routine
> >   to see people walk away from horrific crashes that
> >   would have turned them into hamburger if they'd been
> >   driving a '57 Chevy.
>
> The point of my post was to show "hypocrisy", not the
> value of the legislation.-

Now, that's what I called irony!
Boycott boob, the hypocrite sack of shit accusing others of
hypocrisy...

Ever thought of doing stand-up comedy, boycott boob?
Obviously, you have a gift... and you don't know it!

liberal

5/19/2010 10:32:00 PM

0

On May 17, 5:03 pm, Mr.B1ack <b...@barrk.net> wrote:
> liberal <liberalh...@gmail.com> wrote:
> >On May 16, 9:53 am, Mr.B1ack <b...@barrk.net> wrote:
> >> "Bob" <n...@email.address> wrote:
> >> >"Mr.B1ack" <b...@barrk.net> wrote in message
> >> >news:pd4uu5lf9mdt0bipu6ovgnq9q5po44apl1@4ax.com...
> >> >> "Bob" <n...@email.address> wrote:
>
> >> >>>Auto Makers Say Timing of Changes is Unrealistic; Lawmakers Agree to
> >> >>>Rethink
>
> >> >>>WASHINGTON-Congressional Democrats may scale back some provisions of an
> >> >>>auto-safety bill after car makers criticized the measure for mandating
> >> >>>rapid
> >> >>>and costly rollouts of new technology and eliminating their right to
> >> >>>question government-imposed vehicle recalls.
>
> >> >>>http://online.wsj.com/article/SB100014240527487044145045752......
>
> >> >>   What good is an extra-safe car if you can't afford
> >> >>   to buy it ???
>
> >> >>   In truth, they ain't bad as is. Seems almost routine
> >> >>   to see people walk away from horrific crashes that
> >> >>   would have turned them into hamburger if they'd been
> >> >>   driving a '57 Chevy.
>
> >> >The point of my post was to show "hypocrisy", not the
> >> >value of the legislation.
>
> >>    Hypocricy, politics ... so what's new ?
>
> >>    I'd prefer a little utilitarian sensibility once
> >>    in a while. Over-priced "safer" cars are not what
> >>    America really needs right now. "Pretty safe" but
> >>    affordable is what we need.- Hide quoted text -
>
> >> - Show quoted text -
>
> >However, the problem is knowing what the safety price delta really is,
> >versus what the company claims it is.
>
>    Who else is gonna know for sure ? Sometimes
>    you're just stuck with one data set.
>
>    Unfortunately, automobiles are far more "highly
>    engineered" than they used to be in the days
>    where you just bolted some pretty sheet metal
>    to a frame. Any new safety features have to be
>    evaluated in terms of how they affect the
>    existing system. Add an extra bit of metal in
>    one place and then the energy-absorbsion
>    characteristics of some other module changes
>    as well.
>
>    Yes, engineering software helps ... being able
>    to model all the physics involved is something
>    the designers of the '57 Chevy could only dream
>    of (actually, it was probably *beyond* the scope
>    of even their dreams).
>
>    However, with cost-consciousness and profit-margins
>    more critical than ever - and an unrelentingly
>    litiginous society that'll sue you into oblivion
>    if you get anything wrong - anything beyond merely
>    cosmetic changes ain't something you do over a
>    weekend.
>
>    It has to be *right* ... and that means paying lots
>    of high-powered high-priced engineering talent. Then
>    there's the re-tooling, reprogramming robots and
>    re-educating humans, crash testing and ........ well,
>    the price of adding that itty bitty piece of metal
>    is NOT 49 cents ... might be megabucks per model.
>
>    So, while automakers may exaggerate a bit, they're
>    probably not entirely *lying* either.
>
>    Of course once the chages ARE made, the next years
>    models only cost 49 cents more to make ... but they
>    WILL charge more to pay for all the abovementioned
>    stuff.
>
>    And then some bureaucrat will demand ANOTHER change ...
>    before the first one is even paid for.

OTOH, I recall there was a Louisiana congressman who railed against
some safety issue de jure, I think it was tires which were blowing out
on SUVs. He was so ever "agin" such a waste of time...of course he
sued too.

So I'm soooooo sure if you were in an accident you wouldn't sue the
auto company that built your car that didn't have that one safety item
which would have prevented your spinal injury which left you
paralysed.

> At some point
>    the company goes bust.