Build Instructions Qt4
From PsiWiki
This page contains the official instructions on how to build the current development version of Psi. A list of issues for this version can be found here.
Contents |
[edit] Requirements
- You need Qt 4.3.0 or higher to build Psi.
- For Windows, just download and install the latest Qt SDK for Windows, or for older versions find an installer for a MinGW-linkable build here.
- Most Linux distributions have packages available, usually named qt4-xxx, where xxx will be one of core, dev and so forth. Be sure to get the -dev package in addition to any other libraries, as it contains header files mandatory for building Psi.
- If a packaged version of Qt is not available for your OS (or if you want debug symbols in your Qt libraries), you will need to build and install Qt yourself. See the Qt instructions to find out how to do this.
[edit] Optional
- If you want to dynamically link QCA into Psi, you will need an external QCA 2.0 install, which you can build from source if a pre-built library package isn't avilable for your OS. Instructions on how to build this can be found below, the source is available here.
- If you want to use the QCA plugin for OpenSSL on Windows, you will need to two things:
- A local install of the OpenSSL package. Linux and Mac operating systems traditionally have OpenSSL installed already.
- A local install or build of the QCA plugin for OpenSSL (qca-ossl). Instructions for building this can be found below, the source is available here.
[edit] Sources
The current version of the Psi sources can be retrieved via Git.
git clone git://git.psi-im.org/psi.git cd psi git submodule init git submodule update
To keep your local copy up-to-date, run the following commands in your checkout:
git pull git submodule update
For more information on Git, take a look at the documentation section on the Git website.
[edit] Building on Unix & Mac OS X
Note: If you are only interested in vanilla Mac OS X universal binaries, please use a nightly build instead. You'll save yourself some time and trouble.
[edit] Building QCA
After unpacking the QCA sources, run the following command:
./configure --prefix=/usr/local/qca2
If configure cannot find your Qt4 library, use the --qtdir option to specify the path to Qt (e.g. /usr/share/qt4), or make sure that the qmake binary for Qt4 occurs first in your PATH. If something else goes wrong, use the --verbose option to get more information on the configuration process.
After QCA is configured, run
make make install
To be able to run applications using QCA2, you will need to add /usr/local/qca2/lib to /etc/ld.so.conf and run ldconfig or add /usr/local/qca2/lib to your LD_LIBRARY_PATH (DYLD_LIBRARY_PATH on Mac OS X).
[edit] Building the QCA plugin for OpenSSL (qca-ossl)
After unpacking qca-ossl's sources, run the following commands
./configure make make install
See above on how to troubleshoot configure problems.
[edit] Building Psi
From the toplevel Psi source dir, run the following commands:
./configure make
This should configure and build Psi. See above on how to troubleshoot configure problems.
More detailed instructions in case the above fails to create the expected:
From the toplevel Psi source dir:
export MYQTDIR="/path/to/your/qt4/installation" (e.g. /usr/local/Trolltech/Qt-4.2.0-tp1) export MYGROWLDIR="/Path/To/Growl.Framework/Container" (e.g. /Library/Frameworks)
./configure \ --qtdir=$MYQTDIR \ --with-growl=$MYGROWLDIR \ --enable-universal \ --disable-dnotify \ --disable-xss
Edit variables in mac/Makefile:
QTDIR= (same as $MYQTDIR)
QCADIR= (/usr/local/qca2/lib)
GROWLDIR= (same as $MYGROWLDIR)
QT_FRAMEWORK_VERSION= (take note which dir is in the
Qt Frameworks: is it 4.0, 4, or 4.2...?)
make -C mac/
This should create a relocatable Psi.app in mac/disk/. To show it in the Finder:
open mac/disk/
In any case, always refer to doc/build-mac.txt!
[edit] Building on Windows using MinGW
All these instructions are performed from within the Qt command prompt (found in the Start menu)
Note: If you are only interested in Windows (win32) binaries, please use a nightly build instead. You'll save yourself some time and trouble.
[edit] Installing Qt and MinGW
First of all, install Qt 4.3.0 or higher. You can get the latest version bundled with the MinGW compiler here.
[edit] Building with QCA (required)
QCA is the Qt Cryptographic Architecture, a library which enables Psi to use plugins for OpenSSL, Kerberos, SASL, and other security-enhancing libraries without re-building Psi as a whole.
QCA is required for building Psi even if none of these plugins are being used, i.e. building or at least linking to it is mandatory.
QCA can be either linked statically into Psi, or dynamically at runtime. The key benefit of static linking is that it is one less file to worry about the presence or absence of on the system or in the package; the key detriment is that your executable will be substantially larger (~9MB). The key benefit of dynamic linking is that, if a given system already has QCA installed, the existing install can be re-used; the key detriment is that if it is not already installed, or you suspect it won't be, there will be a requirement that it either be installed along-side Psi or bundled into the package-installer.
Static linking requires building QCA from source. Dynamic linking leaves you the option of building from source, or using a bundle of pre-built library files.
If you plan to build QCA from source for either static or dynamic linking, you'll need to download the sourcecode for the latest release here. If you'd prefer to dynamically link against a pre-built library, there are links on the same page for "binaries" that MinGW can link against.
[edit] Building QCA for static linking (includes qca-ossl)
The process to Statically link QCA into the Psi executable is integrated into the build of Psi as a whole, and the QCA and qca-ossl (OpenSSL plugin for QCA) sources are even included in the source tree for Psi already.
[edit] Satisfying OpenSSL pre-requirement
A local install of OpenSSL is a pre-requirement for building qca-ossl, and thus a pre-requirement for statically linking against QCA. If you don't already have OpenSSL installed, you can download and install a pre-built package here. Download full (~6MB) version, not light (~1MB).
- Download and install OpenSSL. C:\OpenSSL is a good install path.
- Go to the dir where you installed OpenSSL. In the lib\MingW subdir of that dir, copy and rename the files ssleay32.a and libeay32.a to ssleay32.lib and libeay32.lib, respectively.
[edit] Enabling static linking against QCA / qca-ossl in the main Psi build
- In the root directory of the Psi source, edit the file 'conf_windows.pri'.
- uncomment the 'CONFIG += qca-static'.
- Change the OPENSSL_PREFIX in the windows section to point to the dir where you installed OpenSSL (e.g. C:/OpenSSL).
- Change -L$$OPENSSL_PREFIX/lib into -L$$OPENSSL_PREFIX/lib/MinGW.
- Perform the build of Psi as usual.
[edit] Building QCA for dynamic linking
First, download and unpack the source for QCA.
After unpacking the QCA sources, run the following command (for release & debug):
configwin rd
If you don't have Qt-debug, run this:
configwin r
After QCA is configured, run
qmake mingw32-make (or make, or nmake) installwin
[edit] Building Plugins
[edit] Preparing to build Plugins
To facilitate various configure-scripts being able to find the header files, libraries and other dependencies associated with the plugins, we will set-up a directory tree where all of those resources can be centrally located/found. You can choose where to put it, for the sake of this example we will assume you choose C:\local .
- Create a directory tree as follows:
C:\local C:\local\bin C:\local\include C:\local\lib
- Create a winlocal.prf Qt-prefixes file that sets WINLOCAL_PREFIX to point to the directory where you will install Psi library dependencies (be sure to use forward-slashes in the path). For example:
echo "WINLOCAL_PREFIX = C:/local" > %QTDIR%\mkspecs\features\winlocal.prf
This directory will hereby be referred to as winlocal.
[edit] QCA plugin for OpenSSL (qca-ossl) dynamically linked
[edit] Satisfying OpenSSL pre-requirement
As for the statically-linked build above, a local install of OpenSSL is a pre-requirement for building qca-ossl If you don't already have OpenSSL installed, you can download and install a pre-built package here. Download the "full" (~6MB) version, not the "light" one (~1MB).
- Download and install OpenSSL. C:\OpenSSL is a good install path, we'll use that for the rest of our examples.
- Copy the C:\OpenSSL\include directory into winlocal\include.
- You should have files such as winlocal\include\openssl\tls1.h.
- Copy the C:\OpenSSL\lib\MingW directory into winlocal\lib.
- You should have both libeay32.a and ssleay32.a
- Rename the files libeay32.a and ssleay32.a to libeay32.lib and ssleay32.lib, respectively.
[edit] Building qca-ossl
After unpacking the qca-ossl sources, run the following command (for release & debug):
configwin rd
For release only:
configwin r
After qca-ossl is configured, run
qmake mingw32-make (or make, or nmake) mkdir %QTDIR%\plugins\crypto copy lib\*.dll %QTDIR%\plugins\crypto
Special note for OpenSSL > 0.9.8h with qca-ossl <= 2.0.0-beta3: There is a known bug, discussed here, with qca-ossl trying to make a call to an undefined symbol EVP_whirlpool(). Adding the following line to qca-ossl.cpp remedies the issue, otherwise you can install an earlier version of OpenSSL.
#undef OBJ_whirlpool /* Anywhere BEFORE the line #ifdef OBJ_whirlpool */
[edit] Building qca-wingss
Plugin is built in the same way as the qca-openssl one. With MinGW 5.1.6 the following patch must be applied to qca-wingss.cpp:
--- qca-wingss.cpp~ Fri Jul 25 21:18:11 2008
+++ qca-wingss.cpp Fri Mar 12 18:47:50 2010
@@ -55,6 +55,10 @@
#define SEC_E_OUT_OF_SEQUENCE 0x80090310
#endif
+#ifndef SEC_E_BUFFER_TOO_SMALL
+#define SEC_E_BUFFER_TOO_SMALL 0x80090321
+#endif
+
#ifndef SECURITY_ENTRYPOINTW
#define SECURITY_ENTRYPOINTW TEXT("InitSecurityInterfaceW")
#endif
[edit] ASpell spell-checker plugin dynamically linked
- Download the ASpell headers and MinGW-linkable libraries here.
- Extract the headers and libraries to C:\local
- <aspell>\include\* should go under C:\local\include\
- <aspell>\include\* should go under C:\local\lib\
- Edit the file conf_windows.pri under the root directory of the Psi source
- Uncomment the line:
-
#DEFINES += HAVE_ASPELL
-
- Modify this line:
-
ASPELL_PREFIX = ../../../aspell - To this:
-
ASPELL_PREFIX = C:/local
-
- Uncomment the line:
[edit] Building Psi
- Edit src/src.pro and conf_windows.pri in the Psi tree, and remove the line CONFIG += DEBUG if you find it.
- From the toplevel dir in your tree, run the following commands:
qmake mingw32-make (or make, or nmake)
- There should now be a binary psi.exe in src/release.
[edit] Packaging Psi
- To package everything up into a self-containing dir, edit win32/Makefile to reflect your local setup
- Make sure the dir win32/psi does not exist, then run
mingw32-make -C win32
This should make a dir win32/psi with all the necessary files.
[edit] Building on Windows using Microsoft Visual C++
Qt and Psi can be built using any fairly recent version of Microsoft Visual C++, starting with version 6.0. Any edition thereof is supported, even free Microsoft Visual C++ Express Edition. The procedure below is aimed towards usage of this edition.
Be sure to use Qt-4.3.2 or later as previous versions of Qt4/OpenSource officially did not support Microsoft Visual C++.
[edit] Installing Microsoft Visual C++
- Microsoft Visual C++ Express Edition can be found on Microsoft website. You can use either Visual C++ 2005 or Visual C++ 2008, but the latter is recommended.
If you intend to use Microsoft Visual C++ 2008, then you will also need:
If you intend to use Microsoft Visual C++ 2005, then you will also need:
- Either Microsoft Windows Server 2003 R2 Platform SDK or abovementioned Windows SDK for Windows Server 2008 and .NET Framework 3.5
- If you have installed Microsoft Visual C++ 2005 without Service Pack 1, then
- Either Microsoft Visual C++ 2005 Express Edition Service Pack 1 or Microsoft Visual C++ 2005 Service Pack 1 (for any other Microsoft Visual C++ 2005 edition);
- KB930198 hotfix (must be installed after installation of Service Pack 1).
[edit] Installing other libraries
You will need OpenSSL. Windows binaries and headers can be grabbed there. Download full (~6MB) version, not light (~1MB).
[edit] Compiling Qt
You can get latest source code here. QtBuilder will help you with compilation.
[edit] Building Psi
TODO
[edit] Building on Solaris
[edit] Building the QCA plugin for OpenSSL (qca-ossl)
After unpacking qca-ossl's sources, run the following commands
LD_LIBRARY_PATH=/usr/local/qca2/lib bash ./configure --qtdir=/usr/local/Trolltech/Qt-4.1.4 \ --with-openssl-lib=/usr/sfw/lib --with-openssl-inc=/usr/sfw/include gmake
and as root
/usr/sfw/bin/gmake install
See above on how to troubleshoot configure problems.
[edit] Building Psi
From the toplevel Psi source dir, run the following commands:
LD_LIBRARY_PATH=/usr/local/qca2/lib bash ./configure --qtdir=/usr/local/Trolltech/Qt-4.1.4 gmake
and as root
/usr/sfw/bin/gmake install
This should configure and build Psi. See above on how to troubleshoot configure problems.
[edit] Running Psi
With this very dirty command, I'm now able to run Psi:
LD_LIBRARY_PATH=/usr/sfw/lib:/usr/openwin/sfw/lib:/usr/local/qca2/lib /usr/local/bin/psi
As you can probably see, these instruction are created by someone who really knows little about Solaris. If you have better/nicer solutions for certain things, please fix this page!

