FIXME evaluate and update the guide for their new code https://www.keepassx.org/dev + https://www.keepassx.org/news/2013/12/420

Note: this guide is out of date due to: https://www.keepassx.org/bug-reports/ “KeePassX 0.4.3 is no longer maintained. For bug reports and feature requests related to the development version KeePassX 2 please visit http://www.keepassx.org/dev.”

Also checkout these notes / slides on Keepass2 (Deutsch): Passwortverwaltung Compiling from source is the most flexible way to get working KeePassX binaries for your system. It works on all supported platforms and with many processors in different configurations like Linux/PowerPC or BSD/i386 etc, even if there are no precompiled packages available for these combinations.

howto compile and install KeepassX 0.3.4 on Debian 7 (wheezy)

download keepassx source code:

wget https://www.keepassx.org/releases/keepassx-0.4.3.tar.gz

generate a SHA1 hash of the downloaded file:

sha1sum keepassx-0.4.3.tar.gz

Why generate a hash of the file?

If you want to check if the offered files are verified by the KeePassX authors (i.e. official and original files), you can hash the downloaded file using the hash computation utility of your choice and see if the SHA-1 hashes match. This is to ensure the integrity of the downloaded data and that you have not been given modified source code.

Check that the hashes of the file you downloaded to your computer and the hashes that the authors match by comparing the output of the previous command with the reported SHA1 sum on KeepassX website: https://www.keepassx.org/hashsums-sha1

for example you need to compare this first string of hexadecimal characters from your terminal to the website e.g: d25ecc9d3caaa5a6d0f39a42c730a95997f37e2e keepassx-0.4.3.tar.gz

unpack the tar.gz:

tar xzvf KeePassX-0.3.4.tar.gz

change directory to the newly created folder:

cd keepassx-0.3.4

install dependencies for compilation (need to be root):

su
apt-get install qt4-dev-tools qt4-designer
apt-get install g++
apt-get install libxtst-dev

compile the software:

qmake-qt4
make

notice that the compilation *does not* complete successfully, spot the first error message in compilation, (this happens when compiling so don't panic, there is a simple fix! )

error message:

g++ -c -include ../build/keepassx -m64 -pipe -O2 -Wall -W -D_REENTRANT -DAUTOTYPE -DGLOBAL_AUTOTYPE -DQT_NO_DEBUG -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/default -I. -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include/QtXml -I/usr/include -I. -Ilib -Icrypto -Iplugins/interfaces -Iexport -Iimport -Idialogs -I../build/ui -I../build/moc -o ../build/random.o lib/random.cpp lib/random.cpp: In function ‘void initStdRand()’: lib/random.cpp:98:19: error: ‘getpid’ was not declared in this scope make[1]: * [../build/random.o] Error 1 make[1]: Leaving directory `/home/xxxxx/src/keepassx-0.4.3/src' make: * [sub-src-make_default] Error 2

the bug is due to the fact that: unistd.h is no longer included in some header files see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50423

fix by using your favourite text editor to add #include <unistd.h> on a new line after #include “random.h”:

vi src/lib/random.cpp

before:

#include "random.h"
#if defined(Q_WS_X11) || defined(Q_WS_MAC)
#include <QFile>

after:

#include "random.h"
#include <unistd.h>
#if defined(Q_WS_X11) || defined(Q_WS_MAC)
#include <QFile>

install the software:

make install

running the software: (option 1) access via the command line:

keepassx

(option 2) access via the menu: accessories > KeepassX