how to install 'mysql2' gem ?

i have opensuse 13.1 … getting error while installing mysql2 gem

output:

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

/home/akash/.rvm/rubies/ruby-2.0.0-p451/bin/ruby 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()… yes
checking for rb_wait_for_single_fd()… yes
checking for rb_hash_dup()… yes
checking for rb_intern3()… yes

Using mysql_config at /usr/bin/mysql_config

checking for mysql.h… yes
checking for errmsg.h… yes
checking for mysqld_error.h… yes

Setting libpath to /usr/lib64

creating Makefile

make “DESTDIR=” clean

make “DESTDIR=”
compiling infile.c
compiling client.c
compiling result.c
compiling mysql2_ext.c
linking shared-object mysql2/mysql2.so
/usr/lib64/gcc/x86_64-suse-linux/4.8/…/…/…/…/x86_64-suse-linux/bin/ld: cannot find -lmysqlclient
collect2: error: ld returned 1 exit status
make: *** [mysql2.so] Error 1

make failed, exit code 2

Gem files will remain installed in /home/akash/.rvm/gems/ruby-2.0.0-p451/gems/mysql2-0.3.15 for inspection.
Results logged to /home/akash/.rvm/gems/ruby-2.0.0-p451/extensions/x86_64-linux/2.0.0/mysql2-0.3.15/gem_make.out
An error occurred while installing mysql2 (0.3.15), and Bundler cannot continue.
Make sure that gem install mysql2 -v '0.3.15' succeeds before bundling.

solution on other linux is

sudo apt-get install mysql-client libmysqlclient-dev

but don’t know how to install these packages on opensuse 13.1

I have no real knowledge about the particular action you are trying to do, but I understand that you do not even know how to manage software on openSUSE.

You use either the GUI: YaST > Software > Software Management, or the CLI with zypper

man zypper

BTW, next time you try to post computer text, please copy/paste it from the terminal in between CODE tags in the post. You get the CODE tags by clicking on the # button in the tool bar ofthe post editor.

sudo zypper in libmysqlclient-devel

Or use YaST->Software Management.

still getting error !


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

    /home/akash/.rvm/rubies/ruby-2.0.0-p451/bin/ruby 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()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
-----
Using mysql_config at /usr/bin/mysql_config
-----
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
-----
Setting libpath to /usr/lib64
-----
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling infile.c
compiling client.c
compiling result.c
compiling mysql2_ext.c
linking shared-object mysql2/mysql2.so
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: cannot find -lmysqlclient
collect2: error: ld returned 1 exit status
make: *** [mysql2.so] Error 1

make failed, exit code 2

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

I’m using MySQL server

https://www.dropbox.com/s/eq3rltl9b6ims0y/snapshot1.png

https://www.dropbox.com/s/eq3rltl9b6ims0y/snapshot1.png

You haven’t explained exactly what it is that you are trying to achieve.
If you copied the commands you used into the CODE block, instead of just some output, we could see what you were doing.
You should not expect others to be able to access random file-sharing sites. This forum has its own http://paste.opensuse.org/.

I am guessing that you want to use Ruby Gems, and for some reason you are trying to compile a package designed for another distribution. OpenSUSE/SUSE has an excellent package manager, and a very large software library/repositories. That has always been on of its main “selling points”.

Ruby mysql2 is different from MariaDB/MySQL.

Open YaST > Software Management (either from the GUI or in a terminal). Search for “rubygem”. You will discover a selection of “gems”, incuding “rubygem-mysql2”, together with documentation, and a test suite. Select the packages you want, and “Accept”.