Failed to install gem mysql in Linux Manjaro

1

It's been a while since I started playing with Ruby on Rails on Ubuntu and created some projects.

Currently I installed the distro Manjaro and I installed the ruby and rails and I want to run my project created in Ubuntu, however I am facing a problem with gem mysql2.

When attempting to start the application "rails s" the following error is displayed:

  

Could not find proper version of railways (4.2.1) in any of the   sources Run bundle install to install missing gems.

When you run the bundle install command, the following error occurs:

Building native extensions.  This could take a while...
ERROR:  Error installing mysql2:
 ERROR: Failed to build gem native extension.
    current directory: /home/wagner/.rvm/gems/ruby-2.3.1/gems/mysql2-0.3.18>>/ext/mysql2
/home/wagner/.rvm/rubies/ruby-2.3.1/bin/ruby -r >./siteconf20160831-4570-57p5rs.rb extconf.rb
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
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
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You >may
need configuration options.
Provided configuration options:
 --with-opt-dir
 --without-opt-dir
 --with-opt-include
 --without-opt-include=${opt-dir}/include
 --with-opt-lib
 --without-opt-lib=${opt-dir}/lib
 --with-make-prog
 --without-make-prog
 --srcdir=.
 --curdir
 --ruby=/home/wagner/.rvm/rubies/ruby-2.3.1/bin/$(RUBY_BASE_NAME)
 --with-mysql-dir
 --without-mysql-dir
 --with-mysql-include
 --without-mysql-include=${mysql-dir}/include
 --with-mysql-lib
 --without-mysql-lib=${mysql-dir}/lib
 --with-mysql-config
 --without-mysql-config
 --with-mysql-dir
 --without-mysql-dir
 --with-mysql-include
 --without-mysql-include=${mysql-dir}/include
 --with-mysql-lib
 --without-mysql-lib=${mysql-dir}/lib
 --with-mysqlclientlib
 --without-mysqlclientlib
 --with-mlib
 --without-mlib
 --with-mysqlclientlib
 --without-mysqlclientlib
 --with-zlib
 --without-zlib
 --with-mysqlclientlib
 --without-mysqlclientlib
 --with-socketlib
 --without-socketlib
 --with-mysqlclientlib
 --without-mysqlclientlib
 --with-nsllib
 --without-nsllib
 --with-mysqlclientlib
 --without-mysqlclientlib
 --with-mygcclib
 --without-mygcclib
 --with-mysqlclientlib
 --without-mysqlclientlib
To see why this extension failed to compile, please check the mkmf.log >which can be found here:
  /home/wagner/.rvm/gems/ruby-2.3.1/extensions/x86_64-linux/2.3.0>/mysql2-0.3.18/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/wagner/.rvm/gems/ruby-2.3.1/gems/mysql2-0.3.18 for inspection.
Results logged to /home/wagner/.rvm/gems/ruby-2.3.1/extensions/x86_64->linux/2.3.0/mysql2-0.3.18/gem_make.out

In my gemfile the gem is set as gem 'mysql2', '~ > 0.3.18 '

Does anyone have any idea what might be wrong? Thank you very much for your attention.

    
asked by anonymous 31.08.2016 / 16:59

1 answer

1

Hello, you need to install the native compilation libraries of MySQL

sudo apt-get install libmysqlclient-dev

If you have not installed, also install build-essential

sudo apt-get install build-essential

And yes, install the gem of MySQL

gem install mysql2
    
01.09.2016 / 15:03