Ingres Community Forums Login Register Ingres.com  

Ingres Community Forum


Go Back   Ingres Community Forums > Ingres Forums > Database Drivers and APIs > Ruby Driver/Ruby on Rails Adapter
 

Reply
 
LinkBack Thread Tools Display Modes
Old 2009-07-02   #1 (permalink)
Junior Member
 
Join Date: Mar 2007
Posts: 7
Default Ruby Driver: Ingres.so: undefined symbol: IIMEreqmem

Hi,

I'm having trouble installing Ingres Ruby Driver on Ubuntu Hardy system. Building goes okay (except for a warning - see below), but I can't use the driver in ruby:
$ irb
irb(main):001:0> require 'Ingres'
LoadError: /usr/local/lib/site_ruby/1.8/i486-linux/Ingres.so: undefined symbol: IIMEreqmem - /usr/local/lib/site_ruby/1.8/i486-linux/Ingres.so
from /usr/local/lib/site_ruby/1.8/i486-linux/Ingres.so
from (irb):1

Software version:
Ingres Ruby Driver v 1.3.1 & svn revision 1717
ruby1.8 1.8.6.111-2ubuntu1.2

$ uname -s -r -m
Linux 2.6.24-24-server i686

$ cat $II_SYSTEM/ingres/version.rel
II 9.2.0 (int.lnx/143)NPTL

Build output:

$ make
cc -I. -I. -I/usr/lib/ruby/1.8/i486-linux -I. -DHAVE_IIAPI_H -I/opt/ingres/ingres/files/ -fPIC -fno-strict-aliasing -g -g -O2 -fPIC -c Ingres.c
Ingres.c: In function âgetColumnNamesAndTypesâ:
Ingres.c:1982: warning: cast from pointer to integer of different size
cc -shared -o Ingres.so Ingres.o -L"." -L"/usr/lib" -L"/opt/ingres/ingres/lib/" -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic -lruby1.8 -liiapi -lpthread -ldl -lcrypt -lm -lc

$ sudo make install
/usr/bin/install -c -m 0755 Ingres.so /usr/local/lib/site_ruby/1.8/i486-linux

I don't know what I'm doing wrong. Thanks for any help.

Best Regards
Anton
sucha@dss.sk is offline   Reply With Quote
Old 2009-07-03   #2 (permalink)
Ingres Staff
 
grant's Avatar
 
Join Date: Mar 2007
Location: Valladolid, España
Posts: 381
Blog Entries: 1
Send a message via MSN to grant
Default

Hi Anton,

