Installing Ruby, Sqlite3, Sqlite3-Ruby on Cygwin

Hi,

In case other people may need a native installation of Ruby, Sqlite3
and Sqlite3-Ruby on Cygwin, here is how I manage to install these stuffs
successfully :

Cygwin requirements

Default + gcc + make

I use only the default location for installation (/usr/local).

You may need to provide options for other location.

Ruby :

tar xvf ruby-1.8.5-p12.tar.gz
cd ruby-1.8.5-p12
./configure
make
make install

Rubygems :

tar xvf rubygems-0.9.2.tgz
cd rubygems-0.9.2
ruby setup.rb

Sqlite3 :

tar xvf sqlite-3.3.13.tar.gz
mkdir bld
cd bld
…/sqlite-3.3.13/configure --disable-tcl
make
make sqlite3.dll
make install
cp sqlite3.dll /usr/local/bin

Ruby-Sqlite3 (thanks to Jamis B. for the help)

gem install sqlite3-ruby-1.2.1.gem

That’s it.

Chauk-Mean.

Looks good. A note for those new to Cygwin: The Ruby from setup.exe is
broken, horribly broken. Build from source as outlined above or (better
IMO)
use the OneClick Ruby Installer and install to Windows itself, updating
your
PATH to include C:\ruby\bin (default path).

Jason

I believe that the ruby for cygwin works…all right…however if you
install it ‘side by side’ with ruby for windows, you may need to change
the environment variable for your computer of “ruby_opt=-rubygems” to
not say anything (or have cygwin override it on start-up) because that
conflicts with the two versions and they no longer like each other :slight_smile:
Something like that.

Jason R. wrote:

Looks good. A note for those new to Cygwin: The Ruby from setup.exe is
broken, horribly broken. Build from source as outlined above or (better
IMO)
use the OneClick Ruby Installer and install to Windows itself, updating
your
PATH to include C:\ruby\bin (default path).

Jason

Roger P. [email protected] wrote:
I believe that the ruby for cygwin works…all right…however if you
install it ‘side by side’ with ruby for windows, you may need to change
the environment variable for your computer of “ruby_opt=-rubygems” to
not say anything (or have cygwin override it on start-up) because that
conflicts with the two versions and they no longer like each other :slight_smile:
Something like that.

I also had the same problem with Ruby provided by Cygwin and I had to
unset RUBYOPT.

Now that I have recompiled Ruby on Cygwin, I got the latest version
(1.8.5p12) and ruby and irb works perfectly even if RUBYOPT is set.

I have now the two installation side by side working perfectly.
When I use the Cygwin shell, the PATH has /usr/local/bin … before
the PATH set from Windows, so my new ruby on Cygwin is used.

When I use the Windows Command Prompt or if I launch something from
the explorer …, the ruby from the One-Click installer is used.

Basically, I use Cygwin for Unix like stuff and I use the One-Click
installation for standard Windows use.

Chauk-Mean.

Looks good. A note for those new to Cygwin: The Ruby from setup.exe is
broken, horribly broken. Build from source as outlined above or (better
IMO)
use the OneClick Ruby Installer and install to Windows itself, updating
your
PATH to include C:\ruby\bin (default path).

Cyg ruby works quite well here. Using the windows ruby in a cygwin
environmont isn’t such a good idea due to different path conventions.

With respect to sqlite: I’d supposed that “gem install sqlite3-ruby”
should work.

On Feb 27, 8:58 am, “micathom” [email protected] wrote:

With respect to sqlite: I’d supposed that “gem install sqlite3-ruby”
should work.

Having just been in the situation of wanting to use SQLite3 with ruby
in cygwin, I can say it did not. Not without warnings at least that
is.

I ended up compiling SQLite3 on cygwin, compiling SQLite3’s dll,
downloading sqlite3-ruby tar.gz packet, and compiling the ruby
extension
extension with correct paths to SQLite3’s headers and libs.

ajalkane [email protected] wrote:
On Feb 27, 8:58 am, “micathom” wrote:

With respect to sqlite: I’d supposed that “gem install sqlite3-ruby”
should work.

Having just been in the situation of wanting to use SQLite3 with ruby
in cygwin, I can say it did not. Not without warnings at least that
is.
The gem install sqlite3-ruby-1.2.1 just works fine for me as I
indicated.
The native extension is built during the installation and there is no
warning displayed (I don’t know if there are actually warnings but they
are not displayed).
I run Radiant CMS with sqlite3 on Cygwin without any problem.

