Tag: snow leopard

Mongrel and Snow Leopard

So the ongoing saga of upgrade woes continues… You would think that “sudo gem update” should take care of upgrading all my old gems in Snow Leopard with all its 64-bit glory…

Nope.

It started when “ruby script/server” started WebBrick instead of Mongrel. That’s odd, but I figure I could work around it by just running “sudo gem install mongrel” again.

Unfortunately, that didn’t do the trick. So I tried summoning Mongrel directly:

mongrel_rails start

and I got this in return:

/Users/…/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/../lib/http11.bundle: dlopen(/Users/…/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/../lib/http11.bundle, 9): no suitable image found.  Did find: (LoadError)

/Users/…/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/../lib/http11.bundle: no matching architecture in universal wrapper – /Users/…/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/../lib/http11.bundle

from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require’

Luckily, Google saves the day and I found this: http://stackoverflow.com/questions/1350486/ruby-on-rails-staring-mongrel-server

I ran the following commands and it all worked as advertised. Phew, that one was easy.

sudo gem uninstall mongrel

sudo gem uninstall fastthread

sudo gem install mongrel

/Users/yowhan/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/../lib/http11.bundle: dlopen(/Users/yowhan/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/../lib/http11.bundle, 9): no suitable image found.  Did find: (LoadError)
/Users/yowhan/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/../lib/http11.bundle: no matching architecture in universal wrapper – /Users/yowhan/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/../lib/http11.bundle
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require’
from /Users/yowhan/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:12
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_requir

MySQL, Rails and Snow Leopard

Ruby on Rails

After much hesitation, I took the dive and upgraded to Snow Leopard today. I ran into some ruby and MySQL errors, but other early adopters in our dev team had already prepared me for that. However, I would soon run into an issue that got me stumped. It turned out that I had forgotten something really simple.

So I had reinstall MySQL 64-bit and updated all my gems, but a particular mysql gem would refuse to reinstall.

There was this helpful document that several devs on my team sent me: http://stackoverflow.com/questions/991708/rails-mysql-and-snow-leopard

Unfortunately, I would get the following error even executing the recommended solution:

yowhan:~ $ sudo env ARCHFLAGS=”-arch x86_64″ gem install -V  mysql — –with-mysql-config=/usr/local/mysql/bin/mysql_config
GET 200 OK: http://gems.rubyforge.org/latest_specs.4.8.gz
GET 200 OK: http://gems.github.com/latest_specs.4.8.gz
GET 200 OK: http://gems.rubyforge.org/quick/Marshal.4.8/mysql-2.8.1.gemspec.rz
Installing gem mysql-2.8.1
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/COPYING
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/COPYING.ja
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/History.txt
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/Manifest.txt
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/README.txt
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/Rakefile
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/extconf.rb
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/mysql.c
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/extra/README.html
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/extra/README_ja.html
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/extra/tommy.css
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/lib/mysql.rb
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/tasks/gem.rake
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/tasks/native.rake
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/tasks/vendor_mysql.rake
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/test/test_mysql.rb
Building native extensions.  This could take a while…
ERROR:  Error installing mysql:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
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
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=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
–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
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.8.1 for inspection.

Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out

sudo env ARCHFLAGS=”-arch x86_64″ gem install -V  mysql — –with-mysql-config=/usr/local/mysql/bin/mysql_config

GET 200 OK: http://gems.rubyforge.org/latest_specs.4.8.gz

GET 200 OK: http://gems.github.com/latest_specs.4.8.gz

GET 200 OK: http://gems.rubyforge.org/quick/Marshal.4.8/mysql-2.8.1.gemspec.rz

Installing gem mysql-2.8.1

/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/test/test_mysql.rb

Building native extensions.  This could take a while…

ERROR:  Error installing mysql:

ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb

*** 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.

Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.8.1 for inspection.

Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out

After several frustrating moments of poking around, a helpful fellow developer pointed out that “mysql” was not in my path. Duh!

I guess I just committed a newbie linux mistake. A quick update to .profile to include “/usr/local/mysql/bin” later, and the above command works perfectly now!

Here’s what I added to my .profile:

#Add mysql to path

export PATH=/usr/local/mysql/bin:$PATH

Hopefully that’s the last of my upgrade issues. :)


Copyright © 1996-2010 MSKYNET BLOG. All rights reserved.
iDream theme by Templates Next | Powered by WordPress