I got the error when trying to install mysql2
gem on an Ubuntu 22.04 server.
# gem install mysql2
:
/usr/lib/ruby/3.0.0/mkmf.rb:471:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
I was not sure what is "development tools". So tried to install the following packages using apt-get
command.
ruby-dev libmysqlclient-dev libcurl4-openssl-dev libssl-dev pkg-config
But the error message had not changed. Finally, after I installed apache2-dev
, it worked...!
apt-get -y install apache2-dev