[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Building Ruby extensions on OS X Tiger

Richard Kilmer

4/30/2005 12:35:00 AM

Tony Arnold posted this on the Rails wiki:
_____

Mac OS X Tiger ships with Ruby 1.8.2 pre-installed. However,
rbconfig.rb needs to be edited if you want to build any gems. (from
Rich...not gems, native extensions)

Edit rbconfig.rb

sudo pico -w /usr/lib/ruby/1.8/powerpc-darwin8.0/rbconfig.rb
Now remove -arch i386 from the CFLAGS and LDFLAGS variables.

You will also need to change:
CONFIG["LIBRUBYARG_STATIC"] = "-l$(RUBY_SO_NAME)-static"
to:
CONFIG["LIBRUBYARG_STATIC"] = ""
_____


NOTE: This is only important if you are building native extensions
(not pure ruby ones)...but it does suck when you run into it...so its
worth fixing.

Wiki link: http://wiki.rubyonrails.com/rails/show/HowtoInstall...

Chad is working on a gem that you can install which fixes this too.

-rich


9 Answers

Chad Fowler

4/30/2005 12:52:00 AM

0

On 4/29/05, Richard Kilmer <rich@infoether.com> wrote:
> Tony Arnold posted this on the Rails wiki:
> _____
>
> Mac OS X Tiger ships with Ruby 1.8.2 pre-installed. However,
> rbconfig.rb needs to be edited if you want to build any gems. (from
> Rich...not gems, native extensions)
>
> Edit rbconfig.rb
>
> sudo pico -w /usr/lib/ruby/1.8/powerpc-darwin8.0/rbconfig.rb
> Now remove -arch i386 from the CFLAGS and LDFLAGS variables.
>
> You will also need to change:
> CONFIG["LIBRUBYARG_STATIC"] = "-l$(RUBY_SO_NAME)-static"
> to:
> CONFIG["LIBRUBYARG_STATIC"] = ""
> _____
>
> NOTE: This is only important if you are building native extensions
> (not pure ruby ones)...but it does suck when you run into it...so its
> worth fixing.
>
> Wiki link: http://wiki.rubyonrails.com/rails/show/HowtoInstall...
>
> Chad is working on a gem that you can install which fixes this too.
>
> -rich
>
>

sudo gem install fixrbconfig
sudo fixrbconfig

--

Chad Fowler
http://chad...
http://rubyc...
http://ruby...
http://rubygems.rub... (over 300,000 gems served!)



ptkwt

4/30/2005 1:00:00 AM

0

In article <a2347a0405042917523d7e18c2@mail.gmail.com>,
Chad Fowler <chadfowler@gmail.com> wrote:
>On 4/29/05, Richard Kilmer <rich@infoether.com> wrote:
>> Tony Arnold posted this on the Rails wiki:
>> _____
>>
>> Mac OS X Tiger ships with Ruby 1.8.2 pre-installed. However,
>> rbconfig.rb needs to be edited if you want to build any gems. (from
>> Rich...not gems, native extensions)
>>
>> Edit rbconfig.rb
>>
>> sudo pico -w /usr/lib/ruby/1.8/powerpc-darwin8.0/rbconfig.rb
>> Now remove -arch i386 from the CFLAGS and LDFLAGS variables.
>>
>> You will also need to change:
>> CONFIG["LIBRUBYARG_STATIC"] = "-l$(RUBY_SO_NAME)-static"
>> to:
>> CONFIG["LIBRUBYARG_STATIC"] = ""
>> _____
>>
>> NOTE: This is only important if you are building native extensions
>> (not pure ruby ones)...but it does suck when you run into it...so its
>> worth fixing.
>>
>> Wiki link: http://wiki.rubyonrails.com/rails/show/HowtoInstall...
>>
>> Chad is working on a gem that you can install which fixes this too.
>>
>> -rich
>>
>>
>
>sudo gem install fixrbconfig
>sudo fixrbconfig
>

You are indeed on the cutting edge ;-)

Phil

Jim Freeze

4/30/2005 3:56:00 PM

0

* Chad Fowler <chadfowler@gmail.com> [2005-04-30 09:52:26 +0900]:

> On 4/29/05, Richard Kilmer <rich@infoether.com> wrote:

[snipped patch instructions]

