Compile current NextCloud desktop with Qt 5.15.2 on Ubuntu 22

I intend to compile the NextCloud desktop from the Git master branch.

Install Qt5 from official installer into ~/Qt (default location)

Get installer from Download Qt: Get Qt Online Installer

Tick only Qt 5.15.2 (resulting in 1.9 GB)

Install git

sudo apt install git

Install packages recommended for Ubuntu 20, but exclude Qt5

sudo apt install cmake g++ openssl libssl-dev libzip-dev sqlite3 libsqlite3-dev zlib1g-dev shared-mime-info

Resolve later CMake complaints, mesa is open-source OpenGL

sudo apt install libkf5archive-dev pkg-config cmake-data mesa-common-dev libglu1-mesa-dev inkscape

Clone current NextCloud desktop

git clone --depth 1 

cmake fails because of error “FindQt5Keychain.cmake”

cd desktop && mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=~/ncdc -DCMAKE_PREFIX_PATH=~/Qt/5.15.2/gcc_64/lib/cmake

How do you resolve cmake error “FindQt5Keychain.cmake”?

Workaround cmake error “FindQt5Keychain.cmake” using TOKEN_AUTH_ONLY

cmake .. -DCMAKE_INSTALL_PREFIX=~/ncdc -DCMAKE_PREFIX_PATH=~/Qt/5.15.2/gcc_64/lib/cmake -DTOKEN_AUTH_ONLY=ON

Above cmake is successful

make fails because it cannot find QColor

