Build MariaDB Connector/C from source. Download the package from MariaDB downloads or get the latest development version from the Connector/C GitHub repository.
After successful configuration, Connector/C can now be compiled.
If no CMake generator was specified, CMake creates by default build files for Visual Studio. You can now either build Connector/C inside Visual Studio
devenv mariadb_connector_c.sln
or via command line
cmake --build . --config RelWithDebInfo
By default CMake creates build files for GNU make. On some system GNU make is renamed to gmake. You can now build Connector/C with
make
or
cmake --build . --config Release
Connector/C specifies its build process with platform-independent CMake listfiles included in each directory of a source tree with the name CMakeLists.txt. Configuration settings may be specified by passing the -D option to CMake command line interpreter.
Do not build Connector/C from root of the source tree: Either create a subdirectory "build" inside the source tree or create a subdirectory outside of the source tree.
Example:
cmake ../connector_c -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local
In case Connector/C was already configured, the CMakeCache.txt file needs to be removed first. In several cases, e.g. when cross compiling CMakeFiles subfolders need to be removed too.
If you want to use a different generator, e.g. for nmake on Windows, you need to specify the generator with the -G
option. cmake --help
lists the available generators for the used platform.
CMAKE_BUILD_TYPE
Build type: Release, RelWithDebInfo or Debug
CMAKE_INSTALL_PREFIX
Installation base directory
CMAKE_C_FLAGS
Flags for C-Compiler
Option
Default
Description
WITH_OPENSSL
ON
Possible values are ON or OFF. Not supported anymore since Connector/C 3.0
WITH_SSL
SCHANNEL (windows), otherwise OPENSSL
Specifies type of TLS/SSL library. E.g. GNUTLS, OPENSSL or SCHANNEL (Windows only). OFF disables TLS/SSL functionality
Client plugins can be configured as dynamic plugins (DYNAMIC) or built-in plugins (STATIC) by specifying the plugin name followed by suffix _PLUGIN_TYPE as key, and "DYNAMIC" or "STATIC" as value.
E.g. for building dialog plugin as a built-in plugin, for versions < Connector/C 3.0.4
cmake .. -D{PLUGIN_NAME}_PLUGIN_TYPE=[STATIC|DYNAMIC|OFF]
Beginning with C/C 3.0.4
cmake .. -DCLIENT_PLUGIN_{PLUGIN_NAME}=[STATIC|DYNAMIC|OFF]
Connector/C 3.0 supports the following plugins:
Plugin
Type
Default
Description
SOCKET
IO
static
plugin for client server communication via socket
SHMEM
IO
static
plugin for client server communication via shared memory
NPIPE
IO
static
plugin for client server communication via named pipe
DIALOG
Authentication
dynamic
Authentication for user input, e.g. for PAM authentication
OLDPASSWORD
Authentication
static
Pre. 4.1 authentication (deprecated)
NATIVE
Authentication
static
Default authentication
CLEARTEXT
Authentication
dynamic
Sends password without hashing or encryption
AUTH_GSSAPI
Authentication
dynamic
Kerberos/GSSAPI authentication plugin
SHA256_PASSWORD
Authentication
dynamic
SHA256 password authentication plugin
AURORA
Connection
OFF
Fail over plugin for Aurora (experimental)
REPLICATION
Connection
OFF
Replication/fail over plugin (experimental)
Visual Studio 2013 or newer (older versions of Visual Studio may also work but have not been tested).
cmake 2.8.12 or newer, available from the CMake website.
for Connector/C 2.x: OpenSSL libraries and include files.
for Connector/C 3.0 remote-io plugin: Curl libraries and include files
The following is a list of tools that are required for building MariaDB Connector/C on Linux and Mac OS X. Most, if not all, of these will exist as packages in your distribution's package repositories, so check there first.
gcc 3.4.6 or newer C compiler
TLS/SSL libraries and include files
OpenSSL 1.0.1 or newer or
GnuTLS 3.4 or newer
cmake 2.8.12 or newer, available from the CMake website.
for Connector/C 3.0 remote-io plugin: Curl libraries and include files
For GSSAPI plugin: Kerberos V5 libraries
On Linux you can get those programs with your package manager. On Mac OS X you will need Xcode and to install the remaining programs with Fink or MacPorts.