Installing TOra with Oracle Support on Ubuntu 9.04 (Jaunty Jackalope)

Sep 4, 2009 / By Brad Hudson

Tags: ,

Considering my recent update to Ubuntu 9.10, I decided to have another go at getting TOra up and running. This time I am tackling a 64-bit system rather than the 32-bit “Hardy Heron” I had done previously.

On my way, I found some odd issues that I will describe here. All in all, it was a good few hours of cobbling together the pieces I needed to proudly present to you . . .

Installing TOra with Oracle support on Ubuntu 9.04 (Jaunty Jackalope)

Conventions and Caveats

  • I use sudo for everything because logging in to root shells is just bad practice.
  • I plug vi whenever possible, because vi is the greatest (and to annoy emacs people).
  • I did this all in a KDE desktop, which means that some things I say may sound like I use KDE. Commands issued are in pre-formatted text without any prompt gunk in front of them, so cut and paste to your heart’s content.
  • Output is also in pre-formatted text and I use it sparingly where relevant. Apt likes to output lots of text. I think it’s lonely.
  • Some instructions are pasted from the original so you will not need to refer to my last howto to get this working. For an all-new jocular experience, no attempts at humour were recycled.
  • When I say “dep”, I actually mean dependancy.

Environment

This is based on a 64-bit install of Ubuntu 9.10 using the Oracle 11 clients. The system itself is an AMD Athlon 64 7750 Black Box Editions at 2.7GHz with 4GB DDR2.

The desktop I am running this time is KDE4.3 from the backports ppa. This is a nice desktop env and has fewer issues than the KDE4 that originally shipped with Jaunty. It did cause one issue that I chose to ignore rather than tackle, which is that the kdebase-dev package I had available was for 4.2, not 4.3. I still have no idea what the KDE enhancements are, even after running TOra with them compiled in. This is not earth-shattering, and has no bearing on the task at hand.

Get the packages

Find an acceptable build location in your filesystem, cd to there and then get the tora source deb package.

sudo apt-get source tora

That should drop and unpack the TOra source in your current directory. Now get the packages. The link for the 64-bit packages I used is here.

Again, the login you need is free to register. The files we want this time around are:

  • oracle-instantclient11.1-basiclite-11.1.0.7.0-1.x86_64.rpm
  • oracle-instantclient11.1-devel-11.1.0.7.0-1.x86_64.rpm
  • oracle-instantclient11.1-sqlplus-11.1.0.7.0-1.x86_64.rpm

Install the prerequisites and development libraries

The first stop is to hit up apt for some loving. This is the complete list of packages I installed for this. We’re also installing alien for converting the oracle rpm files. Several of these deps are actually needed to install TOra later, so they are here for convenience.

sudo apt-get install libqt3-mt-dev libqt3-compat-headers libqscintilla-dev \
build-essential g++ gcc autoconf automake flex zlib1g-dev docbook-xsl \
debhelper alien libaio1 dpatch fakeroot xsltproc makeinfo texinfo \
libqt3-mt-psql libqt3-mt-odbc

This is about where I had the problems with the kde4 lib versions. Installing these deps will each spawn more deps so the package list may be long by the time all deps are satisfied. Smoke if you got ‘em.

Next install the oracle clients. In the directory where you installed them run this to convert and install the packages in one fell swoop.

sudo alien -i *.rpm

Now that we have the packages, the deps and the sources, it’s time to set up

Environment Variables

The first step is to set the library path for the Oracle libs. To do this, run the following:

sudo echo /usr/lib/oracle/11.1/client64/lib > /etc/ld.so.conf.d/oracle.conf
ldconfig

Here is where I hit a gotcha this time around. When I tried to build, my compiler respected the library path okay, but would not find the include files required for the build; for this I added a CFLAGS environment variable. (The CFLAGS is used by the gcc compiler for extra compile arguments that can be used to add a path, add more or less debugging information and even customize the binary to your cpu/arch/system all of which is totally out of scope here.)

A little later in the process, I also found that inside TOra is a package called loki which respects neither the include path, nor the CFLAGS; but it does respect CPPFLAGS (the same as CFLAGS only for the C++ language), so I added it in as well. While we’re at it, let’s add the Oracle environment.

export CFLAGS="-I/usr/include/oracle/11.1/client64"
export CPPFLAGS="-I/usr/include/oracle/11.1/client64"
export ORACLE_HOME="/usr/lib/oracle/11.1/client64"
export LD_LIBRARY_PATH="/usr/lib/oracle/11.1/client64/lib"
export TNS_ADMIN="/usr/lib/oracle/11.1/client64"

Again, you will want to add the Oracle environment info (the last three lines above) to your .bashrc, so that they will be used after the required logout/login. Paste this into your shell and you get +1 lazyproductivity stat.

echo export "ORACLE_HOME=/usr/lib/oracle/11.1/client64" >> ~/.bashrc
echo export "LD_LIBRARY_PATH=/usr/lib/oracle/11.1/client64/lib" >> ~/.bashrc
echo export "TNS_ADMIN=/usr/lib/oracle/11.1/client64" >> ~/.bashrc

Building and installing TOra

When you installed the source package for TOra, it should have unpacked the files on it’s own. Go there now.

cd /path/to/deb/source/tora-1.3.23

Now use vi to edit the debian/rules file. Replace line 25 with this.

./configure --prefix=/usr --with-instantclient
--with-oracle-includes=/usr/include/oracle/11.1/client --without-kde
--without-rpath --disable-new-check --enable-libsuffix=

Here is the diff output of that change for any patchers out there:

diff debian/rules.orig debian/rules
25c25
<       ./configure --prefix=/usr --without-oracle --without-rpath
--disable-new-check --with-kde --enable-libsuffix= --infodir=/usr/share/info
---
>       ./configure --prefix=/usr --with-instantclient
--with-oracle-includes=/usr/include/oracle/11.1/client --without-kde
--without-rpath --disable-new-check --enable-libsuffix=

Now we’re ready for the big show. Cut and paste the following command because it’s way too much to type. Note here that I am now using fakeroot to build. The build process requires root privileges for the “make test” segment of the build, so fakeroot basically allows this by doing that its name suggests.

fakeroot debian/rules binary

Faster than Data can reinsert the isolinear chips into the command console, you have a deb package in the directory above where you are doing the build, fondly known as “../“. The build was actually about 4m32.025s on my system, give or take.

