Trying to install mysql2 gem with ruby2.0.0-p247 on Cent OS 6.3.
This all works fine on ruby-1.9.3-p324 but using RVM to install ruby2. My test code is as follows
require "mysql2"
puts "test"
Running ruby against the above code, I get the error:
/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/custom_require.rb:36:in
require': cannot load such file -- mysql2/mysql2 (LoadError) from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/custom_require.rb:36:inrequire' from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/mysql2-0.3.11/lib/mysql2.rb:9:in<top (required)>' from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/custom_require.rb:60:inrequire' from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/custom_require.rb:60:inrescue in require' from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/custom_require.rb:35:inrequire' from mysqltest.rb:1:in `'
The bundle install / gem install mysql2 works fine, it's just trying to use the gem. I've googled this and the common answer is that the libmysql-devel package etc are not installed, this is not the case as it's working fine under ruby-1.9.3.
The files are on disk
[git@rubyland-provisioner mysql2-0.3.11]$ ls lib/mysql2 client.rb em.rb error.rb result.rb version.rb [git@rubyland-provisioner mysql2-0.3.11]$ ls ext/mysql2 client.c client.o Makefile mysql2_ext.c mysql2_ext.o result.c result.o client.h extconf.rb mkmf.log mysql2_ext.h mysql2.so result.h wait_for_single_fd.h If I manually copy mysql2.so (which is built by the gem install, I've checked the timestamps) to the lib/mysql2 directory, everything works as expected.
I'm fairly new to Ruby; what am I missing? Why is the gem install not copying this file to the correct location.
Thanks
Andrew