-
Notifications
You must be signed in to change notification settings - Fork 0
Building
You only need this if you want to modify omp-MySQL or build it yourself — most people should just grab a release.
- 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-MySQLForgot
--recurse-submodules? Rungit 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.
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 ReleaseShip 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-clis possible (seecmake/toolchain-clang-cl-win32.cmake) but native MSVC + the GitHub CI path is the supported route.
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-proofingThe script handles the container, dependencies (OpenSSL/zlib), and the build.
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.dylibThen 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-serverThis 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.
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.)
.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 →
Understand
Use
- Installing MySQL
- Docker Compose
- Getting started
- Configuration
- SQL crash course
- Designing your tables
- Storing game data
- Dates & times
- First queries
- Async patterns
- Reading results
- Prepared statements
- Passwords & hashing
- Transactions
- Models (active-record)
- Tutorial: login system
- mysql-admin demo
Deeper
Reference