I can't install the gem mysql2 with ruby 1.8.7

576 views
Skip to first unread message

Marc Maurer

unread,
Jul 16, 2013, 7:58:34 AM7/16/13
to rubyversi...@googlegroups.com
Hello,
My computer : i3 with Linux Mageia 3, ruby 1.9.3p429, MariaDB 5.5.28

$ rvm list

rvm rubies

   ree-1.8.7-2012.02 [ x86_64 ]
   ruby-1.8.7-p371 [ x86_64 ]
   ruby-1.9.3-p429 [ x86_64 ]
   ruby-2.0.0-p195 [ x86_64 ]

In my root home :

$ rvm info

system:

  system:
    uname:       "Linux erato.parnasse 3.8.13.4-desktop-1.mga3 #1 SMP Thu Jul 4 13:56:21 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux"
    system:      "redhat/3.
86.
64./x86_64"
    bash:        "/usr/bin/bash => GNU bash, version 4.2.37(2)-release (x86_64-mageia-linux-gnu)"
    zsh:         " => not installed"

  rvm:
    version:      "rvm 1.20.13 () by Wayne E. Seguin <waynee...@gmail.com>, Michal Papis <mpa...@gmail.com> [https://rvm.io/]"
    updated:      "1 month 11 days 40 minutes ago"

  homes:
    gem:          "not set"
    ruby:         "not set"

  binaries:
    ruby:         "/usr/bin/ruby"
    irb:          "/usr/bin/irb"
    gem:          "/usr/bin/gem"
    rake:         "/usr/bin/rake"

  environment:
    PATH:         "/usr/local/bin:/usr/bin:/usr/games:/usr/lib64/qt4/bin:/home/marc/.rvm/bin:/home/marc/bin"
    GEM_HOME:     ""
    GEM_PATH:     ""
    MY_RUBY_HOME: ""
    IRBRC:        ""
    RUBYOPT:      ""
    gemset:       ""
in my apps directory :

rvm info

ruby-1.8.7-p371@caieta:

  system:
    uname:       "Linux erato.parnasse 3.8.13.4-desktop-1.mga3 #1 SMP Thu Jul 4 13:56:21 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux"
    system:      "redhat/3.
86.
64./x86_64"
    bash:        "/usr/bin/bash => GNU bash, version 4.2.37(2)-release (x86_64-mageia-linux-gnu)"
    zsh:         " => not installed"

  rvm:
    version:      "rvm 1.20.13 () by Wayne E. Seguin <waynee...@gmail.com>, Michal Papis <mpa...@gmail.com> [https://rvm.io/]"
    updated:      "1 month 11 days 41 minutes 16 seconds ago"

  ruby:
    interpreter:  "ruby"
    version:      "1.8.7"
    date:         "2012-10-12"
    platform:     "x86_64-linux"
    patchlevel:   "2012-10-12 patchlevel 371"
    full_version: "ruby 1.8.7 (2012-10-12 patchlevel 371) [x86_64-linux]"

  homes:
    gem:          "/home/marc/.rvm/gems/ruby-1.8.7-p371@caieta"
    ruby:         "/home/marc/.rvm/rubies/ruby-1.8.7-p371"

  binaries:
    ruby:         "/home/marc/.rvm/rubies/ruby-1.8.7-p371/bin/ruby"
    irb:          "/home/marc/.rvm/rubies/ruby-1.8.7-p371/bin/irb"
    gem:          "/home/marc/.rvm/rubies/ruby-1.8.7-p371/bin/gem"
    rake:         "/home/marc/.rvm/gems/ruby-1.8.7-p371@caieta/bin/rake"

  environment:
    PATH:         "/home/marc/.rvm/gems/ruby-1.8.7-p371@caieta/bin:/home/marc/.rvm/gems/ruby-1.8.7-p371@global/bin:/home/marc/.rvm/rubies/ruby-1.8.7-p371/bin:/home/marc/.rvm/bin:/usr/local/bin:/usr/bin:/usr/games:/usr/lib64/qt4/bin:/home/marc/bin"
    GEM_HOME:     "/home/marc/.rvm/gems/ruby-1.8.7-p371@caieta"
    GEM_PATH:     "/home/marc/.rvm/gems/ruby-1.8.7-p371@caieta:/home/marc/.rvm/gems/ruby-1.8.7-p371@global"
    MY_RUBY_HOME: "/home/marc/.rvm/rubies/ruby-1.8.7-p371"
    IRBRC:        "/home/marc/.rvm/rubies/ruby-1.8.7-p371/.irbrc"
    RUBYOPT:      ""
    gemset:       "caieta"
