Closed germanfica closed 2 months ago
I fixed the compile error issue! Thanks to Dependency Walker I was able to identify the missing dlls, and I was able to understand that the problem was on my side by not including the LIBCRYPTO-3-X64.DLL
and LIBSSL-3-X64.DLL
dlls that were in C:\mysql-8.0.36-winx64\bin
directory in my windows path.
In later MySQL versions than 8.0.17
, if your PATH doesn't include C:\mysql-8.0.36-winx64\bin
, the system won't be able to find libcrypto-3-x64.dll
and libssl-3-x64.dll
, leading to compile error issues (missing DLLs).
When setting up MySQL Client on Windows, you might encounter issues related to missing dependencies, particularly when working with specific versions of MySQL. Here's a step-by-step guide to ensure everything is configured correctly.
Step 1: Set Up Environment Variables
To resolve issues related to missing DLL files, it's essential to correctly set your environment variables. Here's what you need to do:
Add MySQL Bin Directory to PATH:
libcrypto-3-x64.dll
and libssl-3-x64.dll
.PATH=C:\mysql-8.0.36-winx64\bin
Set Additional MySQL Client Variables:
MYSQLCLIENT_LIB_DIR=C:\mysql-8.0.36-winx64\lib
MYSQLCLIENT_VERSION=8.0.36
Step 2: Identify and Ensure Presence of Critical DLLs
The most important MySQL libraries and DLLs that should be present in your setup include:
mysqlclient.lib
LIBCRYPTO-3-X64.DLL
LIBSSL-3-X64.DLL
If you encounter errors related to missing DLL files, you can use a Dependency Walker tool to identify them and ensure these critical libraries are included.
Step 3: Verify Environment Configuration
After setting the environment variables, double-check that the PATH includes the directory where these DLLs are located. This step is crucial because the absence of the correct PATH configuration can lead to errors when the system tries to locate necessary libraries.
For example, in versions later than MySQL 8.0.17
, if your PATH doesn't include C:\mysql-8.0.36-winx64\bin
, the system won't be able to find libcrypto-3-x64.dll
and libssl-3-x64.dll
, leading to compile error issues.
Step 4: Test the Configuration
Once you've updated your environment variables, test your setup by running your application:
cargo clean
cargo run
If everything is configured correctly, the errors should be resolved.
Conclusion
The properly setup environment variables and the presence of critical libraries such as mysqlclient.lib
, LIBCRYPTO-3-X64.DLL
and LIBSSL-3-X64.DLL
are crucial when working with MySQL on Windows. Ensure that all necessary directories are included in your PATH and that any additional variables are set correctly. This will prevent common issues like missing DLLs and help your application run smoothly.
It is important to add C:\mysql-8.x-winx64\lib
directory in windows 10 environment variables Path
to ensure libcrypto-3-x64.dll
and libssl-3-x64.dll
DLLs are included in the compile process. This ensures that the rust compiler will be able to get the dlls
it needs to compile correctly. Or you can simply paste the missing dlls
in the target folder of your project.
Tested versions on Windows 10:
MySQL 8.0.18 (works).
3c1fc0bc3368639d968fbe5bf8afa23d
Path=C:\mysql-8.0.18-winx64\bin
MYSQLCLIENT_LIB_DIR=C:\mysql-8.0.18-winx64\lib
MYSQLCLIENT_VERSION=8.0.18
MySQL 8.0.19 (works).
f52c52e7b499958acc5f08ce0a869cab
Path=C:\mysql-8.0.19-winx64\bin
MYSQLCLIENT_LIB_DIR=C:\mysql-8.0.19-winx64\lib
MYSQLCLIENT_VERSION=8.0.19
MySQL 8.0.20 (works).
1335fe593b055686823fd69c7ef035f5
Path=C:\mysql-8.0.20-winx64\bin
MYSQLCLIENT_LIB_DIR=C:\mysql-8.0.20-winx64\lib
MYSQLCLIENT_VERSION=8.0.20
MySQL 8.0.30 (works).
d17b3d4bab676a2c365b82f65c9a5374
Path=C:\mysql-8.0.30-winx64\bin
MYSQLCLIENT_LIB_DIR=C:\mysql-8.0.30-winx64\lib
MYSQLCLIENT_VERSION=8.0.30
MySQL 8.0.36 (works).
a2f95f3625440e61d9012c5e2364bd79
Path=C:\mysql-8.0.36-winx64\bin
MYSQLCLIENT_LIB_DIR=C:\mysql-8.0.36-winx64\lib
MYSQLCLIENT_VERSION=8.0.36
MySQL 8.0.37 (works).
936fc116f2dd865dc26ef3d71f5730e8
Path=C:\mysql-8.0.37-winx64\bin
MYSQLCLIENT_LIB_DIR=C:\mysql-8.0.37-winx64\lib
MYSQLCLIENT_VERSION=8.0.37
MySQL 8.0.39 (works).
MD5: bfba039694efb85916830cf9dc65ccc8
Path=C:\mysql-8.0.39-winx64\bin
MYSQLCLIENT_LIB_DIR=C:\mysql-8.0.39-winx64\lib
MYSQLCLIENT_VERSION=8.0.39
MySQL 8.4.0 (works).
MD5: 23fa293db80b5d49f9e97d34c2037a82
Path=C:\mysql-8.4.0-winx64\bin
MYSQLCLIENT_LIB_DIR=C:\mysql-8.4.0-winx64\lib
MYSQLCLIENT_VERSION=8.4.0
MySQL 8.4.2 (works).
MD5: 9aad84967d8a94c390e76366ca85ec3c
Path=C:\mysql-8.4.2-winx64\bin
MYSQLCLIENT_LIB_DIR=C:\mysql-8.4.2-winx64\lib
MYSQLCLIENT_VERSION=8.4.2
MySQL 9.0.1 (works).
MD5: bfba039694efb85916830cf9dc65ccc8
Path=C:\mysql-8.4.2-winx64\bin
MYSQLCLIENT_LIB_DIR=C:\mysql-8.4.2-winx64\lib
MYSQLCLIENT_VERSION=8.4.2
I closed the issue as this is a setup error in the user environment.
Thanks for coming back and reporting that it works now. It just seems like upstream changed some things between these versions.
For future reference:
error: process didn't exit successfully: `target\debug\mysqlclient_example.exe` (exit code: 0xc0000135, STATUS_DLL_NOT_FOUND)
This error is always a runtime error, not a compile time error. That often indicates an environment setup issue.
Summary
While working with the
mysqlclient-sys
library, I encountered a compilation issue with the bindings forMySQL 8.x
on Windows. The error suggests that certain DLLs are missing during the compilation process.Steps to Reproduce
cargo clean
to clean the target directory, which contains the compiled artifacts (binaries, dependencies, and intermediate build files) of the Rust project.cargo run
to compile the project.Error Encountered:
Workaround
I opted to use a MySQL version that worked for me, specifically MySQL 8.0.17. This version does not produce the compilation error.
Request
I am reporting this issue in hopes that someone with more experience with the
mysqlclient-sys
library can investigate further. It seems there may be a compatibility issue with the bindings for certain MySQL versions on Windows, particularly with newer versions like 8.4.2 LTS. No comprehensive tests have been conducted to verify this across other environments.Environment
mysqlclient-sys
v0.4.1dotenv
v0.15.0MySQL Version tested on Windows:
8.0.0 (works). MD5:
c6d3e54f4eab46d75a845e15f3023d0a
MYSQLCLIENT_LIB_DIR=C:\mysql-8.0.0-dmr-winx64\lib
MYSQLCLIENT_VERSION=8.0.0
8.0.11 (works). MD5:
0b4efe256a28cd391bf057d4c61ade09
MYSQLCLIENT_LIB_DIR=C:\mysql-8.0.11-winx64\lib
MYSQLCLIENT_VERSION=8.0.11
8.0.16 (works). MD5:
1a6646b047425cc1150b8a88751e721b
MYSQLCLIENT_LIB_DIR=C:\mysql-8.0.16-winx64\lib
MYSQLCLIENT_VERSION=8.0.16
8.0.17 (works). MD5:
d120bb0513c2ccfaeee74b0e99217bb7
MYSQLCLIENT_LIB_DIR=C:\mysql-8.0.17-winx64\lib
MYSQLCLIENT_VERSION=8.0.17
8.0.18 (compile error). MD5:
3c1fc0bc3368639d968fbe5bf8afa23d
MYSQLCLIENT_LIB_DIR=C:\mysql-8.0.18-winx64\lib
MYSQLCLIENT_VERSION=8.0.18
8.0.19 (compile error). MD5:
f52c52e7b499958acc5f08ce0a869cab
MYSQLCLIENT_LIB_DIR=C:\mysql-8.0.19-winx64\lib
MYSQLCLIENT_VERSION=8.0.19
8.0.20 (compile error). MD5:
1335fe593b055686823fd69c7ef035f5
MYSQLCLIENT_LIB_DIR=C:\mysql-8.0.20-winx64\lib
MYSQLCLIENT_VERSION=8.0.20
8.0.30 (compile error). MD5:
d17b3d4bab676a2c365b82f65c9a5374
MYSQLCLIENT_LIB_DIR=C:\mysql-8.0.30-winx64\lib
MYSQLCLIENT_VERSION=8.0.30
8.0.36 (compile error). MD5:
936fc116f2dd865dc26ef3d71f5730e8
MYSQLCLIENT_LIB_DIR=C:\mysql-8.0.36-winx64\lib
MYSQLCLIENT_VERSION=8.0.36
8.0.37 (compile error). MD5:
936fc116f2dd865dc26ef3d71f5730e8
MYSQLCLIENT_LIB_DIR=C:\mysql-8.0.37-winx64\lib
MYSQLCLIENT_VERSION=8.0.37
8.4.2 LTS (compile error) - Windows (x86, 64-bit), MSI Installer - (mysql-8.4.2-winx64.msi) MD5:
888dc0f177ce11ed461294ff797824c7
Additional Information
If anyone has encountered similar issues or has insights into resolving this, I would appreciate the assistance. Thank you for your time and help.