1. Situation

Transferring password database from one computer to a new one. KeepassX 2.0 is great, but it doesn't support loading older DBs. In fact you should use keepassX 2.0 going forward as it has regular releases and is much safer.

2. Main Issue

Older versions have fatal error in their cmake/qmake build process preventing installation

3. Process so far

Older versions from the KeepassX.org site are available for download - must build from source using cmake/qmake

4. Road Block

There's an issue with getpid being an error in both .4.3 and .4.4 versions that was preventing any further make / make install to get it working.

lib/random.cpp: In function ‘void initStdRand()’:
lib/random.cpp:98:19: error: ‘getpid’ was not declared in this scope
  stream << getpid();
Makefile:838: recipe for target '../build/random.o' failed
make[1]: *** [../build/random.o] Error 1
make[1]: Leaving directory '/home/angela/Downloads/keepassx-0.4.4/src'
Makefile:39: recipe for target 'sub-src-make_default' failed

After some research, I was able to find a patch that worked.

Solution process

  1. Navigate to download all old versions - specifically keepassx-0.4.3.tar.gz

  2. Use this patch or copy from the code pasted below and save to a file keepassx-0.4.3-gcc47.patch

keepassx-0.4.3-gcc47.patch file contents:

diff -Naur keepassx-0.4.3/src/lib/random.cpp keepassx-0.4.3.new/src/lib/random.cpp
--- keepassx-0.4.3/src/lib/random.cpp   2009-06-28 16:22:31.000000000 +0200
+++ keepassx-0.4.3.new/src/lib/random.cpp   2012-04-19 00:20:15.757415510 +0200
@@ -19,6 +19,7 @@

 #include "random.h"
+#include <unistd.h>

 #if defined(Q_WS_X11) || defined(Q_WS_MAC)
  1. tar -xzf keepassx-0.4.3.tar.gz extract your keepass source folder

  2. cd into the folder

  3. sudo apt-get install cmake (or if using .4.4 you will need sudo apt-get install qt-qmake.)

    • You may need some build packages too like sudo apt-get install libxtst-dev build-essential libqt4-dev you may need to look those up separately because I ended up installing a lot of those but not really sure which packages were actually necessary
  4. Add the patch, assuming you're in your keepass dir and your patch file is one level up: patch -p1 < ../keepassx-0.4.3-gcc47.patch

  5. run cmake ./

  6. make

  7. make install

  8. great success!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.