Oups ! The quoting from Yahoo doesn’t work well. Here is a new post.

ajalkane wrote:

On Feb 27, 8:58 am, “micathom” wrote:

With respect to sqlite: I’d supposed that “gem install sqlite3-ruby”
should work.

Having just been in the situation of wanting to use SQLite3 with ruby
in cygwin, I can say it did not. Not without warnings at least that is.

The gem install sqlite3-ruby-1.2.1 just works fine for me as I
indicated.
The native extension is built during the installation and there is no
warning displayed (I don’t know if there are actually warnings but they
are not displayed).
I run Radiant CMS with sqlite3 on Cygwin without any problem.

Charles R. wrote:

ruby extconf.rb install sqlite3-ruby-1.2.1.gem
checking for sqlite3.h… no

This line is a good hint: You don’t have the SQLite3 sources available
for compilation.


Phillip “CynicalRyan” Gawlowski
http://cynicalryan.110mb.com/
http://clothred.rubyforge.org

Rule of Open-Source Programming #34:

Every successful project will eventually spawn a sub-project

On Tue, Apr 24, 2007 at 01:49:03AM +0900, Charles R. wrote:

ruby extconf.rb install sqlite3-ruby-1.2.1.gem
checking for sqlite3.h… no

make
make: *** No rule to make target ruby.h', needed bysqlite3_api_wrap.o’. Stop
.

You don’t have the Ruby header files available.

I could tell you how to fix this if it were Ubuntu or Debian Linux:

apt-get install ruby1.8-dev

But I’m afraid I don’t know how to fix it for your Windows setup.
Perhaps
the Ruby package you’re using comes in several parts, like Debian does.

Phillip G. wrote:

Charles R. wrote:

ruby extconf.rb install sqlite3-ruby-1.2.1.gem
checking for sqlite3.h… no

This line is a good hint: You don’t have the SQLite3 sources available
for compilation.

