mysql2: mysql2 does not build with mysql-client 8.3.0
Compiling mysql2 with mysql-client 8.3.0 fails:
❯ make
compiling client.c
In file included from client.c:15:
./mysql_enc_name_to_ruby.h:43:1: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
mysql2_mysql_enc_name_to_rb_hash (str, len)
^
./mysql_enc_name_to_ruby.h:86:1: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
mysql2_mysql_enc_name_to_rb (str, len)
^
client.c:1438:3: error: call to undeclared function 'mysql_ssl_set'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
mysql_ssl_set(wrapper->client,
^
client.c:1438:3: note: did you mean 'mysql_close'?
/opt/homebrew/opt/mysql-client/include/mysql/mysql.h:797:14: note: 'mysql_close' declared here
void STDCALL mysql_close(MYSQL *sock);
^
2 warnings and 1 error generated.
make: *** [client.o] Error 1
mysql_ssl_set was deprecated on 8.2 and removed on 8.3.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 13
- Comments: 22 (5 by maintainers)
Commits related to this issue
- fix: bump mysql2 version build failure with mysql-client 8.3.0 https://github.com/brianmario/mysql2/issues/1346 — committed to cloudnativedaysjp/dreamkast by takaishi 3 years ago
- Bump mysql2 gem https: //github.com/brianmario/mysql2/issues/1346 Co-authored-by: Szymon Fiedler <szymon.fiedler@gmail.com> — committed to RailsEventStore/rails_event_store by lukaszreszke 3 years ago
- Bump mysql2 to fix build error with mysql-client 8.3 https://github.com/brianmario/mysql2/issues/1346 https://github.com/brianmario/mysql2/releases/tag/0.5.6 — committed to CodingItWrong/rails by CodingItWrong 3 years ago
- mysql 8.3.0だとmysql2のgemが0.5.6移行ではないと使えない。 gemのアップデート回避のためにmysqlのバージョンを固定 https://github.com/brianmario/mysql2/issues/1346 — committed to mpg-taichi-sato/dotfiles by mpg-taichi-sato 3 years ago
- Bump mysql2 to fix build error with mysql-client 8.3 https://github.com/brianmario/mysql2/issues/1346 https://github.com/brianmario/mysql2/releases/tag/0.5.6 — committed to fractaledmind/rails by CodingItWrong 3 years ago
- Bump mysql2 to fix build error with mysql-client 8.3 https://github.com/brianmario/mysql2/issues/1346 https://github.com/brianmario/mysql2/releases/tag/0.5.6 — committed to xjunior/rails by CodingItWrong 3 years ago
- Bump mysql2 to fix build error with mysql-client 8.3 https://github.com/brianmario/mysql2/issues/1346 https://github.com/brianmario/mysql2/releases/tag/0.5.6 — committed to Set2005/fix-association-initialize-order by CodingItWrong 3 years ago
No need to downgrade or uninstall, brew handles various versions of same package in parallel. You can try:
brew install mysql-client@8.0bundle config --local build.mysql2 -- --with-mysql-dir=$(brew --prefix mysql-client@8.0)bundle installDepending on you environment you can get other errors, if so, let me know.
@xinlangzi I had the same issue and I solved it by doing the following:
brew uninstall mysqlto completely uninstall mysql from my Macbrew install mysql-client@8.0to only install the client needed by the gemgem install mysql2workedI then connected my Rails app to a Mysql 8.2 instance via Docker.
Hope this can help someone 😃
If you’re currently having issues on a mac and homebrew, this is what you should do to get your environment back:
1) Uninstall current installed version of mysql-client:
2) Download 8.2 formulae:
Or with curl:
3) Install 8.2:
For anyone who has the server running on the same system they are trying to install the gem on…
I was able to get around uninstalling or downgrading my MySQL server by installing the mysql-client at version 8.2 using the info from @xjunior above and then simply calling the following:
Hopefully we get an official release to fix this soon though, however with a year between releases I’m not hopeful it’ll be fast.
For homebrew users, there’s also a pinned formula available at 8.0:
@xinlangzi Your log says you still have 8.3.0 installed. It is possible you have it installed with the
mysqlhomebrew formula instead of themysql-clientformula described in the other workaround. You can find out by runningbrew list | grep mysqlIf so you can tryas a workaround until ~either mysql 8.3 or the gem is fixed~ you get the code from #1347
@xjunior
I follow your idea to install mysql-client 8.2. But it did not help me out:
Did I miss other steps?
@lipedjow Thanks, it works for me!
@yboulkaid 8.0 still didn’t do it for me, I don’t quite remember why, but if it works for anyone, it should be better than downloading that formulae 😃
@Uaitt thank you this worked for me 🙏
Issue was fixed already, update mysql2 gem to new version (0.5.6+) or check my comment above for alternative solution.
You can use
brew pin mysql-clientto prevent Homebrew from upgrademysql-client.However, I think installing
mysql-client@8.0alongside and point your software/library to use that (as @lipedjow suggested) is the correct workaround, as the versioned keg won’t get upgraded to the broken version.@jairovm there is a an official gem to adapt it to older versions of rails as well. This is also something we’re willing to try.
https://github.com/trilogy-libraries/activerecord-trilogy-adapter
Ultimately, the fix shouldn’t be to downgrade, the maintainers of this gem should fix their code.