view · edit · sidebar · attach · print · history

20120329-setup-de-oddb-org

<< 20120330-de-oddb-org-setup-ebps-update-table-in_fachinfos_yaml | 2012 | 20120328-improve-fachinfo-photo-de-oddb-org >>


summary

index


Setup de.oddb.org

continue of yesterday
http://dev.ywesee.com/Yasu/20120328-improve-fachinfo-photo-de-oddb-org#setup_de_oddb_org

facets gem

try run bin/oddbd with ruby 1.8.7

$ ruby18 -r rubygems bin/oddbd 
/var/www/de.oddb.org/lib/oddb.rb:4: warning: already initialized constant VERSION
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- facet/string/singular (LoadError)
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /var/www/de.oddb.org/lib/fixes/singular.rb:5
...
  • facets 2.9.3 deosn't work
  • facets 1.8.54 work

Because module name changed
facet/string/singular ---> facets/string

https://github.com/rubyworks/facets/blob/master/lib/core/facets/string.rb

pg gem

$ ruby18 -r rubygems bin/oddbd 
/var/www/de.oddb.org/lib/oddb.rb:4: warning: already initialized constant VERSION
/usr/lib/ruby/site_ruby/1.8/dbi.rb:300:in `load_driver': Unable to load driver 'pg' (underlying error: wrong constant name pg) (DBI::InterfaceError)
        from /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
        from /usr/lib/ruby/site_ruby/1.8/dbi.rb:242:in `load_driver'
        from /usr/lib/ruby/site_ruby/1.8/dbi.rb:160:in `_get_full_driver'
        from /usr/lib/ruby/site_ruby/1.8/dbi.rb:145:in `connect'
...

This error caused by module name (pg and Pg).

/var/www/de.oddb.org/lib/oddb/persistence/odba.rb

...
module ODDB
  module Persistence
    module ODBA
    end 
  end 
  #ODBA.storage.dbi = ODBA::ConnectionPool.new("DBI:pg:#{@config.db_name}",
  ODBA.storage.dbi = ODBA::ConnectionPool.new("DBI:Pg:#{@config.db_name}",
                                              @config.db_user, @config.db_auth)
  ODBA.cache.setup
end

http://oddb-org-wiki.heroku.com/2012.02.03-yus-setup#solution

then It works.

Setup DB

There are oddb as role name and db name in lib/oddb/config

$ sudo -u postgres createdb -E UTF8 -T template0 oddb
$ sudo -u postgres createuser oddb

I could not create user oddb

$ sudo -u postgres createuser oddb
Password: 
Shall the new role be a superuser? (y/n) y
createuser: creation of new role failed: ERROR:  role "oddb" already exists
postgres=# drop role oddb;
ERROR:  role "oddb" cannot be dropped because some objects depend on it
DETAIL:  45 objects in database oddb.org.ruby193

Then added LOGIN grant to oddb

$ psql
postgres=# alter role oddb with login;
ALTER ROLE
postgres=# select * from pg_user;
 usename  | usesysid | usecreatedb | usesuper | usecatupd |  passwd  | valuntil | useconfig 
----------+----------+-------------+----------+-----------+----------+----------+-----------
 postgres |     nnnn | t           | t        | t         | ******** |          | 
 yus      |     nnnn | t           | t        | t         | ******** |          | 
 migel    |     nnnn | t           | t        | t         | ******** |          | 
 oddb     |     nnnn | f           | f        | f         | ******** |          | 
postgres=# \q
$ dropdb oddb
$ createdb -U postgres -O oddb -E UTF8 oddb

I could connect to db with oddb user.

sbsm gem

$ ruby18 -r rubygems bin/oddbd 
/var/www/de.oddb.org/lib/oddb.rb:4: warning: already initialized constant VERSION
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "object_pkey" for table "object"
NOTICE:  CREATE TABLE / UNIQUE will create implicit index "object_name_key" for table "object"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "object_connection_pkey" for table "object_connection"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "collection_pkey" for table "collection"
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- sbsm/user (LoadError)
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /var/www/de.oddb.org/lib/oddb/html/util/known_user.rb:4
...

Installed sbsm gem via gem18

$ sudo gem18 install sbsm

htmlgrid gem

