Closed gthank closed 1 year ago
I had this problem too, with mysql2 0.4.10 and 0.5.2. I learned that linking against -limported_openssl
is new in MySQL 5.6.46. See /usr/local/opt/mysql\@5.6/bin/mysql_config. 5.6.46 is new as of Monday, 10/14, and includes changes to allow compiling against OpenSSL 1.1.1. See https://dev.mysql.com/doc/relnotes/mysql/5.6/en/news-5-6-46.html. So it makes sense that they modified the link statements related to the SSL library.
I don't yet know how to fix this, but I worked around it by reverting my Homebrew mysql@5.6 formula to the last version before the changes to install 5.6.46, and reinstalling, which gets you 5.6.43. This is not a great solution, but here's how I did it:
brew uninstall mysql@5.6
cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
git checkout f171f1c746db01c283aa137cb24248fbb8eb7a18 Formula/mysql@5.6.rb
brew install mysql@5.6
5.6.43's version of /usr/local/opt/mysql\@5.6/bin/mysql_config is different with respect to SSL lib linking. Instead of -limported_openssl
it has -lssl
.
git checkout f171f1c746db01c283aa137cb24248fbb8eb7a18 Formula/mysql@5.6.rb
didn't work for me.
I simply replaced /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/mysql@5.6.rb
with this version: https://github.com/Homebrew/homebrew-core/blob/f171f1c746db01c283aa137cb24248fbb8eb7a18/Formula/mysql%405.6.rb
@JulienSansot Thanks, this is the route I took. It unblocked me right away.
Sorry the git checkout
command above didn’t work for you, @JulienSansot. I tried again on my machine and it worked for me. Weird.
Thanks @toddthomas for the pointers.
@JulienSansot: I went around in circles on this one, too. The clue that put me on the right track was here:
% brew install mysql@5.6
Updating Homebrew...
To restore the stashed changes to /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core run:
'cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core && git stash pop'
So I did the git stash pop
and checked that I had the correct version of the formula:
% git diff | fgrep 5.6.4
- url "https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.46.tar.gz"
+ url "https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.43.tar.gz"
Then did brew uninstall mysql@5.6 && brew install mysql@5.6
and then I could gem install mysql2
.
Phew! Another yak shaved.
git checkout f171f1c746db01c283aa137cb24248fbb8eb7a18 Formula/mysql@5.6.rb
didn't work for me. I simply replaced/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/mysql@5.6.rb
with this version: https://github.com/Homebrew/homebrew-core/blob/f171f1c746db01c283aa137cb24248fbb8eb7a18/Formula/mysql%405.6.rb
@JulienSansot Thanks for this.
Instead of the uninstall
and checkout
, you can reinstall
from a URL:
$ brew reinstall https://raw.githubusercontent.com/Homebrew/homebrew-core/f171f1c74/Formula/mysql@5.6.rb
I found the commit hash via:
$ brew log --oneline mysql@5.6
d72887a5a mysql@5.6: brew style --fix
c63dc0143 mysql@5.6: update 5.6.46 bottle.
322f7afae mysql@5.6 5.6.46
f171f1c74 mysql@5.6: update 5.6.43 bottle.
11d8b7fac mysql@5.6: update 5.6.43 bottle.
c0461cdb4 mysql@5.6: no OpenSSL 1.1 support
70961cbfd mysql@5.6: update 5.6.43 bottle.
e579e5ae2 mysql@5.6 5.6.43
8978dc9c6 mysql@5.6: remove references to pre-Mavericks.
0a9a09d9d (grafted) nativefier: update 7.6.9 bottle.
Thanks @bhrutledge--that's a very nice feature of brew reinstall
I didn't know about.
Also, in case it wasn't clear, I'm guessing this isn't a problem wiith mysql2, but rather with the Homebrew mysql@5.6 formula, or even MySQL itself.
See https://github.com/Homebrew/homebrew-core/issues/45397 for details.
Thanks @bhrutledge-- you've made my day
git checkout f171f1c746db01c283aa137cb24248fbb8eb7a18 Formula/mysql@5.6.rb
didn't work for me. I simply replaced/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/mysql@5.6.rb
with this version: https://github.com/Homebrew/homebrew-core/blob/f171f1c746db01c283aa137cb24248fbb8eb7a18/Formula/mysql%405.6.rbI had this problem too, with mysql2 0.4.10 and 0.5.2. I learned that linking against
-limported_openssl
is new in MySQL 5.6.46. See /usr/local/opt/mysql@5.6/bin/mysql_config. 5.6.46 is new as of Monday, 10/14, and includes changes to allow compiling against OpenSSL 1.1.1. See https://dev.mysql.com/doc/relnotes/mysql/5.6/en/news-5-6-46.html. So it makes sense that they modified the link statements related to the SSL library.I don't yet know how to fix this, but I worked around it by reverting my Homebrew mysql@5.6 formula to the last version before the changes to install 5.6.46, and reinstalling, which gets you 5.6.43. This is not a great solution, but here's how I did it:
brew uninstall mysql@5.6 cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core git checkout f171f1c746db01c283aa137cb24248fbb8eb7a18 Formula/mysql@5.6.rb brew install mysql@5.6
5.6.43's version of /usr/local/opt/mysql@5.6/bin/mysql_config is different with respect to SSL lib linking. Instead of
-limported_openssl
it has-lssl
.
You have made my day.
This has been fixed in the Homebrew mysql@5.6 formula by https://github.com/Homebrew/homebrew-core/pull/46379.
mysql2 0.5.2 does not build on Mojave 10.14.6 (18G103), Ruby 2.6.3 via rbenv, mysql@5.6 via Hombrew
Error is during link step:
ld: library not found for -limported_openssl
bundle install
now fails atInstalling mysql2 0.5.2 with native extensions
.I have force reinstalled MySQL and OpenSSL, and bundler is configured w/ home-brew prefix for openssl when building
mysql2
:The full build log (
mkmf.log
):