The Linguistica Project

On this page you will find information for setting up a development system under Mac OSX and under Windows; we will have information about Linux up soon -- it's pretty straightforward.

Linguistica for Mac

Building Linguistica as an XCode project with Qt

Getting started with XCode and Qt

It is recommended that you use an Integrated Development Environment (or IDE ) to work on Linguistica, due to its complexity and the number of files within the project. If you are using a Mac, then you may already have XCode (a Mac IDE) installed.

If XCode is not installed on your machine, you can download the disk image from Apple Developer Connection (http://developer.apple.com/tools/xcode/). If you have not already done so, you will have to register with Apple as a Developer, which is free. Make sure you choose the correct version of XCode to install for your operating system. For example, XCode 3.0 will only work on OS X 10.5 (Leopard) or higher.

NOTE: You must install XCode BEFORE you install Qt, or XCode will fail to install. You might have to uninstall Qt if you have installed it without having installed XCode first.

The next step is to install Qt. Linguistica is built on Qt 3, which can be downloaded via FTP from ftp://ftp.trolltech.com/qt/source. We recommend installing version 3.3.8b.

In order to successfully use Qt, three environment variables have to be set up: QTDIR, PATH and QMAKESPEC.

QTDIR has to be set to the directory containing the Qt distribution. (This may be /usr/lib/qt3, for example.)

To be able to invoke the Qt tools from the command line the PATH variable needs to be set. Simply add ${QTDIR}/bin to the end of your PATH.

For Leopard Users

If you are using OS X 10.5 (Leopard) or higher, you will need to install a patch to get Qt 3 to compile successfully. (The patch is taken from http://forum.qtfr.org/viewtopic.php?id=6337.)

Open the file $QTDIR/include/qglobal.h. This is the file that checks whether your operating system is compatible with Qt. Since Qt 3 was released before Leopard, it fails to recognize the operating system even though OS X 10.5 is otherwise perfectly compatible with Qt 3. In order to get around the compatibility check, add the following lines right after line 188 in the original file.

# if !defined (MAC_OS_X_VERSION_10_5)
# define MAC_OS_X_VERSION_10_5 MAC_OS_X_VERSION_10_4 + 1
# endif
You also need edit the lines immediately following your insertion. The original reads
# if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4)
# error "This version of Mac OS X is unsupported"
# endif
Of course, to allow 10.5, this must be edited to
# if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5)
# error "This version of Mac OS X is unsupported"
# endif
That's it for qglobal.h. Now open $QTDIR/src/kernel/qt_mac.h. Replace the line 64 block
#if !defined(Q_WS_MACX) || QT_MACOSX_VERSION < 0x1020 || QT_MACOSX_VERSION >= 0x1030
# define QMAC_NO_FAKECURSOR
#endif
by
# if! defined (Q_WS_MACX) | | QT_MACOSX_VERSION <0x1020 | | (QT_MACOSX_VERSION> = 0x1030 & & QT_MACOSX_VERSION <= 0x1040)
# define QMAC_NO_FAKECURSOR
#endif
Finally, open $QTDIR/src/kernel/qcursor_mac.cpp. Replace the block starting on line 184 which reads
#ifdef QMAC_USE_BIG_CURSOR_API
char *big_cursor_name;
#endif
CursorImageRec *ci;
struct {
QMacAnimateCursor *anim;
ThemeCursor curs;
by
#ifdef QMAC_USE_BIG_CURSOR_API
char *big_cursor_name;
#endif
#ifdef QMAC_NO_FAKECURSOR
CursorImageRec *ci;
#endif
struct {
QMacAnimateCursor *anim;
ThemeCursor curs;
Also replace the block starting on line 274
if(type == TYPE_CursPtr) {
if(curs.cp.hcurs && curs.cp.my_cursor)
free(curs.cp.hcurs);
} else if(type == TYPE_CursorImage) {
free(curs.ci);
with
if(type == TYPE_CursPtr) {
if(curs.cp.hcurs && curs.cp.my_cursor)
free(curs.cp.hcurs);
#ifdef QMAC_NO_FAKECURSOR
} else if(type == TYPE_CursorImage) {
free(curs.ci);
#endif
You should now be able to build Qt 3 on your machine.

Compiling Linguistica with XCode

At this point, you should have both Qt 3 and XCode successfully installed.

Once you have saved the source (.cpp) and header (.h) files of Linguistica, place them all into a single folder. In Terminal, navigate to the location of the files. (For example, if you have saved them on the Desktop in a folder called Linguistica, your current working directory should be ~/Desktop/Linguistica.) In that directory, type the following to build the Linguistica project file.

$ qmake -project
and:
$ qmake -spec macx-pbuilder
Linguistica has now successfully been built as an XCode project. To open the project, either type
$ open filename.pbproj
or click on filename.pbproj in Finder.

XCode will now prompt you to upgrade the project to an ".xcodeproj" (rather than a ".pbproj") file. Click "Upgrade a Copy" and save.

One last step: Select Project in the menubar and click on "Upgrade All Targets in Project to Native". Click "Agree" on the ensuing dialog box and close the popup log file.

You should be on your way!

Linguistica for Linux

Getting Qt installed

For the code written in 2006, the correct version of Qt is 3.3.8.

However, for the version built in 2010, the correct version of Qt is later. Some versions expect 4.8.6, and others 4.6.0. Here are some notes from our experiences, and best practices that we have observed.

A good place to install the system is in /usr/local/Qt-4.6.0 (or whatever).

The system variables QTDIR and PATH must be defined. QTDIR will be /usr/local/[Qt-version], and PATH will include $QTDIR/bin. In addition, MANPATH should be defined to include $QTDIR/man.

LD_LIBRARY_PATH should include $QTDIR/lib

export QTDIR PATH MANPATH LD_LIBRARY_PATH

Normally you will put this into your .profile file in your home directory.

In the folder in which you have placed Qt4, type ./configure. (You may have to prefix that by "sudo" and provide the su password.) Answer the next question with 'o' (open source). This will start the installation, which will last a while.

If you run into the problem basic xlib functionality test failed, installing 'libxext-dev' solved the problem for me.

Then run: sudo make

then run: sudo make install

We use pkg for package management. Make sure that the QT *.pc files are in a directory contained in PKG_CONFIG_PATH. For example, for us, PKG_CONFIG_PATH = /usr/local/Trolltech/Qt-4.6.0/lib/pkgconfig, and we export that setting with export PKG_CONFIG_PATH.

Because the linguistica package running in Qt4 (though not the one running in Qt3) has its own Makefile, do not run qmake; just run make.

Linguistica for Windows

Building a Qt 3.3.8 project under windows

We have an installation running under Vista and under XP. We are not quite sure how easy it will be to reproduce this. We have installed a copy of Visual Studio 6 (although Vista is not at all happy about installing it, but it runs anyway). We have a copy of the open version of Qt3 that used to be distributed by Trolltech; we are not sure if they are still distributing it, and we are trying to find out if we can distribute it too. If you install it under XP, it is possible to install a plug-in to Visual Studio that allows you to compile and execute from within Visual Studio. This does not appear to work under Vista. However, if you have MS C++ install, and have its /bin/nmake on your system's PATH variable, and likewise have the Qt3 qmake on your system's PATH variable, you can compile the project just fine at the command line (the usual: qmake -project; qmake; nmake. Notice this last is "nmake" and not "make".) Let us know if you try to do this and don't succeed. We'll help as best we can.