How to compile DB Browser for SQLite on Ubuntu 16.04

Ubuntu 16.04.x comes with an old version of Qt (5.5), causing some bad issues for DB Browser for SQLite (DB4S):

Not everyone will hit those problems, but if it happens to you there is a solution. :smile:

If you compile DB4S yourself using the steps shown below, you’ll have a working DB4S without the above issues.

Install the Ubuntu software needed for compiling DB4S

  1. $ sudo apt install build-essential git cmake libsqlite3-dev qt5-default \
  2. qttools5-dev-tools

Get the latest DB4S source code

Clone the sqlitebrowser/sqlitebrowser git repo:

  1. $ git clone https://github.com/sqlitebrowser/sqlitebrowser

Download and install Qt 5.7 or above

Grab the Qt installer then run it:

  1. $ wget http://www.mirrorservice.org/sites/download.qt-project.org/archive/online_installers/2.0/qt-unified-linux-x64-2.0.5-2-online.run
  2. $ chmod 755 qt-unified-linux-x64-2.0.5-2-online.run
  3. $ ./qt-unified-linux-x64-2.0.5-2-online.run

The Qt installer will appear:

Qt Installer introduction screen

If you have an (optional) Qt account, you can fill in the details. Otherwise just click the “Skip” button:

Qt Installer account screen

The Qt installer “welcome” screen will appear now. Click next through the next few screens, until it asks where you want to install:

Qt Installer welcome screen Qt Installer metadata retrieval

By default, Qt will install into a “Qt” directory in your home folder. That seems to work well, but if you need to change it for some reason then this screen is where you do it. Click “Next” once you’re happy with the chosen location:

Qt Installer choose installation directory

This screen will have several component selected by default. You don’t need anything other than Desktop gcc 64-bit (or 32-bit if compiling on 32-bit Ubuntu), and Qt Creator (down the bottom). The rest you can safely de-select before clicking “Next” to continue:

Qt Installer choose components to install

Agree to the Qt license conditions (if you’re ok with them), then click Next:

Qt Installer license agreement screen

Click “Install” to begin the actual installation process:

Qt Installer ready to install Qt Installer installing

Qt is now installed. Leave the “Launch Qt Creator” option enabled so it gets launched automatically when you click “Finish”:

Qt Installer finished

Build DB Browser for SQLite

The welcome screen for Qt Creator appears. Click the “Open Project” button near the middle top, browse into the “sqlitebrowser” folder, then select the sqlitebrowser.pro file, and open it:

Qt Creator welcome screen Qt Creator browse to sqlitebrowser folder Qt Creator open sqlitebrowser.pro file

A screen called “Configure Project” will appear. There are three main checkboxes in it → Debug, Release, and Profile. Unselect the Debug and Profile ones, so only Release is left enabled. Then click the Configure Project button:

Qt Creator only enable the release build

This drops you into the “Edit” layout, with no documents open. Click the “Projects” tab on the left to switch to the projects layout so we can made further changes:

Qt Creator back on edit layout

You’re now in the Projects layout, which shows the “Build Settings” by default. “Shadow build” will be enabled. We don’t want that, so disable it:

Qt Creator shadow build enabled

This screenshot shows “Shadow build” disabled, which is what we want:

Qt Creator shadow build disabled

Now from the Qt Creator menu in the top bar, choose BuildRun qmake:

Qt Creator run qmake

Wait a few seconds for it to finish, then choose BuildBuild All, also from the Qt Creator menu in the top bar:

Qt Creator run build all

DB Browser for SQLite is now being built. It can take a few minutes, so be patient until it completes:

Qt Creator building

If all goes well, the build should finish without errors, looking somewhat like this:

Qt Creator build finished

If the build process finishes with any errors though, sometimes running BuildBuild All again (as per the previous step) fixes the problem, and is worth trying.

If you want SQLCipher support, follow this step.

Install DB Browser for SQLite

Still needs writing