This section describes aspects of building Connector/C++ applications that are specific to macOS. For general application-building information, see Section 5.1, “Building Connector/C++ Applications: General Considerations”.
The binary distribution of Connector/C++ for macOS is compiled using the macOS native clang compiler. For that reason, an application that uses Connector/C++ should be built with the same clang compiler.
The clang compiler can use two different
implementations of the C++ runtime library: either the native
libc++
or the GNU
libstdc++
library. It is important that an
application uses the same runtime implementation as Connector/C++ that
is, the native libc++
. To ensure that, the
-stdlib=libc++
option should be passed to the
compiler and the linker invocations.
To build a Connector/C++ application that uses X DevAPI, has sources
in app.cc
, and links dynamically to the
connector library, the Makefile
for
building on macOS might look like this:
MYSQL_CONCPP_DIR = Connector/C++ installation ___location
CPPFLAGS = -I $(MYSQL_CONCPP_DIR)/include -L $(MYSQL_CONCPP_DIR)/lib64
LDLIBS = -lmysqlcppconn8
CXX = clang++ -stdlib=libc++
CXXFLAGS = -std=c++17
app : app.cc
Binary packages for macOS include OpenSSL libraries that are required by code linked with the connector. These libraries are installed in the same ___location as the connector libraries and should be found there by the dynamic linker.