I have tried to install gem install mysql
on wsl2
but I got the error.
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.8.7-head/bin/ruby extconf.rb
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
Gem files will remain installed in /usr/local/rvm/gems/ruby-1.8.7-head/gems/mysql-2.9.1 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.8.7-head/gems/mysql-2.9.1/ext/mysql_api/gem_make.out
previously I tried to these answers listed here, and here, but none worked for me!. I also installed libmysqlclient-dev mysql-server
but it seems this is a different problem.
EDIT:
well, someone suggested to reinstall libmysqlclient-dev
and then did apt-get install libmysqlclient-dev
and then I got another error:
Building native extensions. This could take a while...
.......
make
gcc -I. -I. -I/usr/local/rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/x86_64-linux -I. -DHAVE_MYSQL_SSL_SET -DHAVE_RB_STR_SET_LEN -DHAVE_RB_THREAD_START_TIMER -DHAVE_MYSQL_H -I/usr/include/mysql -fPIC -O2 -fno-tree-dce -fno-optimize-sibling-calls -fPIC -c mysql.c
mysql.c:79:2: error: unknown type name ‘my_bool’
79 | my_bool *is_null;
| ^~~~~~~
mysql.c: In function ‘options’:
mysql.c:361:5: error: unknown type name ‘my_bool’; did you mean ‘bool’?
361 | my_bool b;
| ^~~~~~~
| bool
..... ^~~~~~~~~~~~~~~~~~~~~~~~~~
| ^
error_const.h:2723:27: error: ‘ER_XPLUGIN_IP’ undeclared (first use in this function); did you mean ‘ER_PLUGIN_OOM’?
2723 | rb_define_mysql_const(ER_XPLUGIN_IP);
| ^~~~~~~~~~~~~
Gem files will remain installed in /usr/local/rvm/gems/ruby-1.8.7-head/gems/mysql-2.9.1 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.8.7-head/gems/mysql-2.9.1/ext/mysql_api/gem_make.out