Closed Diggsey closed 5 months ago
If anyone is interested, I took the instruction above and made https://github.com/pzmarzly/mysqlclient-sys - fork containing a pre-built binary.
If your program uses Diesel and you want it to compile with musl, you can add this to your Cargo.toml
:
[patch.crates-io]
mysqlclient-sys = { git = "https://github.com/pzmarzly/mysqlclient-sys", rev = "acd1b2b" }
Note the license change (explained in fork's README).
Fixed with #39
This should work as closely as possible to the logic in
pq-sys
.At a minimum, I would like an env var
MYSQLCLIENT_LIB_STATIC
which could be set to force static linking to mysql.The workaround mentioned elsewhere (adding a build script with
println!(r"cargo:rustc-link-lib=static=mysqlclient");
) does not work because of the ordering of libraries in the link command. (liblibc
ends up getting added before-lmysqlclient
which causes unresolved symbol errors for all libc symbols used by mysqlclient but not used by rust)In case anyone is interested, I was completely unable to compile mysqlclient statically for the musl target due to its ridiculous and broken build system, and the fact that it is written in C++. However I was able to build mariadbclient (written in C) for musl, and the client-side of mariadb is near enough identical that it should be usable in place of mysqlclient, at least if you stick to using mysqlclient's public, documented API.
Commands for obtaining mariadbclient in a system with musl-gcc: