Skip to content

Building

Xyranaut edited this page Jun 1, 2026 · 1 revision

Building from source

You only need this if you want to modify omp-MySQL or build it yourself — most people should just grab a release.

Prerequisites (all platforms)

  • CMake ≥ 3.19
  • A C++20 compiler
  • Git (the MySQL client is a submodule built from source)
git clone --recurse-submodules https://github.com/Mac-Andreas/omp-MySQL
cd omp-MySQL

Forgot --recurse-submodules? Run git submodule update --init --recursive.

open.mp servers/components are 32-bit (i386), so the shipping binaries are i386. The MySQL client (MariaDB Connector/C) is statically linked, so you don't need any MySQL client installed.


Windows (.dll)

The component must be built with the MSVC ABI. A mingw/gcc build will load but then crash omp-server (its vtable layout differs). Use native MSVC.

OpenSSL is provided via vcpkg:

vcpkg install openssl:x86-windows

cmake -B build-win32 -A Win32 -DCMAKE_BUILD_TYPE=Release ^
  -DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake ^
  -DVCPKG_TARGET_TRIPLET=x86-windows
cmake --build build-win32 --config Release

Ship omp-mysql.dll plus libssl-3.dll and libcrypto-3.dll (from the vcpkg bin folder) — the DLL needs them at runtime.

Cross-compiling from macOS/Linux with clang-cl is possible (see cmake/toolchain-clang-cl-win32.cmake) but native MSVC + the GitHub CI path is the supported route.


Linux (.so)

Built in a 32-bit Debian bullseye container (glibc 2.31 — matches the open.mp Linux server; newer distros link against glibc symbols the server can't resolve). You just need Docker:

ARCH=32 ./scripts/build-linux.sh      # -> build-linux/omp-mysql.so
# ARCH=64 ./scripts/build-linux.sh    # 64-bit, future-proofing

The script handles the container, dependencies (OpenSSL/zlib), and the build.


macOS (.dylib) — development only

There is no macOS open.mp server, so the .dylib is never shipped. But it's the fastest way to develop/iterate, because you can build natively and drop the dylib straight into a macOS open.mp dev server:

brew install openssl@3 zstd
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build              # -> build/omp-mysql.dylib

Then copy build/omp-mysql.dylib into your macOS dev server's components/. When connecting to a MySQL using its self-signed cert, point OpenSSL at the CA so verification passes:

SSL_CERT_FILE=scriptfiles/ca.pem ./omp-server

This dev loop (build → drop dylib → run) takes seconds, with no CI or emulation — ideal for working on the component before producing the real Windows/Linux artifacts.

Sanitizers (memory testing on macOS)

cmake -B build-asan -DCMAKE_BUILD_TYPE=Debug \
  -DCMAKE_CXX_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer -g" \
  -DCMAKE_C_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer -g" \
  -DCMAKE_SHARED_LINKER_FLAGS="-fsanitize=address,undefined"
cmake --build build-asan
# load into the dev server with the ASan runtime injected:
DYLD_INSERT_LIBRARIES="$(find $(xcode-select -p) -name libclang_rt.asan_osx_dynamic.dylib | head -1)" \
  ./omp-server

(LeakSanitizer isn't available on macOS arm64, but ASan catches overflows/UAF.)


CI

.github/workflows/build.yml builds the Windows + Linux artifacts on every push and attaches them to tagged releases. The macOS job runs as a dev sanity check only.

Next: Native reference →

Clone this wiki locally