...
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- htmlgrid/divtemplate (LoadError)
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /var/www/de.oddb.org/lib/oddb/html/view/template.rb:4
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /var/www/de.oddb.org/lib/oddb/html/view/drugs/template.rb:4
...

fastercsv gem

,,,
could not find htmlgrid.so, falling back to pure-ruby class
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- fastercsv (LoadError)
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /var/www/de.oddb.org/lib/oddb/export/csv.rb:4
...

oniguruma patch

de.oddb.org use oniguruma Regexp

/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': /var/www/de.oddb.org/lib/oddb/import/pharmnet.rb:556: undefined (?...) sequence: /(?<!nicht )akzeptieren/ (SyntaxError)
/var/www/de.oddb.org/lib/oddb/import/pharmnet.rb:788: undefined (?...) sequence: /^(?<name>.*?)\s*-\s*OP((?<size>\d+)|\((?<multi>\d+)x(?<size>\d+)\))(\((?<unit>[^)]+)\))?$/

install ruby 1.8.6 with oniguruma

Ruby-1.8.6(trunk)
$ svn co http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8
Oniguruma-patch
$ wget http://dev.ywesee.com/uploads/att/oniguruma_patch_for_ruby-1.8.6_p369.20100615_from_Hannes-san.tar.gz
$ tar zxvf oniguruma_*
$ cd oniguruma
$ ./configure --with-rubydir=/home/yasu/Documents/workspace/ywesee/oniguruma/ruby_1_8_6
$ make 186

patch faild

...
Hunk #1 FAILED at 24.
1 out of 1 hunk FAILED -- saving rejects to file re.h.rej
patching file re.c
patching file string.c
make: *** [186] Error 1
...

try ruby-1.8.6-p369

$ svn co http://svn.ruby-lang.org/repos/ruby/tags/v1_8_6_369 ruby_1_8_6_p369
$ cd oniguruma
$ ./configure --with-rubydir=/home/yasu/Documents/workspace/ywesee/oniguruma/ruby_1_8_6_p369
$ make 186

Patch succeed.

$ cd ../ruby_1_8_6_p369
$ autoconf
$ ./configure --prefix=/home/yasu/usr/local

openssl error.

...
ossl_pkcs7.c: In function ‘ossl_pkcs7_set_crls’:
ossl_pkcs7.c:624:10: warning: assignment makes pointer from integer without a cast
ossl_pkcs7.c: In function ‘ossl_pkcs7_get_crls’:
ossl_pkcs7.c:634:5: warning: passing argument 1 of ‘ossl_x509crl_sk2ary’ makes pointer from integer without a cast
ossl.h:121:7: note: expected ‘struct stack_st_X509_CRL *’ but argument is of type ‘int’
make[1]: *** [ossl_pkcs7.o] Error 1
make: *** [all] Error 1

Attach:ruby-186-p369-make_openssl-error-20120329.txt

install openssl 0.9.8 for Ruby 1.8.6-p369

$ openssl version
OpenSSL 1.0.0e 6 Sep 2011
$ wget ftp://ftp.openssl.org/snapshot/openssl-0.9.8-stable-SNAP-20120329.tar.gz
$ tar zxvf openssl-0.9.8-stable-SNAP-20120329.tar.gz
$ cd openssl-0.9.8-stable-SNAP-20120329
$ ./config --prefix=/home/yasu/usr/local --openssldir=/home/yasu/usr/local/ssl
$ make
$ make install
$ ~/usr/local/bin/openssl version
OpenSSL 0.9.8v-dev xx XXX xxxx

try compile ruby, again. in configure

...
config.status: creating Makefile
configure: WARNING: unrecognized options: --with-openssl-dir

This problem depends on autoconf version.
http://bugs.ruby-lang.org/issues/1814

$ ./configure --prefix=/home/yasu/usr/local --disable-option-checking --with-openssl-dir=/home/yasu/usr/local

Then installed Ruby 1.8.6-p396

$ make install
./miniruby  ./instruby.rb --dest-dir="" --extout=".ext" --make="make" --mflags="" --make-flags="" --installed-list .installed.list --mantype="doc"
installing binary commands
installing command scripts
installing library scripts
installing headers
installing manpages
installing extension objects
installing extension scripts
$ ~/usr/local/bin/ruby --version
ruby 1.8.6 (2009-06-08 patchlevel 369) [i686-linux]

