Monday, December 3, 2007

Ubuntu 6.10 + RebeccaAIML 0.9871 Installation Notes

Here's my experience in installing RebeccaAIML on my Ubuntu 6.10 machine. This notes are being used for my report for my class project.

RebeccaAIML installation notes:

1. For Linux, use the version 0.9871 (Edmonson)

* Why this version?
In the RebeccaAIML website (http://rebecca-aiml.sourceforge.net) the latest version is 1.1tp3(Slatter), but this only works under Windows. So only use this latest version if you are working in Windows. -- The developer is working on the Linux version.
* There are so many options to download, which one is it??
The file to download is: RebeccaAIML-src-9871.* (the * indicates the extension of the file. The file is in compressed format, either: .tar.gz, or .zip, or some other compressed form). Go to: http://rebecca-aiml.sourceforge.net/download.htm to download -- It is IMPORTANT that you download the source package (with a "-src" in the filename), and not any other without it (e.g. RebeccaAIML-9871.zip). The source package one has a build_files directory in it, which contains the necessary configure, and Makefile to install RebeccaAIML. Also, in the source package there are installation guides both for Linux and Windows in the files linuxInstall.txt and windowsInstall.txt, respectively. SAVE YOURSELF A HEADACHE, and don't make the same mistake as me for struggling to try to install the non-source version of the package (cause of headache: couldn't find the linuxInstall.txt, configure file, and Makefile file).
* Why use RebeccaAIML? There are some other AIML programs that's available...
I am working on this program/assignment in C++, RebeccaAIML is one of the AIML packages that is written in C++, which means, I can (relatively) easily integrate it with my program. There are other AIML packages that are also written in C++ (go to http://www.alicebot.org/downloads/programs.html to check), but from what I've seen so far, RebeccaAIML has the most comprehensive documentation, and besides, the person who developed RebeccaAIML is very nice, and was very helpful when I e-mailed him asking questions about my trouble installing RebeccaAIML. If you have trouble with RebeccaAIML which are not covered in this notes, or that you cannot find any answer to your RebeccaAIML-related problem/questions (please don't come to him with your personal questions -- talk to Rebecca instead :)) after trying, and/or searching/discussing it in the web, forums, etc., e-mail him at: foreverlinux@yahoo.com

2. Dependencies

* What are dependencies?
Dependencies are other things that need to be installed in order for RebeccaAIML to work. This is a potential headache source as well, so this is IMPORTANT as well. You have been warned.
* Why is this important?
Because unless you have these dependencies installed, you won't get past the ./configure step. You need to do: ./configure, make, and make install to install RebeccaAIML.
* Okay, so what dependencies do I need to run RebeccaAIML?
The dependencies you'll (or RebeccaAIML) need are:
o Boost - some kind of extended C++ library
o XercesC - a C++ - based XML Parser (a program that can interpret XML)
o Qt4.1.1 or Qt4.*
* If you are using Ubuntu like me (I used Ubuntu 6.10) and are inexperienced in UNIX/Linux (like me), I would strongly suggest installing the dependencies through the Synaptic Package Manager. Why? For some reason, I almost could never got anything I install manually in Ubuntu 6.10 (without Synaptic Package Manager) to work properly.
* OK, here's some more details on the dependencies that you'll need:
o Boost
+ The latest version from the website (www.boost.org) is 1.34.7. In the Synaptic Package Manager, however, there is only version 1.33.1 (use the search tool, and enter the keyword: boost).
+ Just tell me which Boost files I need to get it on with RebeccaAIML!
There should be several files that are Boost-related in the list. You will need (at least, these are what I installed which are sufficient to allow me to install RebeccaAIML):
# libboost-dev
# libboost-doc
# libboost-date-time1.33.1
# libboost-date-time-dev
# libboost-filesystem1.33.1
# libboost-filesystem-dev
# libboost-regex1.33.1
# libboost-regex-dev

+ I don't know if the -doc or the -dev files (except for libboost-dev) are necessary for RebeccaAIML to work or not.
+ NOTE: IF YOU ARE NOT INTERESTED IN THE REASONING BEHIND THOSE FILES, AND JUST WANT TO GET RIGHT INTO USING RebeccaAIML, SKIP THE FOLLOWING BULLETS AND GO STRAIGHT TO THE XercesC POINT.
+ What are these files for? Why so many?
I have no idea. I could not find any explanation in any of the documentation why any of these dependencies are necessary (except for XercesC, because it is obvious we'll need some kind of XML parser since the AIML is in XML).
+ But there are other libboost stuff not being installed, e.g. libboost-graph, libboost-iostream...
Yes, it's because only those three were asked during the ./configure. So what happened with my experience was, I did not have Boost installed, and so at a certain point in the ./configure step, it checks for Boost functionalities, and gave an error asking for Boost to be installed. After I installed Boost, then it asked for Boost filesystem. After I installed Boost filesystem, it then asked for Boost date-time. After I installed Boost date-time, it then asked for Boost regex. ONLY after I installed those, the ./configure was able to proceed past checking Boost functionalities.
# A side note to this, let me tell a little more detail on how my experience installing Boost manually went:
* As I said before, in the Boost website (www.boost.org), the latest version is 1.34.7. So, that's what I downloaded.
* I first did a ./configure with specifying a directory for the installation, i.e.:

./configure --prefix=/boost/1_34_7/

* After the ./configure, the make and make install step was not a problem.
* I found the installed Boost header (.h) files in my /usr/include/boost directory. I could not find the libboost-*.* in any of the /lib directories though. Maybe I've overlooked it if they were scattered with the other lib- files in the /usr/lib directory.
* When I went back to the RebeccaAIML directory(/directory_where_it_was_extracted/RebeccaAIML-src-9871/build_files/autoconf) and did the ./configure for RebeccaAIML, it still could not find the Boost files. I tried including the directory where the Boost files are during ./configure, but it didn't work either.
* I decided to uninstall Boost before re-installing it. According to several posts in some forums (search Google: boost uninstall) the way to uninstall Boost is to just delete the Boost installation directory.
* And so I did, and I re-installed Boost, but this time I did not use the --prefix at ./configure. This time, the ./configure failed. Maybe I have to be in super-user mode (in the terminal, type: sudo su)...
* So I re-install Boost under a shallower directory: i.e. /boost, which worked fine as before.
* Then I did ./configure for RebeccaAIML again, and still it asked for Boost. This time I noticed that it was asking for a Boost filesystem functionalities, and I noticed in the directory I specified with --prefix at the Boost ./configure (/boost), there is a directory named filesystem. So I tried copying the folder (from the terminal using:

cp -rf )


into the /usr/lib/boost directory.
* This time, the RebeccaAIML ./configure found the Boost Filesystem functionality, YAY. But, unfortunately, it then asked for another Boost functionality and at this point, I had a splitting headache and decided to rely on Synaptic Package Manager instead to install Boost and the other dependencies (source of headache: errors keep popping up during ./configure).
o Xerces-C
+ What is Xerces-C and why do we need it?
It is a C++ -based XML parser necessary to understand (parse) AIML. AIML is represented in XML form, and so to be able to extract the information represented in AIML, we need the parser to do it.
+ So which Xerces-C package or version should I get?
The latest version of Xerces-C at the point this note is written is 2.8, but in Synaptic Package Manager (in my list, at least), there are only version 2.6, and 2.7. I chose version 2.6 (see reason in the second bullet after this). Save a headache, install through Synaptic Package Manager -- never fails.
+ So which Xerces files should I install? There are several of them in the list.
Here are the files I have installed:
# libxerces26c2
# libxerces26-dev
# libxerces2-java
+ Note: the RebeccaAIML developer (foreverlinux@yahoo.com) told me that Xerces 2.7 is "badly broken", so he recommended using 2.6 or 2.8 instead. In my Synaptic Package Manager, there are only 2.6, and 2.7, so I used 2.6 instead.
# A side note: initially I had 2.7 installed, and had some error messages during make install and loading RebeccaAIML, but it still ran. After uninstalling 2.7 as recommended, and installing 2.6, I still get the same error message in make install. So, I don't know if that makes any difference
o Qt4.1.1
+ What is Qt for?
Your guess is as good as mine.
+ Any particular reason why version 4.1.1?
I don't know. Maybe that's what was used at the time this version of RebeccaAIML was developed. RebeccaAIML ./configure asked for version 4.1.1, but that version doesn't seem to be around anymore, either on Qt's website (www.trolltech.com) nor in the Synaptic Package Manager (at least, according to my list). The ones available in my Synaptic list are versions 3, and 4.2. I installed 4.2, which seems to be sufficient.
+ Show me the files I need, please.
Certainly. Here are the files I installed:
# libqt4-core
# libqt4-dev
# libqt4-gui
# libqt4-qt3support
# libqt4-sql
# libqthreads-12
# in addition, before qt4, I had libqt3-mt

* Once you have those dependencies installed (all hail Synaptic Package Manager), configuring and installing RebeccaAIML is a breeze. Well, there are still some minor coughs, but nothing serious, or so it seems.

3. FINALLY - INSTALLING RebeccaAIML

* How do I go about and install RebeccaAIML on my machine?
First, be aware all the steps explained in this note is for installing RebeccaAIML on an Ubuntu 6.10 machine like mine. I cannot guarantee it will work for other platforms/OS of Linux or even a different Ubuntu release (e.g. 6.06, 7.04). For installation under Windows there's a whole different process altogether.
o For Windows, don't use version 0.9871, instead use the latest one: 1.1tp3 (Slatter); it comes with a Windows installer. Go to http://rebecca-aiml.sourceforge.net/userGuide.htm for a step-by-step explanation for the installation in Windows.
o For Ubuntu Linux 6.10: assuming you already installed all the required dependencies and downloaded the RebeccaAIML version 0.9871 source package:

1. Extract the RebeccaAIML-src-9871.* package into some directory (you choose).
2. In the extracted directory, you should have the following contents:
1. aiml (directory)
2. bin (directory)
3. build_files (directory)
4. conf (directory)
5. doc (directory) -- (the linuxINSTALL.txt & windowsINSTALL.txt are located in here)
6. include (directory)
7. resources (directory)
8. src (directory)
9. Authors.txt
10. dev-todo.txt
11. INSTALL.txt
12. license.txt
13. README.txt
14. rebecca.spec
15. ReleaseNotes.txt

3. Go to the build_files/autoconf sub-directory.
4. In this directory is where you will be doing all the ./configure, make, and make install, or make clean (to uninstall). So, in the terminal/shell/console do:

./configure


If for some reason it does not recognize your installed Qt location, you can specify it by doing (it should give you a hint on the parameter):

./configure --with-qt-dir=


If there is a doxygen error, just ignore it -- it's some documentation on the RebeccaAIML API, but you already have it in the directory where you extract RebeccaAIML under /doc). After the ./configure is successful, do:

make


Sit back, sip your coffee, and let the system do its thing. After it is done with make, first login as a super-user, if you haven't done so:

sudo su
(then type in your password)

After that, do:

make install


Again, sit back and take another sip of your coffee, and wait until it is done. Now here's where I had some error messages -- at the end of make install, it says:

blah blah blah install blah blah blah

...

Making install in regression
make[1]: Entering directory `//RebeccaAIML-src-9871/build_files/autoconf/regression'
make[2]: Entering directory `//RebeccaAIML-src-9871/build_files/autoconf/regression'
test -z "@datadir@/Rebecca/bin/release" || mkdir -p -- "@datadir@/Rebecca/bin/release"
/bin/sh ./libtool --mode=install /usr/bin/install -c 'regression' '@datadir@/Rebecca/bin/release/regression'
libtool: install: `@datadir@/Rebecca/bin/release' must be an absolute directory name
Try `libtool --help --mode=install' for more information.
make[2]: *** [install-binPROGRAMS] Error 1
make[2]: Leaving directory `//RebeccaAIML-src-9871/build_files/autoconf/regression'
make[1]: *** [install-am] Error 2
make[1]: Leaving directory `//RebeccaAIML-src-9871/build_files/autoconf/regression'

make: *** [install-recursive] Error 1


and that's the end of the line of the make install.


4. TESTING RebeccaAIML (Ooh, this is getting exciting!)

* The first way -- and probably the easiest way, to test RebeccaAIML is to:
o Go to your RebeccaAIML installation directory (mine is at): /usr/local/share/Rebecca
o From there, go to /bin/release
o You should see a console executable. Run it: in the terminal/shell/console type:

./console

o and it should start loading a bunch of .aiml categories
o If everything goes well, you should see something like this:

[Rebecca now fully loaded]
[Number of categories loaded: 46105]
[Type /exit to exit]

Symbolic reduction: SET PREDICATES OM
[Warning star Tag Size Exceeded]
Rebecca says: Hello!
You say> hello

Internal information:
=====================
hello : Hello : *
=====================

Rebecca says: Hi there!

o And VOILA! You're chatting with Rebecca!
* The second way, which I had a less than successful experience, is to try the code from the RebeccaAIML's Sourceforge website: http://rebecca-aiml.sourceforge.net/userGuide.htm#cpp_programming
o If you are NOT using Windows, ignore the first sample code which uses

#include
using namespace rebecca;


on the top. The network thing is something that comes with the Windows installation, and not with the Linux version. Use the second example called the "embedded" variant by the guide. However, I was not successful in trying the code as-is (with some modifications to the paths). If you want to start implementing RebeccaAIML into your program, I would suggest taking a look at the console sample source code (mine is located in: /usr/local/share/Rebecca/src/samples/console).
o If you ARE doing this from Windows, then by all means, use that first example as reference. The guide says that it will save you many lines of codes of initiating the AIML components. What I understand so far about this method is that it is using the Internet Communications Engine that comes with the Windows installation of RebeccaAIML, that enables your machine to be a server and do the XML (or AIML) parsing like it was done on a web server (i.e. like browsing the internet).

And Finally, UNINSTALLING RebeccaAIML

* In the directory //RebeccaAIML-src-9871/build_files/autoconf do:

make clean