make install
[  0%] Automatic MOC for target nextcloud_csync
[  0%] Built target nextcloud_csync_autogen
[  1%] Building CXX object src/csync/CMakeFiles/nextcloud_csync.dir/nextcloud_csync_autogen/mocs_compilation.cpp.o
[  1%] Building CXX object src/csync/CMakeFiles/nextcloud_csync.dir/__/common/checksums.cpp.o
[  1%] Building CXX object src/csync/CMakeFiles/nextcloud_csync.dir/__/common/filesystembase.cpp.o
[  2%] Building CXX object src/csync/CMakeFiles/nextcloud_csync.dir/__/common/ownsql.cpp.o
[  2%] Building CXX object src/csync/CMakeFiles/nextcloud_csync.dir/__/common/preparedsqlquerymanager.cpp.o
[  3%] Building CXX object src/csync/CMakeFiles/nextcloud_csync.dir/__/common/syncjournaldb.cpp.o
[  3%] Building CXX object src/csync/CMakeFiles/nextcloud_csync.dir/__/common/syncjournalfilerecord.cpp.o
[  3%] Building CXX object src/csync/CMakeFiles/nextcloud_csync.dir/__/common/utility.cpp.o
[  4%] Building CXX object src/csync/CMakeFiles/nextcloud_csync.dir/__/common/remotepermissions.cpp.o
[  4%] Building CXX object src/csync/CMakeFiles/nextcloud_csync.dir/__/common/vfs.cpp.o
[  4%] Building CXX object src/csync/CMakeFiles/nextcloud_csync.dir/__/common/pinstate.cpp.o
[  5%] Building CXX object src/csync/CMakeFiles/nextcloud_csync.dir/__/common/plugin.cpp.o
[  5%] Building CXX object src/csync/CMakeFiles/nextcloud_csync.dir/__/common/syncfilestatus.cpp.o
[  5%] Building CXX object src/csync/CMakeFiles/nextcloud_csync.dir/csync.cpp.o
[  6%] Building CXX object src/csync/CMakeFiles/nextcloud_csync.dir/csync_exclude.cpp.o
[  6%] Building CXX object src/csync/CMakeFiles/nextcloud_csync.dir/std/c_time.cpp.o
[  7%] Building CXX object src/csync/CMakeFiles/nextcloud_csync.dir/vio/csync_vio_local_unix.cpp.o
[  7%] Linking CXX shared library
[  7%] Built target nextcloud_csync
[  7%] Automatic MOC for target nextcloudsync
[  7%] Built target nextcloudsync_autogen
[  7%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/nextcloudsync_autogen/mocs_compilation.cpp.o
In file included from /home/markus/desktop/build/src/libsync/nextcloudsync_autogen/EWIEGA46WW/../../../../../src/libsync/account.h:36,
                 from /home/markus/desktop/build/src/libsync/nextcloudsync_autogen/EWIEGA46WW/moc_account.cpp:10,
                 from /home/markus/desktop/build/src/libsync/nextcloudsync_autogen/mocs_compilation.cpp:5:
/home/markus/desktop/build/src/libsync/nextcloudsync_autogen/EWIEGA46WW/../../../../../src/libsync/capabilities.h:24:10: fatal error: QColor: No such file or directory
   24 | #include <QColor>
      |          ^~~~~~~~
compilation terminated.
make[2]: *** [src/libsync/CMakeFiles/nextcloudsync.dir/build.make:76: src/libsync/CMakeFiles/nextcloudsync.dir/nextcloudsync_autogen/mocs_compilation.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:461: src/libsync/CMakeFiles/nextcloudsync.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

Analyis of QColor error

Line 24 of capabilities.h is the 4th import of a Qt headerfile:

#include <QVariantMap>
#include <QStringList>
#include <QMimeDatabase>
#include <QColor>

Make finds QMimeDatabase (line 23)


Why make doesn’t find QColor (line 24)?


Best regards,

Please make sure that the Ubuntu installer did not install qt as a dependency as well. In the worst car you have two versions installed and the installer used whatever it finds first. That might cause problems as the versions are incompatible.

Which Ubuntu installer do you mean?
Vanilla Ubuntu 22 comes with 1236 packages related to Qt, Qt5 and Qt6. .
I use a VM and install additional packages via apt only as shown above.
The official installer installs Qt5.12.2 into my home directory.

Is the official Qt installer incompatible with Ubuntu22?

I mean the official installer aka apt/apt-get/dpkg.

These said 1236 packages are compiled in one block by the Ubuntu CI/CD pipeline. The ordering here is crucial as some packages depend on others. So, you get these packages built step by step.

If you side-load another version of Qt the other ~1200 packages are still

  • using the officially build Qt version
  • have a package dependency on said Qt version.

Thus, in your system, there will be 2 Qt versions present most probably. I am not telling you that this is your problem but warn you that you have to keep that in mind, also when starting the built binary.

Maybe you look into the files in /home/markus/Qt/5.15.2/gcc_64/lib/cmake. This file should contain the required compiler and linker flags to build against the library and use it accordingly. Have a look for the string Qt/5.15.2/gcc_64/include/QtGui and Qt/5.15.2/gcc_64/include/QtCore with some -I prefix. I suspect it will contain -I/home/markus/Qt/5.15.2/... but could also be -I~/Qt/5.15.2/... or similar.

You could also try to add the -I parameter manually (to make the compiler find the included files manually). In this case my fist point gets more interesting: Linking requires also some flags eventually.

You can run make with VERBOSE=1. This will generate much more output and will show which paths are searched for include files. That might shed some light on the issue.

Hi @christianlupus,
thank you for the idea to run make VERBOSE=1

I have set up a new Ubuntu 22 virtual machine and tried to install Qt5 with the official installer (link above) .

The installer fails with error

./Downloads/ error while loading shared libraries: cannot open shared object file: No such file or directory

This enables the Qt installer to start:

sudo apt install libxcb-xinerama0

But later the Qt installer hangs at 88% “Installing component Android”
Details show “13 of 77 components installed”
I found no error message.

I started the Qt installer twice, from the Ubuntu 22 snapshot directly after all initial Ubuntu installs completed.

I assume the Qt install failed and will not attempt make.

Honestly, i am a bit lost here. This is more like a problem on how to set up qt than anything related to nextcloud.

The problem is that i am Android this week and do not have access to fast internet. So, cannot even help you by trying to verify your steps. I am sorry,i have no better idea ATM.

Thank you for your engagement. On my side I only have curiosity, no imoortance, no urgency.

You are correct, I am stuck at installing the Qt5 SDK.

I will look out the procedure NextCloud recommendeds to install Qt5, and on which Linux distribution. I would guess it is a Qt based distro.

1 Like

I will not do something in this topic for now. If you run into further issues, feel free to contact me again. I might be able to try it out myself using a docker container. But this will take some time…

Hi @christianlupus,
I have setup a new VM with Ubuntu 22 and installed Qt 5.15.2 from Download Qt: Get Qt Online Installer.

My last commands are

VERBOSE=1 make all

The log from the latter is verbose and located here: Managed Nextcloud

The 4th include fails.

Do I miss a -D Key = value pair command line option to specify the location of Qt?

1 Like

I found an error in my cmake parameters, so above make error log is of no use.

In the absence of a public Unix desktop build script I created client-building/ at master · marbx/client-building · GitHub

The script is interactive, e.g. the Qt must be downloaded from the official GUI.

The script builds an executable nextcloud binary and shared libraries, but binary does not find the libraries.

1 Like

Fixed by client-building/ at master · marbx/client-building · GitHub