What does the output from the following command show:
Code:
ldd /usr/local/lib/site_ruby/1.8/i486-linux/Ingres.so
Building the Ruby driver against the standard Ruby packages for Ubuntu 9.04 seems to work fine for me:
Code:
~/src/svn/scratch/ruby/tags/ingres-ruby-1.3.1 [] [5.2.9] [] [Python 2.6.2]
09:49:56 > loadR3
~/src/svn/scratch/ruby/tags/ingres-ruby-1.3.1 [II 9.2.0 (int.lnx/143)NPTL] [5.2.9] [] [Python 2.6.2]
09:50:08 > which ruby
/usr/bin/ruby
~/src/svn/scratch/ruby/tags/ingres-ruby-1.3.1 [II 9.2.0 (int.lnx/143)NPTL] [5.2.9] [] [Python 2.6.2]
09:50:22 > ruby -b
ruby: invalid option -b  (-h will show valid options)
~/src/svn/scratch/ruby/tags/ingres-ruby-1.3.1 [II 9.2.0 (int.lnx/143)NPTL] [5.2.9] [] [Python 2.6.2]
09:50:24 > ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
~/src/svn/scratch/ruby/tags/ingres-ruby-1.3.1 [II 9.2.0 (int.lnx/143)NPTL] [5.2.9] [] [Python 2.6.2]
09:50:40 > ruby extconf.rb 
Start extconf.rb
Using II_SYSTEM=/opt/Ingres/R3
checking for iiapi.h... yes
checking for main() in -liiapi... yes
creating Makefile
~/src/svn/scratch/ruby/tags/ingres-ruby-1.3.1 [II 9.2.0 (int.lnx/143)NPTL] [5.2.9] [] [Python 2.6.2]
09:50:45 > make
cc -I. -I. -I/usr/lib/ruby/1.8/i486-linux -I. -DHAVE_IIAPI_H  -D_FILE_OFFSET_BITS=64  -fPIC -fno-strict-aliasing -g -g -O2  -fPIC  -I/opt/Ingres/R3/ingres/files  -c Ingres.c
Ingres.c: In function ‘countParameters’:
Ingres.c:1015: warning: format ‘%li’ expects type ‘long int’, but argument 3 has type ‘int’
Ingres.c: In function ‘getColumnNamesAndTypes’:
Ingres.c:1982: warning: cast from pointer to integer of different size
Ingres.c: In function ‘processDateField’:
Ingres.c:2102: warning: format ‘%s’ expects type ‘char *’, but argument 4 has type ‘II_PTR’
Ingres.c:2138: warning: format ‘%s’ expects type ‘char *’, but argument 3 has type ‘II_PTR’
cc -shared -o Ingres.so Ingres.o -L. -L/usr/lib -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic -L/opt/Ingres/R3/ingres/lib -lq.1 -lcompat.1 -lframe.1 -lrt -liiapi.1    -lruby1.8 -liiapi  -lpthread -ldl -lcrypt -lm   -lc
~/src/svn/scratch/ruby/tags/ingres-ruby-1.3.1 [II 9.2.0 (int.lnx/143)NPTL] [5.2.9] [] [Python 2.6.2]
09:50:48 > sudo make install
/usr/bin/install -c -m 0755 Ingres.so /usr/local/lib/site_ruby/1.8/i486-linux
~/src/svn/scratch/ruby/tags/ingres-ruby-1.3.1 [II 9.2.0 (int.lnx/143)NPTL] [5.2.9] [] [Python 2.6.2]
09:51:00 > irb
irb(main):001:0> require 'Ingres'
=> true
irb(main):002:0>
regards

grant
__________________
Ingres PHP and Ruby Maintainer
http://blogs.planetingres.org/grant
grant is offline   Reply With Quote
Old 2009-07-03   #3 (permalink)
Junior Member
 
Join Date: Mar 2007
Posts: 7
Default

Hi Grant,

Thanks for reply. You were right, ldd output did not show ingres libraries:
Code:
$ ldd /usr/local/lib/site_ruby/1.8/i486-linux/Ingres.so
        linux-gate.so.1 =>  (0xb7fb9000)
        libruby1.8.so.1.8 => /usr/lib/libruby1.8.so.1.8 (0xb7ea9000)
        libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7e91000)
        libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7e8c000)
        libcrypt.so.1 => /lib/tls/i686/cmov/libcrypt.so.1 (0xb7e5a000)
        libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7e35000)
        libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7ce6000)
        /lib/ld-linux.so.2 (0xb7fba000)
I tried to rebuild as ingres user and now it works perfectly (I built it as other user before, maybe I forgot to set an environment variable or something). Thanks again for your help.

Best Regards

Anton
sucha@dss.sk is offline   Reply With Quote
Old 2009-07-03   #4 (permalink)
Junior Member
 
Join Date: Mar 2007
Posts: 7
Default

Hi Grant,

I further investigated the issue and found out that the difference was not which user I used to build the driver, but how I invoked extconf.rb.

I invoked extconf.rb as per README yesterday:
Code:
$ ruby -r mkmf extconf.rb --with-ingres-include='/opt/ingres/ingres/files/' --with-ingres-lib='/opt/ingres/ingres/lib'
Start extconf.rb
Using supplied directories:
Headers   - /opt/ingres/ingres/files/
Libraries - /opt/ingres/ingres/lib
checking for iiapi.h... yes
checking for main() in -liiapi... yes
creating Makefile