Thanks for the reply Phillip. I don’t understand why the sources aren’t
available. I’ve followed the instructions posted originally
(http://www.ruby-forum.com/topic/99227#211996) and I’m running my gem
install sqlite3-ruby from the bld directory where all of the sources
appear to reside, including sqlite3.h. So I’m a bit lost as to what to
try next.

Charles

Brian C. wrote:

On Tue, Apr 24, 2007 at 01:49:03AM +0900, Charles R. wrote:

ruby extconf.rb install sqlite3-ruby-1.2.1.gem
checking for sqlite3.h… no

make
make: *** No rule to make target ruby.h', needed bysqlite3_api_wrap.o’. Stop
.

You don’t have the Ruby header files available.

I could tell you how to fix this if it were Ubuntu or Debian Linux:

apt-get install ruby1.8-dev

But I’m afraid I don’t know how to fix it for your Windows setup.
Perhaps
the Ruby package you’re using comes in several parts, like Debian does.

Thanks Brian. I’ve obtained the Ruby source files from the Cygwin setup
utility (package manager) and they reside in /usr/src/ruby-1.8.5-3.

Chris L. kindly provided me a link to a post he made, but
unfortunately this didn’t work either.

It seems that the process is failing at the make install stage:

$ make install
rm -rf tsrc
mkdir -p tsrc
cp …/src/alter.c …/src/analyze.c …/src/attach.c …/src/auth.c
…/src/btree.c …/src/btree.h …/src/build.c …/src/callback.c
…/src/complete.c …/src/date.c …/src/delete.c …/src/expr.c
…/src/func.c …/src/hash.c …/src/hash.h …/src/insert.c
…/src/legacy.c …/src/loadext.c …/src/main.c …/src/os.c
…/src/os_unix.c …/src/os_win.c …/src/os_os2.c …/src/pager.c
…/src/pager.h …/src/parse.y …/src/pragma.c …/src/prepare.c
…/src/printf.c …/src/random.c …/src/select.c …/src/shell.c
…/src/sqlite.h.in …/src/sqliteInt.h …/src/table.c …/src/tclsqlite.c
…/src/tokenize.c …/src/trigger.c …/src/utf.c …/src/update.c
…/src/util.c …/src/vacuum.c …/src/vdbe.c …/src/vdbe.h
…/src/vdbeapi.c …/src/vdbeaux.c …/src/vdbefifo.c …/src/vdbemem.c
…/src/vdbeInt.h …/src/vtab.c …/src/where.c …/ext/fts1/fts1.c
…/ext/fts1/fts1.h …/ext/fts1/fts1_hash.c …/ext/fts1/fts1_hash.h
…/ext/fts1/fts1_porter.c …/ext/fts1/fts1_tokenizer.h
…/ext/fts1/fts1_tokenizer1.c sqlite3.h …/src/btree.h …/src/hash.h
opcodes.h …/src/os.h …/src/os_common.h …/src/sqlite3ext.h
…/src/sqliteInt.h …/src/vdbe.h parse.h …/ext/fts1/fts1.h
…/ext/fts1/fts1_hash.h …/ext/fts1/fts1_tokenizer.h …/src/vdbeInt.h
tsrc
cp: warning: source file ../src/btree.h' specified more than once cp: warning: source file…/src/hash.h’ specified more than once
cp: warning: source file ../src/sqliteInt.h' specified more than once cp: warning: source file…/src/vdbe.h’ specified more than once
cp: warning: source file ../ext/fts1/fts1.h' specified more than once cp: warning: source file…/ext/fts1/fts1_hash.h’ specified more than
once
cp: warning: source file ../ext/fts1/fts1_tokenizer.h' specified more than once cp: warning: source file…/src/vdbeInt.h’ specified more than once
rm tsrc/sqlite.h.in tsrc/parse.y
cp parse.c opcodes.c keywordhash.h tsrc
tclsh …/tool/mksqlite3c.tcl
cc sqlite3.c -o sqlite3
/usr/lib/gcc/i686-pc-cygwin/3.4.4/…/…/…/libcygwin.a(libcmain.o):(.text+0xab):
undefined reference to `[email protected]
collect2: ld returned 1 exit status
make: *** [sqlite3] Error 1

sigh. I’ve not had any problems with Cygwin up until now, but I’ve
spent the best part of a day on this and it’s proving to be
excruciatingly frustrating.

Charles

Finally managed to get it going using the precompiled Windows binaries
and a little help from Chris’ instructions
(http://chrislowis.co.uk/rails.html). All I had to do in the end was
install the Windows binaries into a directory in the Windows PATH and
then make the change to the api.rb file as Chris suggests. So that
works. Phew. I can get on with some work now. :slight_smile:

Many thanks to all who helped with this; it is greatly appreciated.

Charles

I tried following the steps posted but I get the following error when I
run gem install sqlite3-ruby-1.2.1.gem

[email protected]_IT_OFFICER /cygdrive/t/~Charles/sqlite-3.3.16/bld
$ gem install sqlite3-ruby-1.2.1.gem
Building native extensions. This could take a while…
ERROR: While executing gem … (RuntimeError)
Error instaling sqlite3-ruby-1.2.1.gem:
ERROR: Failed to build gem native extension.

ruby extconf.rb install sqlite3-ruby-1.2.1.gem
checking for sqlite3.h… no

make
make: *** No rule to make target ruby.h', needed bysqlite3_api_wrap.o’. Stop
.

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

Does anyone know what the problem might be here? The only thing I did
differently from the instructions was to use the Ruby package for Cygwin
(ruby 1.8.5 (2006-12-25 patchlevel 12) [i386-cygwin])

Many thanks,

Charles

Finally managed to get it going using the precompiled Windows binaries
and a little help from Chris’ instructions
(http://chrislowis.co.uk/rails.html). All I had to do in the end was

I’m glad it worked for you !

Chris

Charles R. wrote:

Finally managed to get it going using the precompiled Windows binaries
and a little help from Chris’ instructions
(http://chrislowis.co.uk/rails.html). All I had to do in the end was
install the Windows binaries into a directory in the Windows PATH and
then make the change to the api.rb file as Chris suggests. So that
works. Phew. I can get on with some work now. :slight_smile:

I just wanted to follow this up for those Googling this same problem.
“pnomolos” on the E-TextEditor forum discovered a much more elegant and
robust solution:

http://www.e-texteditor.com/forum/viewtopic.php?p=4162#4162

Be sure to note my reply to save a few minutes of head-scratching.

Charles

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs