Please note we will close your issue without comment if you delete, do not read or do not fill out the issue checklist below and provide ALL the requested information. If you repeatedly fail to use the issue template, we will block you from ever submitting issues to Homebrew again.
brew install (or upgrade, reinstall) a single, Homebrew/homebrew-core formula (not cask) on macOS? If it's a general brew problem please file this issue at Homebrew/brew: https://github.com/Homebrew/brew/issues/new/choose. If it's a Linux problem please file this issue at https://github.com/Homebrew/linuxbrew-core/issues/new/choose. If it's a brew cask problem please file this issue at https://github.com/Homebrew/homebrew-cask/issues/new/choose. If it's a tap (e.g. Homebrew/homebrew-php) problem please file this issue at the tap.brew update and can still reproduce the problem?brew doctor, fixed all issues and can still reproduce the problem?brew gist-logs <formula> (where <formula> is the name of the formula that failed) and included the output link?brew gist-logs didn't work: ran brew config and brew doctor and included their output with your issue?To help us debug your issue please explain:
Install mysqlclient-python to use MySQL with Django
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
...
clang -bundle -undefined dynamic_lookup build/temp.macosx-10.14-x86_64-3.7/MySQLdb/_mysql.o -L/usr/local/Cellar/[email protected]/5.6.46/lib -L/usr/local/lib -L/usr/local/opt/[email protected]/lib -L/usr/local/opt/sqlite/lib -lmysqlclient -limported_openssl -limported_crypto -o build/lib.macosx-10.14-x86_64-3.7/MySQLdb/_mysql.cpython-37m-darwin.so
ld: library not found for -limported_openssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
Install to succeed
brew install commands)$ brew install [email protected]
$ export PATH="/usr/local/opt/[email protected]/bin:$PATH"
$ python3 -m venv venv
$ source venv/bin/activate
$ pip install --no-cache-dir mysqlclient
This does not happen in 5.6.43, or 5.7.28. The difference is visible in mysql_config, which is what led me to file an issue here (instead of mysqlclient-python).
5.6.43:
$ mysql_config
Usage: /usr/local/opt/[email protected]/bin/mysql_config [OPTIONS]
Options:
--cflags [-I/usr/local/opt/[email protected]/include/mysql -g -fno-omit-frame-pointer -fno-strict-aliasing]
--cxxflags [-I/usr/local/opt/[email protected]/include/mysql -g -fno-omit-frame-pointer -fno-strict-aliasing]
--include [-I/usr/local/opt/[email protected]/include/mysql]
--libs [-L/usr/local/opt/[email protected]/lib -lmysqlclient -lssl -lcrypto]
--libs_r [-L/usr/local/opt/[email protected]/lib -lmysqlclient -lssl -lcrypto]
--plugindir [/usr/local/opt/[email protected]/lib/plugin]
--socket [/tmp/mysql.sock]
--port [0]
--version [5.6.43]
--libmysqld-libs [-L/usr/local/opt/[email protected]/lib -lmysqld -lssl -lcrypto]
--variable=VAR VAR is one of:
pkgincludedir [/usr/local/opt/[email protected]/include/mysql]
pkglibdir [/usr/local/opt/[email protected]/lib]
plugindir [/usr/local/opt/[email protected]/lib/plugin]
5.6.46:
$ mysql_config
Usage: /usr/local/opt/[email protected]/bin/mysql_config [OPTIONS]
Options:
--cflags [-I/usr/local/opt/[email protected]/include/mysql -g -fno-omit-frame-pointer -fno-strict-aliasing]
--cxxflags [-I/usr/local/opt/[email protected]/include/mysql -g -fno-omit-frame-pointer -fno-strict-aliasing]
--include [-I/usr/local/opt/[email protected]/include/mysql]
--libs [-L/usr/local/opt/[email protected]/lib -lmysqlclient -limported_openssl -limported_crypto]
--libs_r [-L/usr/local/opt/[email protected]/lib -lmysqlclient -limported_openssl -limported_crypto]
--plugindir [/usr/local/opt/[email protected]/lib/plugin]
--socket [/tmp/mysql.sock]
--port [0]
--version [5.6.46]
--libmysqld-libs [-L/usr/local/opt/[email protected]/lib -lmysqld]
--variable=VAR VAR is one of:
pkgincludedir [/usr/local/opt/[email protected]/include/mysql]
pkglibdir [/usr/local/opt/[email protected]/lib]
plugindir [/usr/local/opt/[email protected]/lib/plugin]
Output from gist-logs, config, and doctor.
Also:
$ brew list --versions | grep -E "(python|mysql|ssl)"
[email protected] 5.6.46
openssl 1.0.2t
[email protected] 1.1.1d
python 3.7.4_1
python@2 2.7.16_1
FWIW, I found references to imported_openssl in the MySQL source:
https://github.com/mysql/mysql-server/blob/5.6/cmake/ssl.cmake#L205-L227
Same thing happens with the mysql ruby gem:
https://github.com/brianmario/mysql2/issues/1074
I worked around this by downgrading to 5.6.43 via:
$ brew reinstall https://raw.githubusercontent.com/Homebrew/homebrew-core/f171f1c74/Formula/[email protected]
I found the commit hash via:
$ brew log --oneline [email protected]
d72887a5a [email protected]: brew style --fix
c63dc0143 [email protected]: update 5.6.46 bottle.
322f7afae [email protected] 5.6.46
f171f1c74 [email protected]: update 5.6.43 bottle.
11d8b7fac [email protected]: update 5.6.43 bottle.
c0461cdb4 [email protected]: no OpenSSL 1.1 support
70961cbfd [email protected]: update 5.6.43 bottle.
e579e5ae2 [email protected] 5.6.43
8978dc9c6 [email protected]: remove references to pre-Mavericks.
0a9a09d9d (grafted) nativefier: update 7.6.9 bottle.
Can anyone shed light on this issue in plain English? Is OpenSSL 1.1.1d the culprit here?
Ever since I upgraded, my PHP-based application crashes as soon as it tries to use OpenSSL functions. Installed via MacPorts (not Homebrew). I see that Homebrew considers an older version of OpenSSL as stable, which is a more conservative approach that I like. There's no easy way to roll back to an older version using MacPorts, and it insists on installing its own copy of OpenSSL.
Sorry if I'm way off track here. Searching desperately for some proof that OpenSSL 1.1.1.d is broken on macOS, and reverting to an older version would make this headache go away.
@TheDigitalOrchard: unfortunately for the prognosis for your headache, the specific issue described here is that the new link directives in MySQL 5.6.46 cause build problems with libraries that link against MySQL. This issue doesn't describe runtime problems. Wish I could be of more help.
Thanks @bhrutledge for this post and your solution!
Hi folks, I have a possible fix in #46379. See there for details on what changed in the upgrade to 5.6.46 and how I've attempted to revert those unintended changes.
Thanks @Bo98! The fixed worked for me, and I can now pip install mysqlclient.
Most helpful comment
I worked around this by downgrading to 5.6.43 via:
I found the commit hash via: