Mysql gem issue

(running OS X 10.5.5, MySQL 5, Rails 2.1, Ruby 1.8.7)

I do not understand why after running :


sudo gem update --system
Updating RubyGems
Nothing to update

sudo gem install rubygems-update
Successfully installed rubygems-update-1.3.1
1 gem installed

sudo gem install mysql – --with-mysql-config=/usr/local/mysql/bin/
mysql_config
Building native extensions. This could take a while…
Successfully installed mysql-2.7
1 gem installed

and restarted my rails app, I still have this warning…

DEPRECATION WARNING: You’re using the Ruby-based MySQL library that
ships with Rails. This library will be REMOVED FROM RAILS 2.2. Please
switch to the offical mysql gem: gem install mysql See
http://www.rubyonrails.org/deprecation for details. (called from
mysql_connection at /usr/local/lib/ruby/gems/1.8/gems/
activerecord-2.1.2/lib/active_record/connection_adapters/
mysql_adapter.rb:81)

what’s missing ?

everything seems to be into : /usr/local/lib/ruby

On 30 Oct 2008, at 10:13, Erwin wrote:

sudo gem install rubygems-update
Successfully installed rubygems-update-1.3.1
1 gem installed

sudo gem install mysql – --with-mysql-config=/usr/local/mysql/bin/
mysql_config
Building native extensions. This could take a while…
Successfully installed mysql-2.7
1 gem installed

What does
which gem
say?

Fred

MacErwin:lib yves$ which gem
/usr/local/bin/gem

irb(main):001:0> require ‘rubygems’
=> true

irb(main):002:0> require ‘mysql’
LoadError: dlsym(0x1458c70, Init_mysql): symbol not found - /Users/
yves/.gem/ruby/1.8/gems/mysql-2.7/lib/mysql.bundle
from /Users/yves/.gem/ruby/1.8/gems/mysql-2.7/lib/mysql.bundle
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
36:in `require’
from (irb):2

On 30 Oct 2008, at 11:03, Erwin wrote:

from /Users/yves/.gem/ruby/1.8/gems/mysql-2.7/lib/mysql.bundle
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
36:in `require’
from (irb):2

Has it done something like compile it for the wrong architecture ?
(what does lipo -detailed_info say for mysql.bundle ?)

Fred

I also run :

MacErwin:mysql-2.7 yves$ lipo -detailed_info /usr/local/mysql/lib/
libmysqlclient.dylib
input file /usr/local/mysql/lib/libmysqlclient.dylib is not a fat file
Non-fat file: /usr/local/mysql/lib/libmysqlclient.dylib is
architecture: x86_64

seems wrong ???

cd /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7
MacErwin:mysql-2.7 yves$ sudo ruby extconf.rb install mysql – --with-
mysql-dir=/usr/local/mysql/
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… no
checking for mysql_query() in -lmysqlclient… no
MacErwin:mysql-2.7 yves$ sudo make
gcc -I. -I. -I/usr/local/lib/ruby/1.8/i686-darwin9.4.0 -I. -
DHAVE_MYSQL_SSL_SET -DHAVE_MYSQL_H -D_XOPEN_SOURCE -
D_DARWIN_C_SOURCE -I/usr/local/mysql/include -Os -arch x86_64 -fno-
common -fno-common -g -O2 -fno-common -pipe -fno-common -c mysql.c
cc -dynamic -bundle -undefined suppress -flat_namespace -o
mysql.bundle mysql.o -L. -L/usr/local/lib -L. -lruby -L/usr/local/
mysql/lib -lmysqlclient -lz -lm -lpthread -ldl -lobjc
ld: warning in mysql.o, file is not of required architecture
ld: warning in /usr/local/mysql/lib/libmysqlclient.dylib, file is not
of required architecture
MacErwin:mysql-2.7 yves$ sudo make install
/usr/bin/install -c -m 0755 mysql.bundle /usr/local/lib/ruby/gems/1.8/
gems/mysql-2.7/lib

it’s pure afghan song for me …

MacErwin:mysql-2.7 yves$ lipo -detailed_info /usr/local/lib/ruby/gems/
1.8/gems/mysql-2.7/lib/mysql.bundle
input file /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/
mysql.bundle is not a fat file
Non-fat file: /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/
mysql.bundle is architecture: i386

I am running on a MacBook… Intel architecture … i guess ;-))

On 30 Oct 2008, at 11:41, Erwin wrote:

seems wrong ???

That is wrong. Looks like you downloaded the x86_64 version of mysql
(which is fine - there’s no issue with your server being that), but
that currently means you only have the x86-64 libs. you then end up
with a gem that can only run against those libraries. Your ruby
executable is probably an i386 executable, so it can’t load the gem
compiled for x86-64

Fred

Thanks… so what should I do now … ?

thanks… I’ll do it

Easiest thing is probably to just reinstall the x86 version of mysql.
You may need to recompile the gem after that.

Sent from my iPhone

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs