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
sudofor 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.
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:
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
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
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.
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
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.
- Right click on the big blue “K” menu button.
- Select “Menu Editor”.
- In the KDE menu editor, on the left side, click the + to expand the tree.
- Right click the TOra and select Copy.
- Right click the TOra icon again and select Paste.
- Left click on the TOra-2 icon.
- 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
- Click the File menu, then Quit.
- 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)”.