Repository: diesel-rs/diesel (language: rust)

Issue:
Compile Error: assertion `left == right` failed: Unexpected output from mysql_config: `-L/usr/local/mysql/lib -lmysqlclient -lssl -lcrypto -lresolv`
<!--
If you want to report a bug, we added some points below which help us track down the problem faster.
-->

## Setup

### Versions

- **Rust:*1.72*
- **Diesel:*2.2.0*
- **Database:*MySQL*
- **Operating System*MacOS 12*

### Feature Flags

- **diesel:** ["mysql", "chrono", "r2d2"]

## Problem Description
I've been using diesel for awhile with no issue. Recently I started getting this compilation error and all efforts to troubleshoot have failed, including downgrading to previous versions. This is the error:

```bash
--- stderr
  thread 'main' panicked at /Users/prodbyola/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mysqlclient-sys-0.3.1/build.rs:59:9:
  assertion `left == right` failed: Unexpected output from mysql_config: `-L/usr/local/mysql/lib -lmysqlclient -lssl -lcrypto -lresolv`
    left: 5
   right: 2
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

I also tried moving my project to Windows (WSL) to be sure it's not platform-specific issue. But I got very similar error. I'm not sure how to fix this please.

### What are you trying to accomplish?


### What is the expected output?


### What is the actual output?


### Are you seeing any additional errors?


### Steps to reproduce

<!--
Please include as much of your codebase as needed to reproduce the error.  If the relevant files are large, please consider linking to a public repository or a [Gist](https://gist.github.com/). This includes normally the following parts:

* The exact code where your hit the problem
* Relevant parts your schema, so any `table!` macro calls required for
* Any other type definitions involved in the code, which produces your problem
-->

## Checklist

- [ ] I have already looked over the [issue tracker](https://github.com/diesel-rs/diesel/issues) and the [discussion forum](https://github.com/diesel-rs/diesel/discussions) for similar possible closed issues.
<!--
If you are unsure if your issue is a duplicate of an existing issue please link the issue in question here
--> 
- [ ] This issue can be reproduced on Rust's stable channel. (Your issue will be
  closed if this is not the case)
- [ ] This issue can be reproduced without requiring a third party crate

<!--
Thank you for your submission!  You're helping make Diesel more robust 🎉

We'll try to respond as quickly as possible.
-->



Discussion / hints:
Thanks for reporting.
This is an issue in the mysqlclient-sys crate, not a diesel issue. The build script logic there expects a different output from the `mysql_config` tool. 

You likely can workaround this by setting the `MYSQLCLIENT_LIB_DIR` environment variable to point to the right folder.


Fix patch:
diff --git a/diesel/Cargo.toml b/diesel/Cargo.toml
index 1d67eea1c720..f9ff67175287 100644
--- a/diesel/Cargo.toml
+++ b/diesel/Cargo.toml
@@ -25,7 +25,7 @@ byteorder = { version = "1.0", optional = true }
 chrono = { version = "0.4.20", optional = true, default-features = false, features = ["clock", "std"] }
 libc = { version = "0.2.0", optional = true }
 libsqlite3-sys = { version = ">=0.17.2, <0.29.0", optional = true, features = ["bundled_bindings"] }
-mysqlclient-sys = { version = ">=0.2.5, <0.4.0",  optional = true }
+mysqlclient-sys = { version = ">=0.2.5, <0.5.0",  optional = true }
 mysqlclient-src = { version = "0.1.0", optional = true }
 pq-sys = { version = ">=0.4.0, <0.7.0", optional = true }
 pq-src = { version = "0.3", optional = true }
diff --git a/diesel_cli/Cargo.toml b/diesel_cli/Cargo.toml
index 78dc0e541436..4842bd64864e 100644
--- a/diesel_cli/Cargo.toml
+++ b/diesel_cli/Cargo.toml
@@ -47,7 +47,7 @@ url = { version = "2.2.2" }
 libsqlite3-sys = { version = ">=0.17.2, <0.29.0", optional = true }
 pq-sys = { version = ">=0.4, <0.7.0", optional = true }
 openssl-sys = { version = "0.9.93", features = ["vendored"], optional = true }
-mysqlclient-sys = { version = ">=0.2.5, <0.4.0", optional = true }
+mysqlclient-sys = { version = "0.4.0", optional = true }
 diffy = "0.3.0"
 regex = "1.0.6"
 serde_regex = "1.1"


Test patch:
diff --git a/diesel_tests/Cargo.toml b/diesel_tests/Cargo.toml
index 029d9720ab8c..5e113286de25 100644
--- a/diesel_tests/Cargo.toml
+++ b/diesel_tests/Cargo.toml
@@ -24,7 +24,7 @@ rand = "0.8.4"
 libsqlite3-sys = { version = "0.28", optional = true }
 pq-sys = { version = "0.6", optional = true }
 pq-src = { version = "0.3", optional = true }
-mysqlclient-sys = { version = "0.3", optional = true }
+mysqlclient-sys = { version = "0.4", optional = true }
 mysqlclient-src = { version = "0.1.0", optional = true }
 
 [features]