-2

In linux mint 15 when i run bundle install after installing sum gem an error occurs.

Using mono_logger 1.1.0

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/home/jazib/.rvm/rubies/ruby-1.9.3-p547/bin/ruby extconf.rb 
checking for ruby/thread.h... no
checking for rb_thread_blocking_region()... yes
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/jazib/.rvm/rubies/ruby-1.9.3-p547/bin/ruby
    --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

extconf failed, exit code 1

Gem files will remain installed in /home/jazib/.rvm/gems/ruby-1.9.3-p547/gems/mysql2-0.3.14 for inspection.
Results logged to /home/jazib/.rvm/gems/ruby-1.9.3-p547/extensions/x86-linux/1.9.1/mysql2-0.3.14/gem_make.out
An error occurred while installing mysql2 (0.3.14), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.14'` succeeds before bundling.

I try alot to solve this error but after every try same error occurs. Guide me how to solve this??

Todd A. Jacobs
  • 81,402
  • 15
  • 141
  • 199
Jazib Bashir
  • 493
  • 5
  • 19
  • Look in /home/jazib/.rvm/gems/ruby-1.9.3-p547/extensions/x86-linux/1.9.1/mysql2-0.3.14/gem_make.out - in this file will be more specific error. – phuk Aug 12 '14 at 13:10
  • possible duplicate of [Error installing mysql2: Failed to build gem native extension](http://stackoverflow.com/questions/3608287/error-installing-mysql2-failed-to-build-gem-native-extension) – Holger Just Aug 13 '14 at 08:31
  • Exactly duplicate question but answer is different Kindly see my answer. The answer of link which you provide is not work on me. – Jazib Bashir Aug 13 '14 at 08:54

3 Answers3

1

Try to install mysql libraries:

sudo apt-get install libmysqlclient-dev 
phuk
  • 1,098
  • 1
  • 10
  • 15
  • when i run this command following error generate: `Err http://archive.ubuntu.com/ubuntu/ raring-updates/main mysql-common all 5.5.34-0ubuntu0.13.04.1 404 Not Found [IP: 91.189.88.149 80] ` – Jazib Bashir Aug 13 '14 at 07:21
  • `Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.5/mysql-common_5.5.34-0ubuntu0.13.04.1_all.deb 404 Not Found [IP: 91.189.88.149 80] Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.5/libmysqlclient18_5.5.34-0ubuntu0.13.04.1_i386.deb 404 Not Found [IP: 91.189.88.149 80] ` – Jazib Bashir Aug 13 '14 at 07:22
1

You need to install the libraries which the gems look for while installtion. Checkout the last line gem install mysql2 -v '0.3.14'. This the gem which is looking to libraries. When to look above, it clearly says

   checking for mysql_query() in -lmysqlclient... no
   *** extconf.rb failed ***

So you need to install this library. Install using

   sudo apt-get install libmysqlclient-dev 

This is how you need to debug for any bundle install failures.

Bijendra
  • 9,467
  • 8
  • 39
  • 66
  • when i run this command following error generate: `Err http://archive.ubuntu.com/ubuntu/ raring-updates/main mysql-common all 5.5.34-0ubuntu0.13.04.1 404 Not Found [IP: 91.189.88.149 80]` – Jazib Bashir Aug 13 '14 at 07:21
  • `Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.5/mysql-common_5.5.34-0ubuntu0.13.04.1_all.deb 404 Not Found [IP: 91.189.88.149 80] Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.5/libmysqlclient18_5.5.34-0ubuntu0.13.04.1_i386.deb 404 Not Found [IP: 91.189.88.149 80] ` – Jazib Bashir Aug 13 '14 at 07:23
0

Problem solved. Run this command below on your server and it will replace all of the archive.ubuntu.com and security.ubuntu.com package repository URLs with old-releases.ubuntu.com

sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

For Linux Mint, run this command as well:

sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list.d/official-package-repositories.list

Now update apt-get sources:

sudo apt-get update
Jazib Bashir
  • 493
  • 5
  • 19