インストール (1)

retrospectiva という BTSWindows に入れてみようとしています。そのメモ。
うまくインストールできればメッケモノくらいの気分です。

関連記事

まず気になった記事。

最後の記事で「libsvn-rubyをインストールしないと、Subversionとの連携ができないみたい」と書かれていたので、libsvn-ruby 環境を整備してみます。

この記事によれば、svn のソースを取ってくる必要があるとのこと。

libsvn-ruby のインストール

下記リンクから subversion-1.4.6.tar.bz2 取得。

さっそく Cygwin を起動して、make してみたところ、

$ tar jxvf subversion-1.4.6.tar.bz2
$ cd subversion-1.4.6/
$ ./configure
...(略)...
configure: Apache Portable Runtime (APR) library configuration
checking for APR... no
configure: WARNING: APR not found
The Apache Portable Runtime (APR) library cannot be found.
Please install APR on this system and supply the appropriate
--with-apr option to 'configure'

or

get it with SVN and put it in a subdirectory of this source:

   svn co \
    http://svn.apache.org/repos/asf/apr/apr/branches/0.9.x \
    apr

Run that right here in the top level of the Subversion tree,
then run autogen.sh again.

Whichever of the above you do, you probably need to do
something similar for apr-util, either providing both
--with-apr and --with-apr-util to 'configure', or
getting both from SVN with:

   svn co \
    http://svn.apache.org/repos/asf/apr/apr-util/branches/0.9.x \
    apr-util

configure: error: no suitable apr found

apr というものが必要らしいです。(apr = Apache_Portable_Runtime - Wikipedia)

apr のインストール

下記から、apr-1.2.12.tar.gz をダウンロード。

$ tar zxvf apr-1.2.12.tar.gz
$ cd apr-1.2.12/
$ ./configure --prefix=D:/Retro
$ make
$ make test
This test requires APR thread support.
testatomic          : SUCCESS
testdir             : SUCCESS
testdso             : FAILED 8 of 9
testdup             : SUCCESS
testenv             : SUCCESS
testfile            : SUCCESS
testfilecopy        : SUCCESS
testfileinfo        : SUCCESS
testflock           : FAILED 2 of 3
testfmt             : SUCCESS
testfnmatch         : SUCCESS
testargs            : SUCCESS
testhash            : SUCCESS
testipsub           : SUCCESS
testlock            : SUCCESS
testlfs             : SUCCESS
testmmap            : SUCCESS
testnames           : SUCCESS
testoc              : FAILED 1 of 1
testpath            : SUCCESS
testpipe            : ...
$ make install

ぶじ、インストールできた模様。
が、ここで、subversion に戻って ./configure しても、次のように怒られました。
(案の定といえば案の定です)

$ ./configure --prefix=D:/Retro --with-apr=D:/Retro
configure: Apache Portable Runtime (APR) library configuration
checking for APR... yes
checking APR version... 1.2.12
configure: Apache Portable Runtime Utility (APRUTIL) library configuration
checking for APR-util... no
configure: WARNING: APRUTIL not found
The Apache Portable Runtime Utility (APRUTIL) library cannot be found.
Either install APRUTIL on this system and supply the appropriate
--with-apr-util option

or

get it with SVN and put it in a subdirectory of this source:

   svn co \
    http://svn.apache.org/repos/asf/apr/apr-util/branches/0.9.x \
    apr-util

Run that right here in the top level of the Subversion tree,
then run autogen.sh again.

configure: error: no suitable APRUTIL found

apr-util のインストール

やはり、下記から、apr-util-1.2.12.tar.bz2 をダウンロード。

$ tar jxvf apr-util-1.2.12.tar.bz2
$ cd apr-util-1.2.12/
$ ./configure --prefix=D:/Retro
...
checking for APR... no
configure: error: APR could not be located. Please use the --with-apr option.

上記のように怒られたので --with-apr オプションをつけて再度 configure してみます。

$ ./configure --prefix=D:/Retro --with-apr=D:/Retro
$ make
...(中略)...
*** Warning: This system can not link to static lib archive D:/Retro/lib/libapr-
1.la.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have.
libtool: link: warning: undefined symbols not allowed in i686-pc-cygwin shared l
ibraries
...(中略)...