zlib

$ cd /path/to/ruby-src/ext/zlib
$ ~/usr/local/bin/ruby extconf.rb 
checking for deflateReset() in -lz... yes
checking for zlib.h... yes
checking for kind of operating system... Unix
creating Makefile
$ make
gcc -shared -o zlib.so zlib.o -L. -L/home/yasu/usr/local/lib -Wl,-R/home/yasu/usr/local/lib -L.  -rdynamic -Wl,-export-dynamic    -lz  -lrt -ldl -lcrypt -lm   -lc
$ make install
/usr/bin/install -c -m 0755 zlib.so /home/yasu/usr/local/lib/ruby/site_ruby/1.8/i686-linux

rubygems

I have to install gems, again.
Installed rubygems with ruby-1.8.6-p369.

rubygems-1.8.21 #=> failed (for >= ruby 1.9.2)

$ ~/usr/local/bin/ruby setup.rb 
./lib/rubygems.rb:334: warning: parenthesize argument(s) for future version
./lib/rubygems.rb:516: warning: parenthesize argument(s) for future version
./lib/rubygems.rb:32:in `require': ./lib/rubygems/deprecate.rb:54: syntax error, unexpected ',', expecting '|' (SyntaxError)
... define_method name do |*args, &block| # TODO: really works ...
                              ^
./lib/rubygems/deprecate.rb:55: syntax error, unexpected tCONSTANT, expecting '}'
./lib/rubygems/deprecate.rb:64: syntax error, unexpected kEND, expecting '}'
./lib/rubygems/deprecate.rb:69: syntax error, unexpected kEND, expecting '}'
        from ./lib/rubygems.rb:32
        from setup.rb:27:in `require'
        from setup.rb:27

installed rubygems-1.3.5

sad news...

$ ~/usr/local/bin/gem install bundler
ERROR:  Error installing bundler:
        bundler requires Ruby version >= 1.8.7

install_gems

Icould not install some gems

  • dbd-pg (0.3.9)
  • facets (2.9.3)

got SEGFAULT error of Ruby

It seems related this(1.8.7)

Many people have solved by switching to 1.8.7.
(It was fixed in Ruby 1.8.7)

I found great article. http://undertitled.com/2012/01/01/down-the-rabbit-hole.html

I also created patch from commit to ruby-1.8.7.
(used git diff)

$ git clone https://github.com/FooBarWidget/rubyenterpriseedition187-248.git
$ cd rubyenterpriseedition187-248/
$ git co 2be9552406aaa04bdf07f43ab64762aa9583ca35
$ git diff --no-prefix HEAD~1 > ../syck.patch
$ cd /path/to/ruby/src
$ patch ext/syck/rubyext.c < /path/to/syck.patch
$ 

generated patch
Attach:ruby-186-sych.patch.txt

And compiled ruby-1.8.6-p396 again.
It works !

Installed

  • dbi (0.3.9) (same version with production)
  • deprecated (2.0.1)
  • facets (1.8.54) !!
  • fastercsv (1.5.4)
  • htmlgrid (1.0.5)
  • odba (1.0.8)
  • rclconf (1.0.0)
  • sbsm (1.1.5)
  • yus (1.0.0)

--- add 20120331

  • ydim (1.0.0)
  • @@spreadsheet (0.6.8)
  • ruby-ole (1.2.11.3)
  • rpdf2txt (0.8.4)
  • money (2.1.3) before paypal
  • paypal (2.0.0)
  • json (1.6.6 re-installed, compiled parser.so with ruby 1.8.6)
  • activesupport (2.3.2, 2.3.8)

I could not install (>= ruby-1.8.7)

  • dbd-pg
  • pg
$ ~/usr/local/bin/ruby ~/usr/local/bin/gem list dbd-pg -all -r

*** REMOTE GEMS ***

dbd-pg (0.3.9, 0.3.8, 0.3.7, 0.3.6, 0.3.5, 0.3.4, 0.3.3)
$ ~/usr/local/bin/ruby ~/usr/local/bin/gem list pg -all -r

*** REMOTE GEMS ***

