This forum is no longer active. Please post your questions to our new community site

[Linux] Problem installing gem in RubyStack 1.2-beta-0

Subscribe to [Linux] Problem installing gem in RubyStack 1.2-beta-0 9 post(s), 2 voice(s)

 
Avatar rob99 20 post(s)

Hi,

I encountered the following when trying to install sqlite3-ruby gem. Note stack installed as non-root user:


bash-3.00$ gem environment
RubyGems Environment:
  - RUBYGEMS VERSION: 1.0.1 (1.0.1)
  - RUBY VERSION: 1.8.6 (2007-03-13 patchlevel 0) [i686-linux]
  - INSTALLATION DIRECTORY: /export/myhome/rubystack-1.2-beta-0/ruby/lib/ruby/gems/1.8
  - RUBY EXECUTABLE: /export/myhome/rubystack-1.2-beta-0/ruby/bin/ruby
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-linux
  - GEM PATHS:
     - /export/myhome/rubystack-1.2-beta-0/ruby/lib/ruby/gems/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - <a href="http://gems.rubyforge.org">http://gems.rubyforge.org</a>
bash-3.00$
bash-3.00$ gem install sqlite3-ruby
Building native extensions.  This could take a while...
ERROR:  Error installing sqlite3-ruby:
        ERROR: Failed to build gem native extension.
/export/myhome/rubystack-1.2-beta-0/ruby/bin/ruby extconf.rb install sqlite3-ruby
checking for fdatasync() in -lrt... no
checking for sqlite3.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.
Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/export/myhome/rubystack-1.2-beta-0/ruby/bin/ruby
        --with-sqlite3-dir
        --without-sqlite3-dir
        --with-sqlite3-include
        --without-sqlite3-include=${sqlite3-dir}/include
        --with-sqlite3-lib
        --without-sqlite3-lib=${sqlite3-dir}/lib
        --with-rtlib
        --without-rtlib
Gem files will remain installed in /export/myhome/rubystack-1.2-beta-0/ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.2 for inspection.
Results logged to /export/myhome/rubystack-1.2-beta-0/ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.2/ext/sqlite3_api/gem_make.out
bash-3.00$
bash-3.00$ which ruby
/export/myhome/rubystack-1.2-beta-0/ruby/bin/ruby

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

Hi rob99,

It seems that sqlite gem can not find the sqlite directory. Try this:

$ gem install sqlite3-ruby -- --with-sqlite3-dir=/export/myhome/rubystack-1.2-beta-0/sqlite
 
Avatar rob99 20 post(s)

Hi beltran,

Thanks for your response. I tried your suggestion but got same result:


bash-3.00$ gem install sqlite3-ruby -- --with-sqlite3-dir=/export/myhome/rubystack-1.2-beta-0/sqlite/
Bulk updating Gem source index for: <a href="http://gems.rubyforge.org">http://gems.rubyforge.org</a>
Building native extensions.  This could take a while...
ERROR:  Error installing sqlite3-ruby:
        ERROR: Failed to build gem native extension.
/export/myhome/rubystack-1.2-beta-0/ruby/bin/ruby extconf.rb install sqlite3-ruby -- --with-sqlite3-dir=/export/myhome/rubystack-1.2-beta-0/sqlite/
checking for fdatasync() in -lrt... no
checking for sqlite3.h... yes
checking for sqlite3_open() in -lsqlite3... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.
Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/export/myhome/rubystack-1.2-beta-0/ruby/bin/ruby
        --with-sqlite3-dir
        --with-sqlite3-include
        --without-sqlite3-include=${sqlite3-dir}/include
        --with-sqlite3-lib
        --without-sqlite3-lib=${sqlite3-dir}/lib
        --with-rtlib
        --without-rtlib
        --with-sqlite3lib
        --without-sqlite3lib
Gem files will remain installed in /export/myhome/rubystack-1.2-beta-0/ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.2 for inspection.
Results logged to /export/myhome/rubystack-1.2-beta-0/ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.2/ext/sqlite3_api/gem_make.out
bash-3.00$

 
Avatar rob99 20 post(s)

Further info:


