[Rake-devel] Building native extensions with Rake

Luis Lavena luislavena at gmail.com
Tue Nov 18 15:29:34 EST 2008

On Tue, Nov 18, 2008 at 6:18 PM, Charlie Savage <cfis at savagexi.com> wrote:
>> I agree with you, Ruby assumption is dumb, but you cannot build
>> extensions for current ruby with VC8, even going away of the compiler
>> issue.
>> The thing is that both libraries will depend on different CRT which at
>> the same time will alloc and release objects from their HEAP, mixing
>> CRTs in the same space will segfault. Been there, done that.
> Well, this is a different issue.  But I disagree with your conclusion - if
> you are careful it is doable.

The problem is that careful people like you will do, but nobody else.

I've been bitten several times by cross CRT dealing with C, Python and
Ruby in the past to know the damage it can do and how hard is track it
down and fix it.

Even for Python guys building python with different version of VC++ is
complicated (you should check their compile instructions).

7.1, 8.0 and now 9.0 each one links to different CRTs, messing with
that is like messing with nitroglycerin.

>> The idea behind these tasks is provide a standard building mechanism
>> when using Rake, which will also open the door for doing cross
>> compilation (I have that in my stash of things to commit).
> Maybe.  But I think rake is the wrong place for this.  Rake should drive
> someother class. For example, rake drives rdoc.  Rake drives ruby gems.
>  Rake could drive compiling an extension, but shouldn't be doing it itself.

Again: ExtensionTask is not building your extension from scratch, is
using your defined build script which generates a makefile. Then is
calling make and taking care the binary (so o bundle) is properly put
into lib folder.

Is extconf or what ever you name your script to deal with the links,
headers and others things required by your extension.

I described the benefits here:


I'm not talking about replacement of mkmf, which indeed needs some work.

I believe a distutil project for ruby will help deal with that part
(the extconf).
Luis Lavena
Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so.
Douglas Adams

More information about the Rake-devel mailing list