Ruby Forum Ruby > Installing Ruby, Sqlite3, Sqlite3-Ruby on Cygwin

Posted by Ruby Admirer (Guest)
on 26.02.2007 18:19
(Received via mailing list)
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 Buck for the help)
gem install sqlite3-ruby-1.2.1.gem

  That's it.

  Chauk-Mean.
Posted by Jason Roelofs (Guest)
on 26.02.2007 20:28
(Received via mailing list)
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
Posted by Roger Pack (rogerdpack)
on 27.02.2007 05:44
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 :) 
Something like that.


Jason Roelofs 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
Posted by micathom (Guest)
on 27.02.2007 08:01
(Received via mailing list)
> > 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.
Posted by Ruby Admirer (Guest)
on 27.02.2007 09:38
(Received via mailing list)
Roger Pack <rogerpack2005@gmail.com> 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 :)
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.
Posted by ajalkane (Guest)
on 27.02.2007 13:22
(Received via mailing list)
On Feb 27, 8:58 am, "micathom" <micat...@gmail.com> 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.
Posted by Ruby Admirer (Guest)
on 27.02.2007 13:38
(Received via mailing list)
ajalkane <ajalkane@gmail.com> 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.
Posted by Ruby Admirer (Guest)
on 27.02.2007 13:45
(Received via mailing list)
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.
Posted by Charles Roper (charlesroper)
on 23.04.2007 18:49
I tried following the steps posted but I get the following error when I 
run gem install sqlite3-ruby-1.2.1.gem

charlesr@BRC_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 by 
`sqlite3_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
Posted by Phillip Gawlowski (Guest)
on 23.04.2007 18:57
(Received via mailing list)
Charles Roper 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
Posted by Charles Roper (charlesroper)
on 23.04.2007 19:47
Phillip Gawlowski wrote:
> Charles Roper 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
Posted by Brian Candler (Guest)
on 23.04.2007 21:41
(Received via mailing list)
On Tue, Apr 24, 2007 at 01:49:03AM +0900, Charles Roper 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 by 
> `sqlite3_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.
Posted by Charles Roper (charlesroper)
on 24.04.2007 14:07
Brian Candler wrote:
> On Tue, Apr 24, 2007 at 01:49:03AM +0900, Charles Roper 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 by 
>> `sqlite3_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 Lowis 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 `_WinMain@16'
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
Posted by Charles Roper (charlesroper)
on 24.04.2007 15:02
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. :)

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

Charles
Posted by Charles Roper (charlesroper)
on 26.04.2007 13:12
Charles Roper 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. :)

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
Posted by Chris Lowis (chrislo)
on 26.04.2007 17:14
> 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