Building NiDB on CentOS 8
Prerequisites
System packages – Install development tools as follows.
yum group install ‘Development Tools’ yum install cmake3
Qt – Qt 5.12.8 libraries and the corresponding MySQL driver are required to build NiDB. Preparing the Qt build environment is only needed once. Prepare the Qt build environment as follows.
- Download Qt open-source from https://www.qt.io/download-open-source
- Run
chmod 777 qt-unified-linux-x64-x.x.x-online.run
- Run
./qt-unified-linux-x64-x.x.x-online.run
to launch the installer - An account with Qt is required to be able to install any of the Qt components, so create an account or login using your existing Qt account
- On the components screen, select the checkboxes for Qt 5.12.8 → Desktop gcc 64-bit and Sources. After installing Qt, note the location of qmake for use later in the build script. The default path to qmake should be
~/Qt/5.12.8/gcc_64/bin/qmake
MySQL/MariaDB driver for Qt – After version 5.12.3, Qt stopped including binary SQL drivers, so this driver must be built manually. Run the following commands to build the mysql driver.
yum install mariadb-devel cd ~/Qt/5.12.8/Src/qtbase/src/plugins/sqldrivers ~/Qt/5.12.8/gcc_64/bin/qmake sqldrivers.pro make make install
The libqsqlmysql.so
file should be now be in ~/Qt/5.12.8/gcc_64/plugins/sqldrivers
.
Build nidb
executable
Make sure Qt 5.12.8 is installed and the MySQL driver is built! Perform the following commands to build NiDB. The qmake path argument to the build.sh is optional, it is only required if the path to qmake is not ~/Qt/5.12.8/gcc_64/bin/qmake. Run the following commands to build NiDB.
wget https://github.com/gbook/nidb/archive/master.zip unzip master.zip mv nidb-master nidb cd ~/nidb ./build.sh /path/to/qmake #optional argument
NiDB binaries will be located in nidb/bin
.
Build RPM
Prepare the general build environment described above.
Prepare the RPM build environment as follows.
yum install rpm-build yum install rpmdevtools
Build the RPM file by performing the following commands. The rpmbuild
command will create an rpmbuild
directory in your home directory, and it is not possible to change the location of this created directory.
cd ~ rpmdev-setuptree wget https://github.com/gbook/nidb/archive/master.zip unzip master.zip mv nidb-master/* rpmbuild/SOURCES/ cp rpmbuild/SOURCES/src/setup/nidb.el8.spec rpmbuild/SPECS/ cd rpmbuild/SPECS QA_RPATHS=$((0x0002|0x0010)) rpmbuild -bb nidb.el8.spec
The built .rpm file should be ~/rpmbuild/RPMS/x86_64/nidb-xxxx.x.xx-1.el8.x86_64.rpm
Building NiDB on CentOS 7
Prerequisites
System packages – Install development tools as follows. EPEL release is required for cmake3
yum install epel-release yum group install ‘Development Tools’ yum install cmake3
Qt – Qt 5.12.8 libraries and the corresponding MySQL driver are required to build NiDB. Preparing the Qt build environment is only needed once. Prepare the Qt build environment as follows.
- Download Qt open-source from https://www.qt.io/download-open-source
- Run
chmod 777 qt-unified-linux-x64-x.x.x-online.run
- Run
./qt-unified-linux-x64-x.x.x-online.run
to launch the installer - An account with Qt is required to be able to install any of the Qt components, so create an account or login using your existing Qt account
- On the components screen, select the checkboxes for Qt 5.12.8 → Desktop gcc 64-bit and Sources. After installing Qt, note the location of qmake for use later in the build script. The default path to qmake should be
~/Qt/5.12.8/gcc_64/bin/qmake
MySQL/MariaDB driver for Qt – After version 5.12.3, Qt stopped including binary SQL drivers, so this driver must be built manually. There is a bug in the Makefile that adds unsupported warning flags, which must be removed to allow compilation. Run the following commands to build the mysql driver.
yum install mariadb-devel cd ~/Qt/5.12.8/Src/qtbase/src/plugins/sqldrivers ~/Qt/5.12.8/gcc_64/bin/qmake sqldrivers.pro gedit mysql/Makefile # remove the two instances of “-Wdate-time” gedit sqlite/Makefile # remove the two instances of “-Wdate-time” make make install
The libqsqlmysql.so
file should be now be in ~/Qt/5.12.8/gcc_64/plugins/sqldrivers
.
Build nidb
executable
Make sure Qt 5.12.8 is installed and the MySQL driver is built! Perform the following commands to build NiDB. The qmake path argument to the build.sh is optional, it is only required if the path to qmake is not ~/Qt/5.12.8/gcc_64/bin/qmake. Run the following commands to build NiDB.
wget https://github.com/gbook/nidb/archive/master.zip unzip master.zip mv nidb-master nidb cd ~/nidb ./build.sh /path/to/qmake #optional argument
NiDB binaries will be located in nidb/bin
.
Build RPM
Prepare the general build environment described above.
Prepare the RPM build environment as follows.
yum install rpm-build yum install rpmdevtools
Build the RPM file by performing the following commands. The rpmbuild
command will create an rpmbuild
directory in your home directory, and it is not possible to change the location of this created directory.
cd ~ rpmdev-setuptree wget https://github.com/gbook/nidb/archive/master.zip unzip master.zip mv nidb-master/* rpmbuild/SOURCES/ cp rpmbuild/SOURCES/src/setup/nidb.el8.spec rpmbuild/SPECS/ cd rpmbuild/SPECS QA_RPATHS=$((0x0002|0x0010)) rpmbuild -bb nidb.el7.spec
The built .rpm file should be ~/rpmbuild/RPMS/x86_64/nidb-xxxx.x.xx-1.el7.x86_64.rpm