とりあえず、Warning は無視しておきます。

$ make test
...(中略)...
teststrmatch        : SUCCESS
testuri             : SUCCESS
testuuid            : SUCCESS
testbuckets         : SUCCESS
testpass            : SUCCESS
testmd4             : SUCCESS
testmd5             : SUCCESS
testdbd             : SUCCESS
testdate            : SUCCESS
testxml             : SUCCESS
testxlate           : SUCCESS
testrmm             : SUCCESS
testdbm             : SUCCESS
testqueue           : SUCCESS
testreslist         : SUCCESS
All tests passed.
No driver available for sqlite2.
Loaded sqlite3 driver OK.
Opened sqlite3[] OK
======== create table ========
create table test successful

======== insert rows ========
insert rows test successful

======== invalid op ========
invalid op returned 1 (should be nonzero).  Error msg follows
'no such table: apr_dbd_test1'
valid op returned 0 (should be zero; error shouldn't affect subsequent ops)
invalid op test successful

======== select random ========
ROW 5:  wibble  nothing 5
ROW 1:  asdfgh  bar     1
select random test successful

======== select sequential ========
ROW 0:  asdfgh  bar     1
ROW 1:  bar     foo     (null)
ROW 2:  foo     (null)  (null)
ROW 3:  qwerty  foo     0
ROW 4:  wibble  nothing 5
ROW 5:  wibble  other   5
select sequential test successful

======== transactions ========
Transaction 1
6 rows updated
Valid insert returned 1.  Should be nonzero (fail) because transaction is bad
Transaction ended (should be rollback) - viewing table
A column of "failed" indicates transaction failed (no rollback)
ROW 0:  asdfgh  bar     1
ROW 1:  bar     foo     (null)
ROW 2:  foo     (null)  (null)
ROW 3:  qwerty  foo     0
ROW 4:  wibble  nothing 5
ROW 5:  wibble  other   5
Transaction 2
6 rows updated
Valid insert returned 0.  Should be zero (OK)
Transaction ended (should be commit) - viewing table
ROW 0:  aaa     zzz     3
ROW 1:  asdfgh  success 1
ROW 2:  bar     success (null)
ROW 3:  foo     success (null)
ROW 4:  qwerty  success 0
ROW 5:  wibble  success 5
ROW 6:  wibble  success 5
transactions test successful

======== prepared select ========
Selecting rows where col3 <= 3 and bar row where it's unset.
Should show four rows.
ROW 0:  qwerty  success 0
ROW 1:  asdfgh  success 1
ROW 2:  bar     success (null)
ROW 3:  aaa     zzz     3
prepared select test successful

======== prepared query ========
Showing table (should now contain row "prepared insert 2")
ROW 0:  aaa     zzz     3
ROW 1:  asdfgh  success 1
ROW 2:  bar     success (null)
ROW 3:  foo     success (null)
ROW 4:  prepared        insert  2
ROW 5:  qwerty  success 0
ROW 6:  wibble  success 5
ROW 7:  wibble  success 5
prepared query test successful

======== drop table ========
drop table test successful

大丈夫そうなので、インストールしてしまいます。

$ make install

再び libsvn-ruby のインストール

すかさず、subversion の configure をやり直します。

$ ./configure --prefix=D:/Retro --with-apr=D:/Retro
...(略)...
checking for APR-util... no
configure: WARNING: APRUTIL not found
The Apache Portable Runtime Utility (APRUTIL) library cannot be found.
Either install APRUTIL on this system and supply the appropriate
--with-apr-util option

or

get it with SVN and put it in a subdirectory of this source:

   svn co \
    http://svn.apache.org/repos/asf/apr/apr-util/branches/0.9.x \
    apr-util

Run that right here in the top level of the Subversion tree,
then run autogen.sh again.

configure: error: no suitable APRUTIL found
    • with-apr-util オプションを付け忘れたのでもう 1 回。
$ ./configure --prefix=D:/Retro --with-apr=D:/Retro --with-apr-util=D:/Retro
...(略)...
configure: WARNING: we have configured without BDB filesystem support


You don't seem to have Berkeley DB version 4.0.14 or newer
installed and linked to APR-UTIL.  We have created Makefiles which
will build without the Berkeley DB back-end; your repositories will
use FSFS as the default back-end.  You can find the latest version of
Berkeley DB here:
  http://www.sleepycat.com/download/index.shtml

とりあえず Berkeley DB は使わないことにして、make に進みます。

$ make
...(略)...
/usr/bin/msgfmt -c -o subversion/po/de.mo subversion/po/de.po
/usr/bin/msgfmt -c -o subversion/po/es.mo subversion/po/es.po
/usr/bin/msgfmt -c -o subversion/po/fr.mo subversion/po/fr.po
/usr/bin/msgfmt -c -o subversion/po/it.mo subversion/po/it.po
/usr/bin/msgfmt -c -o subversion/po/ja.mo subversion/po/ja.po
/usr/bin/msgfmt -c -o subversion/po/ko.mo subversion/po/ko.po
/usr/bin/msgfmt -c -o subversion/po/nb.mo subversion/po/nb.po
/usr/bin/msgfmt -c -o subversion/po/pl.mo subversion/po/pl.po
/usr/bin/msgfmt -c -o subversion/po/pt_BR.mo subversion/po/pt_BR.po
/usr/bin/msgfmt -c -o subversion/po/sv.mo subversion/po/sv.po
/usr/bin/msgfmt -c -o subversion/po/zh_CN.mo subversion/po/zh_CN.po
/usr/bin/msgfmt -c -o subversion/po/zh_TW.mo subversion/po/zh_TW.po

成功した模様です。
make check してみたのですが、

$ make check
'import site' failed; use -v for traceback
Traceback (most recent call last):
  File "./build/run_tests.py", line 15, in <module>
    import os, sys
ImportError: No module named os
make: *** [check] Error 1

と、よくわからない結果。
とりあえず先へ進みます。

libsvn-ruby インストールの参考にした記事 によれば、必要な操作は

  • $ ./configure
  • $ make                 ←ここまで終わった!
  • $ make swig-rb
  • $ make check-swig-rb (テストを実行)
  • $ make install-swig-rb

です。

$ make swig-rb

$ make check-swig-rb
cd /cygdrive/d/software/src/subversion-1.4.6/subversion/bindings/swig/ruby; \
          /cygdrive/d/Ruby/bin/ruby -I /cygdrive/d/software/src/subversion-1.4.6
/subversion/bindings/swig/ruby \
            /cygdrive/d/software/src/subversion-1.4.6/subversion/bindings/swig/r
uby/test/run-test.rb \
            --verbose=normal
/cygdrive/d/software/src/subversion-1.4.6/subversion/bindings/swig/ruby/svn/erro
r.rb:1:in `require': no such file to load -- svn/ext/core (LoadError)

ここでこけてしまいました。
たしかに、subversion-1.4.6/subversion/bindings/swig/ruby に require されている svn/ext/core.rb というファイルは見当たりません。(svn/core.rb ならある)
subversion/bindings/swig/INSTALL を確認してみようと思います。

swig のインストール

前述の INSTALL ファイルによると、

BUILDING SWIG BINDINGS FOR SVN ON UNIX


Step 1:  Install a suitable version of SWIG (which is
         currently swig version 1.3.24 - 1.3.29).

    * Perhaps your distribution packages a suitable version - if it does
      install it, and skip to the last bullet point in this section.

    * Go to http://www.swig.org/, download the source tarball, and unpack.

どうやら、swig パッケージをインストールしておく必要がありそうです。

  • SWIG の解説
    • Simplified Wrapper and Interface Generator
    • スクリプト言語からC/C++のコードを利用するためのインタフェースとなるコードを生成する開発ツールである」

下記から swig-1.3.33.tar.gz を取ってきて、メイク&インストールします。

$ tar zxvf swig-1.3.33.tar.gz
$ cd swig-1.3.33
$ ./configure --prefix=D:/Retro --with-ruby=D:/Ruby/bin
$ make
$ make check
(長くかかりそうなので途中でやめました)
$ make install