bash-3.00$ cat ./ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.2/ext/sqlite3_api/mkmf.log
have_library: checking for fdatasync() in -lrt... -------------------- no
"gcc -o conftest -I. -I/export/myhome/rubystack-1.2-beta-0/ruby/lib/ruby/1.8/i686-linux -I. -I/export/myhome/rubystack-1.2-beta-0/sqlite//include  -I/export/myhome/rubystack-1.2-beta-0/common/include conftest.c  -L'/export/myhome/rubystack-1.2-beta-0/ruby/lib' -Wl,-R'/export/myhome/rubystack-1.2-beta-0/ruby/lib' -L'/export/myhome/rubystack-1.2-beta-0/sqlite//lib' -Wl,-R'/export/myhome/rubystack-1.2-beta-0/sqlite//lib' -L/export/myhome/rubystack-1.2-beta-0/common/lib -rdynamic -Wl,-export-dynamic     -lruby-static -lrt  -lpthread -ldl -lcrypt -lm   -lc" 
conftest.c: In function `t':
conftest.c:3: error: `fdatasync' undeclared (first use in this function)
conftest.c:3: error: (Each undeclared identifier is reported only once
conftest.c:3: error: for each function it appears in.)
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { void ((*volatile p)()); p = (void ((*)()))fdatasync; return 0; }
/* end */
"gcc -o conftest -I. -I/export/myhome/rubystack-1.2-beta-0/ruby/lib/ruby/1.8/i686-linux -I. -I/export/myhome/rubystack-1.2-beta-0/sqlite//include  -I/export/myhome/rubystack-1.2-beta-0/common/include conftest.c  -L'/export/myhome/rubystack-1.2-beta-0/ruby/lib' -Wl,-R'/export/myhome/rubystack-1.2-beta-0/ruby/lib' -L'/export/myhome/rubystack-1.2-beta-0/sqlite//lib' -Wl,-R'/export/myhome/rubystack-1.2-beta-0/sqlite//lib' -L/export/myhome/rubystack-1.2-beta-0/common/lib -rdynamic -Wl,-export-dynamic     -lruby-static -lrt  -lpthread -ldl -lcrypt -lm   -lc" 
/usr/bin/ld: skipping incompatible /export/myhome/rubystack-1.2-beta-0/ruby/lib/libruby-static.a when searching for -lruby-static
/usr/bin/ld: cannot find -lruby-static
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { fdatasync(); return 0; }
/* end */
--------------------
have_header: checking for sqlite3.h... -------------------- yes
"gcc -E -I. -I/export/myhome/rubystack-1.2-beta-0/ruby/lib/ruby/1.8/i686-linux -I. -I/export/myhome/rubystack-1.2-beta-0/sqlite//include  -I/export/myhome/rubystack-1.2-beta-0/common/include  conftest.c -o conftest.i" 
checked program was:
/* begin */
1: #include <sqlite3.h>
/* end */
--------------------
have_library: checking for sqlite3_open() in -lsqlite3... -------------------- no
"gcc -o conftest -I. -I/export/myhome/rubystack-1.2-beta-0/ruby/lib/ruby/1.8/i686-linux -I. -I/export/myhome/rubystack-1.2-beta-0/sqlite//include  -I/export/myhome/rubystack-1.2-beta-0/common/include conftest.c  -L'/export/myhome/rubystack-1.2-beta-0/ruby/lib' -Wl,-R'/export/myhome/rubystack-1.2-beta-0/ruby/lib' -L'/export/myhome/rubystack-1.2-beta-0/sqlite//lib' -Wl,-R'/export/myhome/rubystack-1.2-beta-0/sqlite//lib' -L/export/myhome/rubystack-1.2-beta-0/common/lib -rdynamic -Wl,-export-dynamic     -lruby-static -lsqlite3  -lpthread -ldl -lcrypt -lm   -lc" 
conftest.c: In function `t':
conftest.c:3: error: `sqlite3_open' undeclared (first use in this function)
conftest.c:3: error: (Each undeclared identifier is reported only once
conftest.c:3: error: for each function it appears in.)
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { void ((*volatile p)()); p = (void ((*)()))sqlite3_open; return 0; }
/* end */
"gcc -o conftest -I. -I/export/myhome/rubystack-1.2-beta-0/ruby/lib/ruby/1.8/i686-linux -I. -I/export/myhome/rubystack-1.2-beta-0/sqlite//include  -I/export/myhome/rubystack-1.2-beta-0/common/include conftest.c  -L'/export/myhome/rubystack-1.2-beta-0/ruby/lib' -Wl,-R'/export/myhome/rubystack-1.2-beta-0/ruby/lib' -L'/export/myhome/rubystack-1.2-beta-0/sqlite//lib' -Wl,-R'/export/myhome/rubystack-1.2-beta-0/sqlite//lib' -L/export/myhome/rubystack-1.2-beta-0/common/lib -rdynamic -Wl,-export-dynamic     -lruby-static -lsqlite3  -lpthread -ldl -lcrypt -lm   -lc" 
/usr/bin/ld: skipping incompatible /export/myhome/rubystack-1.2-beta-0/ruby/lib/libruby-static.a when searching for -lruby-static
/usr/bin/ld: cannot find -lruby-static
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { sqlite3_open(); return 0; }
/* end */
--------------------
bash-3.00$

 
Avatar rob99 20 post(s)

Possibly related??:

http://www.linuxquestions.org/questions/slackware-14/default-ruby-missing-library-test-case-provided.-622927/

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

Hi rob99,

It seems that the gem can not load the libraries. Please try this, I have installed sqlite3 gem successfully:


$ ./rubyconsole
bash$ . scripts/setenv.sh
bash$ gem install sqlite3-ruby -- --with-sqlite3-dir=/export/myhome/rubystack-1.2-beta-0/sqlite

 
Avatar rob99 20 post(s)

beltran, thanks once again.

Unfortunately I got the same result as before.

Do you think there’s any merit to the link above, which says ruby need to be compiled with sqlite present?

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

Mmmm, I don’t think that this is the problem. I could install the gem in the Rubystack.

Do you have the build-essential packages? These packages are required to compile the sqlite3 gem.

 
Avatar rob99 20 post(s)

I think so, though as I mentioned – I’m not root. Not sure if that has any implications….


bash-3.00$ gcc -v
Reading specs from /usr/lib/gcc/x86_64-redhat-linux/3.4.6/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=x86_64-redhat-linux
Thread model: posix
gcc version 3.4.6 20060404 (Red Hat 3.4.6-8)