Skip to content

Building Passwords from source code

Linux Guide

Building Passwords from source code might seem daunting especially if you're new to the open-source world or not yet familiar with Qt. But don’t worry: this page isn’t a deep-dive tutorial, it’s a recipe. Step-by-step, it will guide you through everything you need to do to build the application successfully.

Passwords has been built on a wide range of Linux distributions, including Fedora, openSUSE, Debian, Zorin OS, and many others. The overall build process is largely the same across these systems. However, some commands, package names, and minor details vary between distributions, so you may encounter small differences depending on what you’re using.

Step 1 - Download the source code

To begin, use the git tool to clone the repository.

If you don’t already have Git installed, you can easily add it using your distribution’s package manager. For example:

  • Debian‑based systems: sudo apt install git
  • RHEL‑based systems: sudo dnf install git
  • openSUSE: sudo zypper install git
  • Other distros: install Git using your preferred package manager

Once Git is installed, clone the Passwords repository with:

cd /tmp
git clone https://github.com/sysal1280/passwords.git
Step 2 - Download Qt Binaries

Qt is open source and available for free. You can download it from: https://www.qt.io/development/download-qt-installer-oss

Download the Linux installer (.run file) that matches your system.

Before running it, make the file executable:

Code

chmod +x qt-online-installer*.run

Then launch it. During installation, select the latest Qt 6 version (6.0 or newer) and choose Developer Tools, but deselect Qt Creator. You don’t need Qt Creator to build Passwords, and choosing Custom Installation allows you to uncheck it.

Qt currently requires a (free) account to use the installer. While this may (and should, IMHO) change in the future, don’t let it discourage you, Qt is widely used, and creating an account is quick. Using a temporary email address is also an option if you prefer.

Step 3 - Let's compile and build some software

Navigate to the Passwords source directory

cd /tmp/passwords

Create a build directory

mkdir build

Move into build directory

cd build

The cmake tool will likely need to be installed and can be easily done so with your package manager.

  • Debian‑based systems: sudo apt install cmake
  • RHEL‑based systems: sudo dnf install cmake
  • openSUSE: sudo zypper install cmake
  • Other distros: install Git using your preferred package manager

The next step is to run CMake so it can configure the build system. Before doing that, you’ll need to confirm the path to your Qt installation.

If you used the Qt Online Installer, Qt is usually installed under:

/home/<user>/Qt

Inside that directory, each Qt version has its own folder, and inside that you’ll find the compiler‑specific directory (for example, gcc_64). This final directory is what CMake needs to locate the Qt libraries and tools.

Once you’ve identified the correct path, run CMake like this, substituting the CMAKE_PREFIX_PATH with your specific path.

cmake ../ -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/home/<user>/Qt/6.9.3/gcc_64

After running the CMake command, you should expect to see output similar to the following if the configuration was successful:

cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/home/sysal/Qt/6.9.3/gcc_64 
-- The CXX compiler identification is GNU 13.3.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Performing Test HAVE_STDATOMIC
-- Performing Test HAVE_STDATOMIC - Success
-- Found WrapAtomic: TRUE  
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so   
-- Found WrapOpenGL: TRUE  
-- Found WrapVulkanHeaders: /usr/include  
-- GCC/Clang/MinGW hardening enabled
-- Configuring done (0.6s)
-- Generating done (0.0s)
-- Build files have been written to: /tmp/passwords

Step 4 — Compile Passwords

With the build files generated, the next step is to compile the application. This part is simple, just run make

You should expect to see something similar to below if successful.