ls ../*.deb
../tora_1.3.23-1_amd64.deb

Install it using the following:

dpkg -i ../tora_1.3.23-1_amd64.deb

The Update Issue Again

A simpler way to stop the package from updating (and thereby undoing all of your hard-fought doings).

echo 'tora hold' | sudo dpkg --set-selections

’nuff said.

End Game Redux

Don’t forget your tnsnames.ora. We set up the environment to use TNS_ADMIN=/usr/lib/oracle/11.1/client which means that tora will look for them there. The easiest way I found was to get the production tnsnames.ora file from the Oracle server itself and place it in $TNS_ADMIN. Once you have done so, start TOra and enjoy. Remember to start it from the xterm session that has the environment variable set if you have not yet logged out/in.

Nifty KDE trick

I wanted it to work with my current menu without logging off. I have far too many critical things open to close them all down so I decided to take a shortcut. Here is what I did.

  1. Right click on the big blue “K” menu button.
  2. Select “Menu Editor”.
  3. In the KDE menu editor, on the left side, click the + to expand the tree.
  4. Right click the TOra and select Copy.
  5. Right click the TOra icon again and select Paste.
  6. Left click on the TOra-2 icon.
  7. In the command box enter
    ORACLE_HOME=/usr/lib/oracle/11.1/client64 LD_LIBRARY_PATH=/usr/lib/oracle/11.1/client64/lib TNS_ADMIN=/usr/lib/oracle/11.1/client64 tora
  8. Click the File menu, then Quit.
  9. Click the Save button to save your changes.

Now in the “K” menu click K->Applications->Development->TOra-2 and enjoy your selecting.

So far so good. I have worked with it a bit and have not encountered any issues for my day-to-day needs. I’d love to hear any comments or feedback on this, and also let me know if you encountered any dependencies that are not listed here.

Coming soon “Installing TOra with Oracle support on Ubuntu 9.10 (Karmic Koala)”.

References

The TOra homepage
Installing TOra with Oracle support on Ubuntu 8.04LTS (Hardy Heron)
Kubuntu linux

15 Responses to “Installing TOra with Oracle Support on Ubuntu 9.04 (Jaunty Jackalope)”

  • vSanuke says:

    I have a problem with install/compile tora-2.0.0/2.1.0 with Oracle-10.2.0.4 client on Ubuntu 9.10 Karmic. And wait when your will testing it. Thanks!

  • Brad Hudson says:

    I should be doing this soon after the release of Karmic (in 6 days!). If you let me know what the error is, as well as the architecture of the system in question I may be able to see the problem.

  • vSanuke says:

    I tried to compile tora-2.0.0 package from the repository ubuntu-karmic-amd64 with support oracle-instantclient-10.2.0.4-basic 64bit, which works with our databases (not supported connection from oracle-11g-client). I used to build: cmake -DORACLE_PATH_LIB=/usr/lib/oracle/10.2.0.4/client64/lib -DORACLE_PATH_INCLUDES=/usr/include/oracle/10.2.0.4/client64 ./
    The result was: warning: libstdc++.so.5, needed by /usr/lib/oracle/10.2.0.4/client64/lib/libocci.so
    This compilation without support oracle runs without errors.
    Same thing with the package tora-2.1.0.tar.gz from sourceforge.net

    But compilation with support oracle on ubuntu 9.04 janty finished successfull with:
    /usr/bin/ld: warning: libstdc++.so.5, needed by /usr/lib/oracle/10.2.0.4/client64/lib/libocci.so, may conflict with libstdc++.so.6
    [100%] Built target tora
    tora works successfully under janty.

  • vSanuke says:

    I was install libstdc++.so.5 janty package in my ubuntu karmic and tora-2.1.0 with oracle-instantclient-10.2.0.4 compiled successfull.

  • Brad Hudson says:

    Nice. Thanks for the update.

  • The current version (11.2.0.1) does not seem to work with alien. It fails with this error:

    Error executing “LANG=C rpm -qp –queryformat %{NAME} oracle-instantclient11.2-basic-11.2.0.1.0-1.i386.rpm”: at /usr/share/perl5/Alien/Package.pm line 482.

    11.1.0.7 worked fine with your instructions however. Thanks!

  • Brad Hudson says:

    Strange, I just re-downloaded them yesterday and I got 11.1.0.7.0-2. I’ll check into it. What version of Ubuntu are you using?

    50% done the install doc for 9.10 x86_64, just need to do a bit more testing.

  • Brad Hudson says:

    Colin. I tried installing the packages on 9.10 and it worked like a charm. It could be that there have been some changes to the rpm format and a newer version of alien fixed it. 9.10 uses rpm version 4.70, not sure about 9.04 as I have already updated all my boxes. The referenced code is a generic function to call external commands, and does not really lead to a cause for it without more stack trace.

    Oddly there is no 11.2.0.1.0-1 rpm on the oracle site for x86_64. Only 11.1 packages. I assume they’ll come out soon.

  • [...] only get PostgreSQL support. For anything else you need to build TOra from source. Instructions are here, courtesy of Brad Hudson. Follow them. In particular, do not skip installing the prerequisite [...]

  • [...] TOra homepage Installing TOra with Oracle support on Ubuntu 8.04LTS (Hardy Heron) Installing TOra with Oracle support on Ubuntu 9.10 (Jaunty Jackalope) Kubuntu [...]

  • Brad Hudson says:

    Thanks for the mention, I’m glad you found it useful. I just updated the instructions for Ubuntu 9.10 (Karmic Koala) and they can be found at http://www.pythian.com/news/4747/installing-tora-with-oracle-support-on-ubuntu-9-10-karmic-koala.

  • Tyler says:

    I get it to compile ok, but Oracle is not listed as a connection. I’ve gone over the initial setup a couple of times (includes, ldconfig, exports), but still no good. I’ve had issues getting fakeroot to behave for me, so I’ve just used sudo. I’m still working out the fakeroot permission issues. Anyway, I see the following from the config output:
    checking for oracle… configure: WARNING: no

    I was expecting a yes, but reading the configure script hasn’t convinced me I will. I am curious as to what other people see there…

  • Tyler says:

    http://enoriver.net/index.php/2009/10/29/building-tora-with-oracle-support-on-jaunty/ had the answer. For 11.2 support, the debian/rules line needed just a bit more. Works great now; thank you for the step-by-step instructions.

  • Brad Hudson says:

    Thanks for the update Tyler. Oddly enough my instructions worked for me with 9.04 and Oracle 11.2 with no changes. The changes mentioned in the referenced blog mention adding in some configure options for TOra, but these should be taken from the environment at build time anyways.

    The issue with fakeroot may very well be permissions on the build tree. If you extract the file, or attempt to build as root at any time then fakeroot will no longer work.

  • [...] TOra homepage Installing TOra with Oracle support on Ubuntu 8.04LTS (Hardy Heron) Installing TOra with Oracle support on Ubuntu 9.04 (Jaunty Jackalope) Installing TOra with Oracle Support on Ubuntu 9.10 (Karmic Koala) Kubuntu [...]

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>