> sudo gem install fixrbconfig
> sudo fixrbconfig

You know, it's this kind of tenderfoot gem file that takes
the machismo out of hacking a few core ruby files.

--
Jim Freeze
Code Red. Code Ruby


nobu.nokada

5/1/2005 12:31:00 AM

0

Hi,

At Sat, 30 Apr 2005 09:35:22 +0900,
Richard Kilmer wrote in [ruby-talk:140540]:
> Mac OS X Tiger ships with Ruby 1.8.2 pre-installed. However,
> rbconfig.rb needs to be edited if you want to build any gems. (from
> Rich...not gems, native extensions)
>
> Edit rbconfig.rb
>
> sudo pico -w /usr/lib/ruby/1.8/powerpc-darwin8.0/rbconfig.rb
> Now remove -arch i386 from the CFLAGS and LDFLAGS variables.
>
> You will also need to change:
> CONFIG["LIBRUBYARG_STATIC"] = "-l$(RUBY_SO_NAME)-static"
> to:
> CONFIG["LIBRUBYARG_STATIC"] = ""
> _____

ARCH_FLAG should be "-arch ppc" on darwin. As what is it
defined, and RUBY_SO_NAME?

--
Nobu Nakada


Chad Fowler

5/1/2005 2:09:00 AM

0

On 4/30/05, nobu.nokada@softhome.net <nobu.nokada@softhome.net> wrote:
> Hi,
>
> At Sat, 30 Apr 2005 09:35:22 +0900,
> Richard Kilmer wrote in [ruby-talk:140540]:
> > Mac OS X Tiger ships with Ruby 1.8.2 pre-installed. However,
> > rbconfig.rb needs to be edited if you want to build any gems. (from
> > Rich...not gems, native extensions)
> >
> > Edit rbconfig.rb
> >
> > sudo pico -w /usr/lib/ruby/1.8/powerpc-darwin8.0/rbconfig.rb
> > Now remove -arch i386 from the CFLAGS and LDFLAGS variables.
> >
> > You will also need to change:
> > CONFIG["LIBRUBYARG_STATIC"] = "-l$(RUBY_SO_NAME)-static"
> > to:
> > CONFIG["LIBRUBYARG_STATIC"] = ""
> > _____
>
> ARCH_FLAG should be "-arch ppc" on darwin. As what is it
> defined, and RUBY_SO_NAME?
>

CONFIG["ARCH_FLAG"] = ""
CONFIG["RUBY_SO_NAME"] = "$(RUBY_INSTALL_NAME)"

Should we update the rbconfig.rb again? KirinDave on irc also found
another problem with the RC_CFLAGS environment variable causing
problems with, for example, RubyInline.

I thought I might release another version of my fixer upper gem.

--

Chad Fowler
http://chad...
http://rubyc...
http://ruby...
http://rubygems.rub... (over 300,000 gems served!)



nobu.nokada

5/1/2005 2:55:00 AM

0

Hi,

At Sun, 1 May 2005 11:09:13 +0900,
Chad Fowler wrote in [ruby-talk:140626]:
> > > Mac OS X Tiger ships with Ruby 1.8.2 pre-installed. However,
> > > rbconfig.rb needs to be edited if you want to build any gems. (from
> > > Rich...not gems, native extensions)
> > >
> > > Edit rbconfig.rb
> > >
> > > sudo pico -w /usr/lib/ruby/1.8/powerpc-darwin8.0/rbconfig.rb
> > > Now remove -arch i386 from the CFLAGS and LDFLAGS variables.
> > >
> > > You will also need to change:
> > > CONFIG["LIBRUBYARG_STATIC"] = "-l$(RUBY_SO_NAME)-static"
> > > to:
> > > CONFIG["LIBRUBYARG_STATIC"] = ""
> > > _____
> >
> > ARCH_FLAG should be "-arch ppc" on darwin. As what is it
> > defined, and RUBY_SO_NAME?
> >
>
> CONFIG["ARCH_FLAG"] = ""

From where has the flag come?

> CONFIG["RUBY_SO_NAME"] = "$(RUBY_INSTALL_NAME)"

Do you have a problem at linking with the static library?

> Should we update the rbconfig.rb again? KirinDave on irc also found
> another problem with the RC_CFLAGS environment variable causing
> problems with, for example, RubyInline.