make
[  0%] Built target password_autogen_timestamp_deps
[  3%] Automatic MOC and UIC for target password
[  3%] Built target password_autogen
[  7%] Automatic RCC for resources/resources.qrc
[ 11%] Automatic RCC for resources/wordlists/wordlist.qrc
[ 15%] Building CXX object CMakeFiles/password.dir/password_autogen/mocs_compilation.cpp.o
[ 19%] Building CXX object CMakeFiles/password.dir/src/aboutdialog.cpp.o
[ 23%] Building CXX object CMakeFiles/password.dir/src/categorydialog.cpp.o
[ 26%] Building CXX object CMakeFiles/password.dir/src/categoryproperties.cpp.o
[ 30%] Building CXX object CMakeFiles/password.dir/src/dataobfuscator.cpp.o
[ 34%] Building CXX object CMakeFiles/password.dir/src/debugutils.cpp.o
[ 38%] Building CXX object CMakeFiles/password.dir/src/droplabel.cpp.o
[ 42%] Building CXX object CMakeFiles/password.dir/src/gpgcheck.cpp.o
[ 46%] Building CXX object CMakeFiles/password.dir/src/logindialog.cpp.o
[ 50%] Building CXX object CMakeFiles/password.dir/src/main.cpp.o
[ 53%] Building CXX object CMakeFiles/password.dir/src/mainwindow.cpp.o
[ 57%] Building CXX object CMakeFiles/password.dir/src/newpassworddialog.cpp.o
[ 61%] Building CXX object CMakeFiles/password.dir/src/passworddialog.cpp.o
[ 65%] Building CXX object CMakeFiles/password.dir/src/passwordgenerator.cpp.o
[ 69%] Building CXX object CMakeFiles/password.dir/src/preferencesdialog.cpp.o
[ 73%] Building CXX object CMakeFiles/password.dir/src/randomnoisedialog.cpp.o
[ 76%] Building CXX object CMakeFiles/password.dir/src/settings.cpp.o
[ 80%] Building CXX object CMakeFiles/password.dir/src/termsdialog.cpp.o
[ 84%] Building CXX object CMakeFiles/password.dir/src/watermarkedtreewidget.cpp.o
[ 88%] Building CXX object CMakeFiles/password.dir/password_autogen/3YJK5W5UP7/qrc_resources.cpp.o
[ 92%] Building CXX object CMakeFiles/password.dir/password_autogen/YUFKSYIBPX/qrc_wordlist.cpp.o
[ 96%] Linking CXX executable password
[100%] Built target password

At this point, Passwords has been successfully compiled, and you now have a working binary ready to run. Many people choose to stop here and use Passwords directly from the build directory, and there’s absolutely nothing wrong with that. The only thing to keep in mind is that the Qt directory you specified in the CMake command must remain available on your system for Passwords to continue functioning. You can copy the password executable from the build directory to where ever you like, but the Qt directory must exist as well.

If you’re comfortable with that requirement, then congratulations on compiling Passwords. I hope it serves you well for many years to come, keeping your passwords and secrets secure and helping you protect your privacy.

Step 5 - Make the Passwords Binary Portable

This steps requires the patchelf tool, it will likely need to be installed and can be easily done so with your package manager.

  • Debian‑based systems: sudo apt install patchelf
  • RHEL‑based systems: sudo dnf install patchelf
  • openSUSE: sudo zypper install patchelf

Now that Passwords has been compiled, you’ll find a file named password inside the build directory. This is the executable program. First thing we need to do it put it in a separate directory, so run

mkdir /tmp/passwords/final
mv /tmp/passwords/build/password /tmp/passwords/final
cd /tmp/passwords/final

By default, the binary expects to find the Qt libraries in the same location where you originally installed Qt (for example, /home/<user>/Qt/6.x.x/gcc_64). If you move the binary to another machine—or even just another folder—it won’t run unless that Qt directory is also present.

To fix this, we make the binary portable by telling it to look for its required libraries in a folder relative to itself, rather than in a fixed system path. This is where patchelf comes in.

patchelf is a tool that can modify ELF binaries (the standard executable format on Linux). One of the things it can change is the RPATH—the runtime library search path. This is the list of directories the binary will search when looking for shared libraries like Qt.

Run the following command using $ORIGIN. It ss a special placeholder that always means “the directory where this executable lives.”

patchelf --set-rpath '$ORIGIN/lib' password

Step 6 - Copy the lib folder and plugins

After running patchelf, you can bundle the Qt libraries into a lib/ folder next to the password binary, and the program will run anywhere, no system‑wide Qt installation required. And no fixed directories which must exist.

