Difficulty with gem install on osX

New to the RoR world view and just learning about gems - I've hit a
snag installing two separate gems that I can't seem to get past with
one of them.

My environment is osX 10.5.4 on a ppc processor. I have gcc 4.1 (and
related tools) installed as well as mysql-5.0.51a. ruby --version =>
ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0] and rails
--version => Rails 2.1.0.

My problem has been with the RMagick and MySQL gems, and is related to
these gems attempting to build for both the ppc and 386 architectures
via --arch options for both appearing in the gcc command that is
generated during the install process.

I was able to step around the problem with RMagick by editing the
options out of the generated makefile, doing the make directly. Not
too satisfying but it did build, test, and install. No such luck with
the MySQL gem however.

Any thoughts or suggestions? Where / how is the makefile generated?
Who decided that I wanted both architectures build for a ppc only
environment? Is it even possible to build a foreign arch without a
cross compiler?

thanks in advance
Rick

ruby generates the makefile (via extconf.rb, ie mkmf). The problem
you've got is that since you've got a universal build of ruby it's
trying to build universal extensions.
See also http://developer.apple.com/releasenotes/OpenSource/PerlExtensionsRelNotes/index.html
(i know it says perl extensions, but it applies to ruby too)
Surprise, you've got a cross compiler: a ppc mac can build i386
binaries and vice-versa.

Fred

So here's my first attempt, using ksh:

export ARCHFLAGS='-arch ppc'
sudo gem install mysql

it's going to cook for a while so...

Yes, I know that gcc can be built as a cross compiler but I'm not
particularly interested in dedicating time/space to building for a
system I don't have.

cooking's done, more burned toast.

same -arch ppc -arch i386 failure that looks like this:

"gcc -o conftest -I. -I/System/Library/Frameworks/Ruby.framework/
Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.
0 -I. -I/usr/local/include -arch ppc -arch i386 -Os -pipe -fno-common
conftest.c -L"." -L"/System/Library/Frame
works/Ruby.framework/Versions/1.8/usr/lib" -L"/usr/local/lib" -L. -
arch ppc -arch i386 -lruby -lmysqlclient
-lpthread -ldl -lm "
cc1: error: unrecognized command line option "-arch"
cc1: error: unrecognized command line option "-arch"
cc1: error: unrecognized command line option "-arch"
cc1: error: unrecognized command line option "-arch"

life would be much simpler if we had all continued to follow Dennis
Ritchie et.al. off to Plan9, eh?

so here's what worked...

sudo env ARCHFLAGS='' gem install mysql

thanks for your help

Rick

so here's what worked...

sudo env ARCHFLAGS='' gem install mysql

thanks for your help

Yup, that's important as sudo cleans up the environment before
executing the command you've asked so your ARCHFLAGS settings get
ignored

Fred