$ make
cc -I. -I. -I/usr/lib/ruby/1.8/i486-linux -I. -DHAVE_IIAPI_H -I/opt/ingres/ingres/files/  -fPIC -fno-strict-aliasing -g -g -O2  -fPIC  -c Ingres.c
Ingres.c: In function âgetColumnNamesAndTypesâ:
Ingres.c:1982: warning: cast from pointer to integer of different size
cc -shared -o Ingres.so Ingres.o -L"." -L"/usr/lib" -L"/opt/ingres/ingres/lib" -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic    -lruby1.8 -liiapi  -lpthread -ldl -lcrypt -lm   -lc

$ ldd Ingres.so
        linux-gate.so.1 =>  (0xb7ee7000)
        libruby1.8.so.1.8 => /usr/lib/libruby1.8.so.1.8 (0xb7dd7000)
        libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7dbf000)
        libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7dba000)
        libcrypt.so.1 => /lib/tls/i686/cmov/libcrypt.so.1 (0xb7d88000)
        libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7d63000)
        libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7c14000)
        /lib/ld-linux.so.2 (0xb7ee8000)
However, I invoked it as per your output today:
Code:
$ ruby extconf.rb
Start extconf.rb
Using II_SYSTEM=/opt/ingres
checking for iiapi.h... yes
checking for main() in -liiapi... yes
creating Makefile

$ make
cc -I. -I. -I/usr/lib/ruby/1.8/i486-linux -I. -DHAVE_IIAPI_H  -fPIC -fno-strict-aliasing -g -g -O2  -fPIC -I/opt/ingres/ingres/files  -c Ingres.c
Ingres.c: In function âgetColumnNamesAndTypesâ:
Ingres.c:1982: warning: cast from pointer to integer of different size
cc -shared -o Ingres.so Ingres.o -L"." -L"/usr/lib" -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic -L/opt/ingres/ingres/lib -lq.1 -lcompat.1 -lframe.1 -lrt -liiapi.1    -lruby1.8 -liiapi  -lpthread -ldl -lcrypt -lm   -lc

$ ldd Ingres.so
        linux-gate.so.1 =>  (0xb7fba000)
        libq.1.so => /opt/ingres/ingres/lib/libq.1.so (0xb7e29000)
        libcompat.1.so => /opt/ingres/ingres/lib/libcompat.1.so (0xb7cdd000)
        libframe.1.so => /opt/ingres/ingres/lib/libframe.1.so (0xb7bce000)
        librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0xb7bc1000)
        libiiapi.1.so => /opt/ingres/ingres/lib/libiiapi.1.so (0xb7b8e000)
        libruby1.8.so.1.8 => /usr/lib/libruby1.8.so.1.8 (0xb7abe000)
        libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7aa6000)
        libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7aa1000)
        libcrypt.so.1 => /lib/tls/i686/cmov/libcrypt.so.1 (0xb7a6f000)
        libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7a4a000)
        libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb78fb000)
        /lib/ld-linux.so.2 (0xb7fbb000)
As you can see, library related parameters to GCC are different in both cases. Is this a bug in extconf.rb? Perhaps you could update the README so that users run just "ruby extconf.rb" first and then to try to override library paths if necessary?

Thanks

Best Regards

Anton
sucha@dss.sk is offline   Reply With Quote
Old 2009-07-08   #5 (permalink)
Ingres Staff
 
grant's Avatar
 
Join Date: Mar 2007
Location: Valladolid, España
Posts: 381
Blog Entries: 1
Send a message via MSN to grant
Default

Hi,

this was a bug in 1.3.1 which is current fixed in main/trunk code line

regards

grant
__________________
Ingres PHP and Ruby Maintainer
http://blogs.planetingres.org/grant
grant is offline   Reply With Quote

Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


© 2009 Ingres Corporation. All Rights Reserved