Failed to insert Gem mysql in Linux Manjaro

Asked

Viewed 177 times

1

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

I currently installed the distro Manjaro and installed ruby and Rails and I want to run my project created on Ubuntu, but I am facing a problem with Gem mysql2.

When trying to startar the application "Rails" the following error is shown:

Could not find Proper version of railties (4.2.1) in any of the sources Run bundle install to install Missing Gems.

When executing 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 Gem is configured as follows: 'mysql2', '~> 0.3.18'

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

2 answers

0

Hello you need to install native build libraries from MySQL

sudo apt-get install libmysqlclient-dev

If you have not installed, install also the build-essential

sudo apt-get install build-essential

And then yes, install the MySQL

gem install mysql2
  • 1

    Hello, Manjaro does not have the apt-get command. On the weekend when I am at home I will look for the equivalent command for Manjaro . Thanks for the tip.

  • @Wagnerrodrigues worked out well?

  • 1

    I didn’t even have time to look over the weekend. Today I searched and did not find the equivalent commands for Manjaro, but when searching for mysql in Pacman package manager I found the libmariadbclient package and installed it. After that I ran Bundle install and it worked. Thanks for the help.

  • The answer does not answer the question.

0

In Manjaro and any other Archlinux-based distribution, as the @Wagnerrodrigues comment, you need to install the package libmariadbclient with the command:

pacman -S libmariadbclient

Once done, return to the normal Gem mysql2 installation and it will work.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.