For what is RC_CFLAGS used, and where is it set? I think ruby
never use it.

--
Nobu Nakada



Chad Fowler

5/1/2005 6:18:00 PM

0

On 4/30/05, nobu.nokada@softhome.net <nobu.nokada@softhome.net> wrote:
> Hi,
>
> At Sun, 1 May 2005 11:09:13 +0900,
> Chad Fowler wrote in [ruby-talk:140626]:
> > > > Mac OS X Tiger ships with Ruby 1.8.2 pre-installed. However,
> > > > rbconfig.rb needs to be edited if you want to build any gems. (from
> > > > Rich...not gems, native extensions)
> > > >
> > > > Edit rbconfig.rb
> > > >
> > > > sudo pico -w /usr/lib/ruby/1.8/powerpc-darwin8.0/rbconfig.rb
> > > > Now remove -arch i386 from the CFLAGS and LDFLAGS variables.
> > > >
> > > > You will also need to change:
> > > > CONFIG["LIBRUBYARG_STATIC"] = "-l$(RUBY_SO_NAME)-static"
> > > > to:
> > > > CONFIG["LIBRUBYARG_STATIC"] = ""
> > > > _____
> > >
> > > ARCH_FLAG should be "-arch ppc" on darwin. As what is it
> > > defined, and RUBY_SO_NAME?
> > >
> >
> > CONFIG["ARCH_FLAG"] = ""
>
> From where has the flag come?
>

rbconfig.rb

> > CONFIG["RUBY_SO_NAME"] = "$(RUBY_INSTALL_NAME)"
>
> Do you have a problem at linking with the static library?
>

Haven't tried it.

> > Should we update the rbconfig.rb again? KirinDave on irc also found
> > another problem with the RC_CFLAGS environment variable causing
> > problems with, for example, RubyInline.
>
> For what is RC_CFLAGS used, and where is it set? I think ruby
> never use it.

$ grep RC_CFLAG /usr/lib/ruby/1.8/powerpc-darwin8.0/rbconfig.rb

CONFIG["LDSHARED"] = "cc $(RC_CFLAGS) -dynamic -bundle -undefined
suppress -flat_namespace"
CONFIG["LIBRUBY_LDSHARED"] = "cc $(RC_CFLAGS) -dynamic -bundle
-undefined suppress -flat_namespace"

This is looking like a plain error. Maybe a typo? RC_CFLAGS appears
to be used in darwin to allow for customized CFLAG settings. Does
this make sense to anyone? Seems like it should be changed.

--

Chad Fowler
http://chad...
http://rubyc...
http://ruby...
http://rubygems.rub... (over 300,000 gems served!)



nobu.nokada

5/7/2005 4:38:00 PM

0

Hi,

At Mon, 2 May 2005 03:18:10 +0900,
Chad Fowler wrote in [ruby-talk:140661]:
> > > CONFIG["ARCH_FLAG"] = ""
> >
> > From where has the flag come?
>
> rbconfig.rb

> This is looking like a plain error. Maybe a typo? RC_CFLAGS appears
> to be used in darwin to allow for customized CFLAG settings. Does
> this make sense to anyone? Seems like it should be changed.

Do you mean they are misconfiguration by Apple, but not a bug
of configure.in? Sorry for noise.

--
Nobu Nakada


Chad Fowler

7/1/2005 8:05:00 PM

0

On 5/7/05, nobu.nokada@softhome.net <nobu.nokada@softhome.net> wrote:
> Hi,
>
> At Mon, 2 May 2005 03:18:10 +0900,
> Chad Fowler wrote in [ruby-talk:140661]:
> > > > CONFIG["ARCH_FLAG"] = ""
> > >
> > > From where has the flag come?
> >
> > rbconfig.rb
>
> > This is looking like a plain error. Maybe a typo? RC_CFLAGS appears
> > to be used in darwin to allow for customized CFLAG settings. Does
> > this make sense to anyone? Seems like it should be changed.
>
> Do you mean they are misconfiguration by Apple, but not a bug
> of configure.in? Sorry for noise.


Sorry for the VERY delayed response. It is a misconfiguration by Apple.

--
Chad Fowler
http://chad...
http://rubyc...
http://ruby...
http://rubygems.rub... (over 500,000 gems served!)