The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Common pitfalls when installing the ibm_db gem

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Leon Katsnelson

Posts: 105
Nickname: db2onrails
Registered: Jun, 2006

Leon Katsnelson is a Program Director at the IBM Toronto Lab working on spreading the joy of DB2.
Common pitfalls when installing the ibm_db gem Posted: Nov 11, 2008 2:44 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Leon Katsnelson.
Original Post: Common pitfalls when installing the ibm_db gem
Feed Title: DB2 on Rails
Feed URL: http://feeds.feedburner.com/DB2OnRails
Feed Description: Agile development for enterprises large and small
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Leon Katsnelson
Latest Posts From DB2 on Rails

Advertisement

Installing the ibm_db gem on Windows is as easy as running gem install ibm_db. Next to no problems have been reported, as the the installation is as smooth as it gets. On Linux things can get a bit trickier though. Having helped dozens of people resolve installation problems, I’ve gathered some insight into what the common pitfalls are when installing the ibm_db gem on *nix systems. Here I’ve put together a checklist, in case you’re experiencing issues with your own install.

First and foremost, the most common error message is a variant of the following:


$ sudo gem install ibm_db
Building native extensions.  This could take a while...
ERROR:  Error installing ibm_db:
	ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb install ibm_db
checking for SQLConnect() in -ldb2... 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
  ...
  ...

The gem fails to install because the SQLConnect() function provided by DB2’s development headers (which are required to build the gem) cannot be found/loaded.

This brings us to our quick checklist:

1. Have you sourced the profile? This is done by running:

. /home/db2inst1/sqllib/db2profile

You may need to replace the dot, with source depending on your shell.

2. Have you specified where DB2’s directory and library are to be found? You can do so by running:


export IBM_DB_DIR=/home/db2inst1/sqllib
export IBM_DB_LIB=/home/db2inst1/sqllib/lib32

3. Did you install the required development headers during the installation? These are available by selecting “Base application development tools” under the section “Application Development Tools” in the DB2 Setup Wizard (having selected a “custom” installation beforehand).

You can double check this by running:

ls /home/db2inst1/sqllib/include

This should show you a series of .h files, including sqlcli1.h. If you don’t see them, then you need to repeat the setup procedure so as to add the development tools. Likewise, you should also see a series of .so files, including
libdb2.so when you run: ls /home/db2inst1/sqllib/lib32.

4. Are you trying to perform the installation when logged in as the db2inst1 user? If you’re doing this, it’s best not to. It doesn’t matter if db2inst1 is a suoder or not. Don’t run sudo gem install ibm_db as the instance user.

5. If nothing else works, try to install as the root user (on certain systems sudo won’t cut it). The following complete procedure works in 99% of cases:


sudo -s
. /home/db2inst1/sqllib/db2profile
export IBM_DB_DIR=/home/db2inst1/sqllib
export IBM_DB_LIB=/home/db2inst1/sqllib/lib32
gem install ibm_db

If this checklist doesn’t help you, then you can reach for the RubyForge forum, where the DB2 on Rails community and the IBM team will be happy to help you.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Read: Common pitfalls when installing the ibm_db gem

Topic: Hiding system files such as /usr and /bin on OSX Leopard Previous Topic   Next Topic Topic: RubyForge now running Subversion 1.5

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use