We need to copy the entire lib folder from Qt to the current directory

cp -r /<Qt-path>/gcc_64/lib .

We also need to copy the plugins directory

cp -r /<Qt-path>/gcc_64/plugins .

Then we need to generate a conf file which tells Passwords where to look specifically.

cat > qt.conf << 'EOF'
[Paths]
Prefix=.
Plugins=plugins
Libraries=lib
EOF

Everything in the final directory must stay together but can be put anywhere, copied to different systems and used free, forever.

Serious congratulations are in order. You now have a fully functioning, fully portable copy of Passwords built entirely from source pulled directly from GitHub and compiled on your own machine. From a security perspective, it’s hard to get better than that. You know exactly where your software came from, how it was built, and what it contains. I hope this build serves you well for many years, keeping your passwords and secrets safe and helping you protect your privacy.

Step 7 - Remove unnecessary plugins

Qt is highly modular, and most applications only need a small subset of its plugins. By removing the components Passwords does not use, you can significantly reduce the size of your portable build.

Start by cleaning up the plugin directory:

cd plugins

find . -maxdepth 1 -type d ! -name '.' \
  ! -name 'generic' \
  ! -name 'iconengines' \
  ! -name 'imageformats' \
  ! -name 'platforminputcontexts' \
  ! -name 'platforms' \
  ! -name 'platformthemes' \
  ! -name 'sqldrivers' \
  ! -name 'tls' \
  ! -name 'wayland-decoration-client' \
  ! -name 'wayland-graphics-integration-client' \
  ! -name 'wayland-shell-integration' \
  ! -name 'xcbglintegrations' \
  -exec rm -rf {} +

  cd ..

Step 8 - Remove unnecessary Library Files

Qt ships with a large number of libraries, many of which Passwords does not use. Removing them helps shrink the final distribution and keeps your portable build clean and focused.

Below is a curated list of libraries that are safe to remove for Passwords:

cd lib

# Remove FFmpeg (Qt Multimedia)
rm -f libavcodec* libavformat* libavutil* libswscale* libswresample* libQt6FFmpeg*

# Remove ICU libs you don't need
rm -f libicuio* libicutest* libicutu*

# Remove QML / Quick / Quick3D / Labs / Controls
rm -f libQt6Qml* libQt6Quick* libQt6Quick3D* libQt6Labs* libQt6QuickControls2* \
      libQt6QuickDialogs2* libQt6QuickEffects* libQt6QuickLayouts* \
      libQt6QuickParticles* libQt6QuickTimeline* libQt6QuickVectorImage* \
      libQt6QuickWidgets*

# Remove Designer, Help, UiTools
rm -f libQt6Designer* libQt6DesignerComponents* libQt6Help* libQt6UiTools*

# Remove PrintSupport (if no printing)
rm -f libQt6PrintSupport*

# Remove Wayland
rm -f libQt6WaylandClient* libQt6WlShellIntegration*

# Remove Embedded / EGLFS / KMS / FB
rm -f libQt6EglFS* libQt6KmsSupport* libQt6FbSupport* libQt6DeviceDiscoverySupport* libQt6InputSupport*

# Remove ShaderTools (QML only)
rm -f libQt6ShaderTools*

# Remove Multimedia
rm -f libQt6Multimedia* libQt6MultimediaQuick* libQt6MultimediaWidgets* libQt6MultimediaTestLib*

# Remove XML (if not used)
rm -f libQt6Xml*

# Remove Concurrent (if not used)
rm -f libQt6Concurrent*

# Remove example assets
rm -f libQt6ExampleIcons* libQt6ExamplesAssetDownloader*

# Remove static libs and build junk
rm -f *.a *.prl
rm -rf cmake pkgconfig objects-RelWithDebInfo

cd ..

That’s it. All the files in /tmp/passwords/final are now your complete Passwords program.

First, thank you for sticking with the process all the way to the end. And second, there really isn’t much more to say, you’re finished. Passwords is now fully built, fully portable, and 100% ready for production use.