When I use "bundle install" in the apps directory :

....
Installing mysql2 (0.3.11)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/home/marc/.rvm/rubies/ruby-1.8.7-p371/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... no
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing. please check your installation of mysql and try again.
-----
*** 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/marc/.rvm/rubies/ruby-1.8.7-p371/bin/ruby
--with-mysql-config
--without-mysql-config


Gem files will remain installed in /home/marc/.bundler/tmp/14198/gems/mysql2-0.3.11 for inspection.
Results logged to /home/marc/.bundler/tmp/14198/gems/mysql2-0.3.11/ext/mysql2/gem_make.out

An error occurred while installing mysql2 (0.3.11), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.11'` succeeds before bundling.
 
 But when I make "gem install mysql2", it's ok but when I make "gem list", I don't found mysql2
I don't undersant what is missing !

Marc Maurer

unread,
Jul 19, 2013, 5:32:18 AM7/19/13
to rubyversi...@googlegroups.com
I found many diffences between the installation of ruby 1.9.3 with rvm and the installation of ruby 1.8.7 with rvm :

in the directory $HOME/.rvm/rubies/ruby-1.8.7-p374 :

[marc@erato ruby-1.8.7-p374]$ ll
 total
24
 drwxrwxr
-x 2 marc marc 4096 juil. 18 11:14 bin/
 
-rw-rw-r-- 1 marc marc 4517 juil. 18 11:15 config
 drwxrwxr
-x 3 marc marc 4096 juil. 18 11:14 lib/
 
-rw-rw-r-- 1 marc marc 26 juil. 18 11:14 patches.list
 drwxrwxr
-x 3 marc marc 4096 juil. 18 11:14 share/

 and in the directory $HOME/.rvm/rubies/ruby-1.9.3-p448 :
[marc@erato ruby-1.9.3-p448]$ ll
 total
24
 drwxrwxr
-x 2 marc marc 4096 juil. 18 11:45 bin/
 
-rw-rw-r-- 1 marc marc 6687 juil. 18 11:45 config
 drwxrwxr
-x 3 marc marc 4096 juil. 18 11:44 include/
 drwxrwxr
-x 4 marc marc 4096 juil. 18 11:44 lib/
 drwxrwxr
-x 3 marc marc 4096 juil. 18 11:44 share/

I don't understand why it' different.

mpapis

unread,
Sep 13, 2013, 11:46:48 AM9/13/13
to rubyversi...@googlegroups.com
the directories do not have to be the same, they only have to contain bin/ruby - rest might vary between versions and implementations,

as for gems - make sure you always work in context of the same gemset - like: `rvm use 1.9.3` and `echo $GEM_HOME` has to point to the same directory.

Marc Maurer

unread,
Sep 18, 2013, 3:27:05 PM9/18/13
to rubyversi...@googlegroups.com
Hello,
Thanks for your answer !
I don't speak very well english !
When I use ruby 1.9.3 (after rvm 1.9.3), I can install the gem mysql2 (gem install mysql2). But when I use ruby 1.8.7 (after rvm 1.8.7 in an another directory), I can't install the gem mysql2 but I can install some other gem. I don't understand why !

mpapis

unread,
Oct 18, 2013, 5:44:43 PM10/18/13
to rubyversi...@googlegroups.com
it depends on the error, show it
Reply all
Reply to author
Forward
0 new messages