From c8b70a649f31f0a45df81def0ce9e6dffb12805b Mon Sep 17 00:00:00 2001 From: Jacob Quinn Date: Wed, 28 Jan 2026 19:34:41 -0700 Subject: [PATCH] Fix OpenSSL library loading for MariaDB authentication plugins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MariaDB authentication plugins (e.g., caching_sha2_password) depend on OpenSSL, but when MariaDB loads them via dlopen at runtime, the dynamic linker can't find OpenSSL because it's in a different JLL artifact. This fix pre-loads OpenSSL libraries with RTLD_GLOBAL when the API module initializes. This makes OpenSSL symbols globally available to subsequently loaded libraries, allowing the plugins to find them. Fixes #232 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- Project.toml | 4 +++- src/api/API.jl | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index c1af02a..36af441 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "MySQL" uuid = "39abe10b-433b-5dbd-92d4-e302a9df00cd" author = ["quinnj"] -version = "1.5.0" +version = "1.5.1" [deps] DBInterface = "a10d1c49-ce27-4219-8d33-6db1a4562965" @@ -9,6 +9,7 @@ Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" DecFP = "55939f99-70c6-5e9b-8bb0-5071ed7d61fd" Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" MariaDB_Connector_C_jll = "aabc7e14-95f1-5e66-9f32-aea603782360" +OpenSSL_jll = "458c3c95-2e84-50aa-8efc-19380b2a3a95" Parsers = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" @@ -17,6 +18,7 @@ Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" DBInterface = "2.5" DecFP = "0.4.9, 0.4.10, 1" MariaDB_Connector_C_jll = "3.1.12" +OpenSSL_jll = "3" Parsers = "0.3, 1, 2" Tables = "1" julia = "1.6" diff --git a/src/api/API.jl b/src/api/API.jl index b60f1bb..b0b2a60 100644 --- a/src/api/API.jl +++ b/src/api/API.jl @@ -1,12 +1,27 @@ module API -using Dates, DecFP +using Dates, DecFP, Libdl export DateAndTime using MariaDB_Connector_C_jll +using OpenSSL_jll: libssl, libcrypto + const PLUGIN_DIR = joinpath(MariaDB_Connector_C_jll.artifact_dir, "lib", "mariadb", "plugin") +# Pre-load OpenSSL libraries so they're available when MariaDB loads plugins. +# MariaDB authentication plugins (e.g., caching_sha2_password) depend on OpenSSL, +# but when MariaDB loads them via dlopen, the dynamic linker can't find OpenSSL +# because it's in a different artifact. By loading OpenSSL with RTLD_GLOBAL first, +# its symbols become available to subsequently loaded libraries. +# See: https://github.com/JuliaDatabases/MySQL.jl/issues/232 +function __init__() + @static if !Sys.iswindows() + Libdl.dlopen(libcrypto, Libdl.RTLD_GLOBAL) + Libdl.dlopen(libssl, Libdl.RTLD_GLOBAL) + end +end + # const definitions from mysql client library include("consts.jl")