# Failed to build gem native extension

**URL:** <https://www.ruby-forum.com/t/failed-to-build-gem-native-extension/159798>\
**Category:** Ruby\
**Created:** [February 8, 2009, 11:10pm UTC](https://www.ruby-forum.com/t/failed-to-build-gem-native-extension/159798 "2009-02-08T23:10:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![brblakley](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f14d63/32.png) [@brblakley](https://www.ruby-forum.com/u/brblakley)\
**Post date:** [February 8, 2009, 11:10pm UTC](https://www.ruby-forum.com/t/failed-to-build-gem-native-extension/159798/1 "2009-02-08T23:10:34Z")

</div>

Hi,

I want to install juggernaut but when running “gem install juggernaut” I  
get the following error:

ERROR: Failed to build gem native extension.

It seems that it don’t find ‘windows.h’.

I installed ruby with the One-Click installer (i386-mswin32 version) but  
I have only MinGW as a C/C++ compiler.

Juggernaut does not provide a precompiled build so how can I do if I  
want to install it ?  
Can I compile gem native extension with MinGW if I have install ruby  
with the one click installer ?

---

<div class="post-metadata">

**Author:** ![brblakley](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f14d63/32.png) [@brblakley](https://www.ruby-forum.com/u/brblakley)\
**Post date:** [February 9, 2009, 3:48am UTC](https://www.ruby-forum.com/t/failed-to-build-gem-native-extension/159798/2 "2009-02-09T03:48:53Z")

</div>

Ben Bb wrote:

> Can I compile gem native extension with MinGW if I have install ruby  
> with the one click installer ?

No, not really. Ruby stores information about how it itself was  
compiled, and uses this information to compile extensions. For example,  
if Ruby was compiled using ‘cl.exe’ (Microsoft’s MSVC, used for the  
current one-click installer), it will always try to build extensions  
using ‘cl’, not ‘gcc’ (the name of the MingW compiler).

> Juggernaut does not provide a precompiled build so how can I do if I  
> want to install it ?

Either

1. Get or build a MingW ruby, then install juggernaut to this ruby.  
There are precompiled binaries available for MingW, for example, here:  
[http://dump.mmediasys.com/installer3/](http://dump.mmediasys.com/installer3/)

2. Install the same Microsoft compiler used to build the OCI. This is  
MSVC 6.0 (although practically, I’ve used MSVC 7.1 without  
difficulties).

Microsoft has helpfully decided not offer these for download any more,  
but they are not hard to get hold of (on CDs with programming books, or  
perhaps, one might imagine, via some P2P file distribution network… )

I would go for 1), as you’ll get a faster ruby with MingW than very old  
MSVC, and MSVC is clumsy as a command-line compiler b/c the default  
Windows shell is rubbish.

I’ve seen some ways suggested of hacking the OCI configuration to use  
MingW as a compiler, but this seems to me messy and error-prone.

alex

---

<div class="post-metadata">

**Author:** ![brblakley](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f14d63/32.png) [@brblakley](https://www.ruby-forum.com/u/brblakley)\
**Post date:** [February 9, 2009, 3:56pm UTC](https://www.ruby-forum.com/t/failed-to-build-gem-native-extension/159798/3 "2009-02-09T15:56:49Z")

</div>

Thanks but I still couldn’t install juggernaut with mingw (gem install  
eventmachine failed).

I reinstalled ruby-mswin32 and VC++ 6.0 and it worked fine 🙂
