Building MariaDB Connector/ODBC from Source
Contents
Building MariaDB Connector/ODBC from Source
Installing MariaDB Connector/ODBC Build Dependencies
First, to be able to build MariaDB Connector/ODBC, you need to have the following tools - cmake, git, and a compiler - Visual Studio on Windows or gcc on other OSs. You don't need to install anything additional on Windows. On other systems you also need 'make' and UnixODBC Driver Manager. It's possible to build Connector/ODBC without encrypted connection support. Otherwise you will need to have OpenSSL headers and libraries installed.
Installing Build Dependencies on Linux
On Linux, you may need to run one of following commands to install these dependencies.
For example, the following command would install the necessary package on RHEL, CentOS, and similar Linux distributions:
sudo yum -y install git cmake make gcc openssl-devel unixODBC unixODBC-devel
And the following command would install the necessary packages on Debian, Ubuntu, and similar Linux distributions:
sudo apt-get update sudo sh apt-get install -y git cmake make gcc libssl-dev unixodbc-dev
Cloning the MariaDB Connector/ODBC Git Repository
The next step will be to obtain the connector source code. We recommend that you build from the git checkout.
The git repository is located at:
The source code is available on GitHub: https://github.com/MariaDB/mariadb-connector-odbc
To clone it, execute the following:
git clone https://github.com/MariaDB/mariadb-connector-odbc.git cd mariadb-connector-odbc
If you want to build a specific revision or version, you will need to run something like:
git checkout 3.0.6
This example will put your source tree into the 3.0.6 version state.
Building MariaDB Connector/ODBC
Now all is set to start the build itself:
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCONC_WITH_UNIT_TESTS=Off -DCONC_WITH_MSI=OFF -DCMAKE_INSTALL_PREFIX=/usr/local . cmake --build . --config RelWithDebInfo
Installing MariaDB Connector/ODBC
To install a freshly built Connector/ODBC on Windows, run
msiexec.exe /i wininstall\mariadb-connector-odbc-3.0.6-win32.msi
or, on other systems, run
sudo make install
Building from a Source Package
Building MariaDB Connector/ODBC from a source package is a bit different than building it from the git repoisitory. The source package comes without Connector/C source code. And in order to build Connector/ODBC, you need to download Connector/C source separately, and then copy it into the 'libmariadb' subdirectory in the root of the Connector/ODBC source tree. Other steps are all the same as for building from git checkout.
Also, it should be possible to build from source package using the Connector/C headers and library installed on your system. You need to ensure that the appropriate Connector/C version is installed. Most probably you will need to point your compiler and/or linker to the location of the Connector/C headers and/or library. e.g.
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCONC_WITH_UNIT_TESTS=Off -DCMAKE_C_FLAGS_RELWITHDEBINFO="-I/usr/local/incude/mariadb -L/usr/local/lib" .