pg (0.13.2, 0.13.1, 0.13.0, 0.12.2, 0.12.1, 0.12.0, 0.11.0, 0.10.1, 0.10.0, 0.9.0, 0.8.0, 0.7.9.2008.10.13, 0.7.9.2008.10.05, 0.7.9.2008.08.17, 0.7.9.2008.03.18, 0.7.9.2008.02.05, 0.7.9.2008.01.28)

Installed

  • pg (0.9.0) (latest for Ruby-1.8.6)
  • dbd-pg (0.3.9,, could install after installing of pg)

ran bin/oddbd

htmlentities gem

/home/yasu/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- htmlentities (LoadError)
        from /home/yasu/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /var/www/de.oddb.org/lib/oddb/import/pharmnet.rb:5

installed htmlentities (4.3.1, current newest)

mechanize gem

$ ~/usr/local/bin/ruby ~/usr/local/bin/gem install mechanize
ERROR:  Error installing mechanize:
        nokogiri requires Ruby version >= 1.8.7
$ ~/usr/local/bin/ruby ~/usr/local/bin/gem search mechanize -all -r
...
mechanize (2.3, 2.2.1, 2.2, 2.1.1, 2.1, 2.0.1, 2.0, 1.0.0, 0.9.3, 0.9.2, 0.9.1, 0.9.0, 0.8.5, 0.8.4, 0.8.3, 0.8.2, 0.8.1, 0.8.0, 0.7.8, 0.7.7, 0.7.6, 0.7.5, 0.7.4, 0.7.3, 0.7.2, 0.7.1, 0.7.0, 0.6.11, 0.6.10, 0.6.9, 0.6.8, 0.6.7, 0.6.6, 0.6.5, 0.6.4, 0.6.3, 0.6.2, 0.6.1, 0.6.0, 0.5.4, 0.5.3, 0.5.2, 0.5.1, 0.5.0, 0.4.7, 0.4.6, 0.4.5, 0.4.4, 0.4.3, 0.4.2, 0.4.1, 0.4.0, 0.3.1, 0.3.0, 0.2.3, 0.2.2, 0.2.1, 0.2.0, 0.1.3, 0.1.2, 0.1.1, 0.1.0)
...

installed 0.6.11 (same version with production server)

$ ~/usr/local/bin/ruby ~/usr/local/bin/gem install mechanize -v 0.6.11
Building native extensions.  This could take a while...
ERROR:  Error installing mechanize:
        hoe requires RubyGems version >= 1.4

installed hoe 1.12.1 (same version with production server)
then install mechanize

character-encodings gem

/home/yasu/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- encoding/character/utf-8 (LoadError)
        from /home/yasu/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /var/www/de.oddb.org/lib/oddb/import/importer.rb:1
...

imagemagick

Installed Imagemagick-6.7.6 (und rmagick gem) then

...
/home/yasu/usr/local/lib/ruby/gems/1.8/gems/rmagick-2.13.1/lib/RMagick2.so: This installation of RMagick was configured with ImageMagick 6.7.5 but ImageMagick 6.7.6-2 is in use. (RuntimeError)
        from /home/yasu/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /home/yasu/usr/local/lib/ruby/gems/1.8/gems/rmagick-2.13.1/lib/RMagick.rb:11
        from /home/yasu/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
        from /home/yasu/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
        from /var/www/de.oddb.org/lib/oddb/import/rtf.rb:12
...

Imagemagick http://www.imagemagick.org/download/legacy/

installed libpng http://dl.ambiweb.de/mirrors/www.libpng.org/pub/png/libpng.html

libgd

ran bin/oddbd

...
/home/yasu/usr/local/lib/ruby/gems/1.8/gems/gd2-1.1.1/lib/gd2.rb:58:in `initialize': libgd.so.2: cannot open shared object file: No such file or directory (RuntimeError)
        from /home/yasu/usr/local/lib/ruby/gems/1.8/gems/gd2-1.1.1/lib/gd2.rb:58:in `dlopen'
        from /home/yasu/usr/local/lib/ruby/gems/1.8/gems/gd2-1.1.1/lib/gd2.rb:58
...

installed libgd https://bitbucket.org/pierrejoye/gd-libgd/wiki/libgd_installation

tried symbolic link and ldconfig
But, same error is caused...

continue

Refs

view · edit · sidebar · attach · print · history
Page last modified on June 28, 2013, at 05:33 PM