Sean Rogers
Sean Rogers

Reputation: 21

How to build MySQL plugin with Qt 6 on Ubuntu 22.04?

I will preface that I don't really have any experience using cmake or building C++ projects in general (I'm sure that will become obvious).

I am having problems getting the MySQL driver and using it with Qt 6 on Ubuntu 22.04.

I was following the official guide, which list the following commands:

mkdir build-sqldrivers
cd build-sqldrivers
qt-cmake -G Ninja <qt_source_directory>/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>/<platform> -DMySQL_ROOT="/usr/local/mysql"
cmake --build .
cmake --install .

I ran into some problems:

  1. I don't know which directory I was even supposed to run these commands in.
  2. qt-cmake wasn't found as a command, and although this lead me to believe that it is normally included with the Qt 6 installation, I couldn't find it in any /bin folder I could see.
  3. I don't know what qt_source_directory implies. There is a directory ~/Qt, but does it mean ~/Qt or ~/Qt/<version>, or something else entirely?

I found this which said to use cmake in place of qt-cmake on Linux, but cmake -G Ninja's output makes me think it requires CMakeLists.txt to be in the project file, which it isn't since I used qmake to create the project. Attempting to use the command qmake proclaims that I don't have Qt 5 installed, so now I don't know if I installed it properly.

Many directions I found, including the official guide, also said to install some variant of libmysqlclient.<something> or libmysqlclient-<something>, but I don't have enough knowledge on their differences to know which is correct.

Upvotes: 2

Views: 31

Answers (0)

Related Questions