# ERROR: Failed to build gem native extension

**URL:** <https://www.ruby-forum.com/t/error-failed-to-build-gem-native-extension/200022>\
**Category:** Mongrel\
**Created:** [December 3, 2010, 2:07am UTC](https://www.ruby-forum.com/t/error-failed-to-build-gem-native-extension/200022 "2010-12-03T02:07:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [December 3, 2010, 2:07am UTC](https://www.ruby-forum.com/t/error-failed-to-build-gem-native-extension/200022/1 "2010-12-03T02:07:38Z")

</div>

Hello, I am currently not able to instal mongrel, I run a Linux Ubuntu  
10.04  
system with Gems 1.3.7 when I do a “sudo gem install mongrel” I get this  
sequence of messages:  
$ sudo gem install mongrel  
Building native extensions. This could take a while…  
ERROR: Error installing mongrel:

ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb checking for main() in -lc… yes  
creating Makefile

make  
gcc -I. -I/usr/local/include/ruby-1.9.1/i686-linux  
-I/usr/local/include/ruby-1.9.1/ruby/backward  
-I/usr/local/include/ruby-1.9.1 -I. -D\_FILE\_OFFSET\_BITS=64 -fPIC -O3  
-ggdb  
-Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith  
-Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -o  
http11.o  
-c http11.c  
http11.c: In function http\_field:  
http11.c:70: warning: format not a string literal and no format  
arguments  
http11.c:71: warning: format not a string literal and no format  
arguments  
http11.c:77: error: struct RString has no member named ptr  
http11.c:77: error: struct RString has no member named len  
http11.c: In function request\_uri:  
http11.c:102: warning: format not a string literal and no format  
arguments  
http11.c: In function fragment:  
http11.c:113: warning: format not a string literal and no format  
arguments  
http11.c: In function request\_path:  
http11.c:124: warning: format not a string literal and no format  
arguments  
http11.c: In function query\_string:  
http11.c:135: warning: format not a string literal and no format  
arguments  
http11.c: In function header\_done:  
http11.c:172: error: struct RString has no member named ptr  
http11.c:172: error: struct RString has no member named ptr  
http11.c:172: error: struct RString has no member named ptr  
http11.c:174: error: struct RString has no member named ptr  
http11.c:176: error: struct RString has no member named ptr  
http11.c:177: error: struct RString has no member named len  
http11.c: In function HttpParser\_execute:  
http11.c:298: error: struct RString has no member named ptr  
http11.c:299: error: struct RString has no member named len  
http11.c:307: warning: format not a string literal and no format  
arguments  
make: \*\*\* [http11.o] Error 1

Gem files will remain installed in  
/usr/local/lib/ruby/gems/1.9.1/gems/mongrel-1.1.5 for inspection.  
Results logged to  
/usr/local/lib/ruby/gems/1.9.1/gems/mongrel-1.1.5/ext/http11/gem\_make.out

Would you please help me?  
Thank you in advance for your valuable time.

---

<div class="post-metadata">

**Author:** ![Luis\_Flores](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/c37758/32.png) [@Luis\_Flores](https://www.ruby-forum.com/u/Luis_Flores)\
**Post date:** [December 3, 2010, 2:40am UTC](https://www.ruby-forum.com/t/error-failed-to-build-gem-native-extension/200022/2 "2010-12-03T02:40:45Z")

</div>

On Thu, Dec 2, 2010 at 9:48 PM, Luis Flores  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hello, I am currently not able to instal mongrel, I run a Linux Ubuntu 10.04  
> system with Gems 1.3.7 when I do a “sudo gem install mongrel” I get this  
> sequence of messages:

[SNIP]

> $ sudo gem install mongrel  
> gcc -I. -I/usr/local/include/ruby-1.9.1/i686-linux  
> -I/usr/local/include/ruby-1.9.1/ruby/backward  
> -I/usr/local/include/ruby-1.9.1 -I. -D\_FILE\_OFFSET\_BITS=64 -fPIC -O3 -ggdb  
> -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith  
> -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -o http11.o  
> -c http11.c  
> /usr/local/lib/ruby/gems/1.9.1/gems/mongrel-1.1.5/ext/http11/gem\_make.out
> 
> Would you please help me?

Mongrel 1.1.5 is not compatible with Ruby 1.9.x

You need to install the pre-release version:

## gem install mongrel --pre

## Luis L. AREA 17

Perfection in design is achieved not when there is nothing more to add,  
but rather when there is nothing more to take away.  
Antoine de Saint-Exupry

---

<div class="post-metadata">

**Author:** ![Luis\_Flores](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/c37758/32.png) [@Luis\_Flores](https://www.ruby-forum.com/u/Luis_Flores)\
**Post date:** [February 24, 2011, 12:43pm UTC](https://www.ruby-forum.com/t/error-failed-to-build-gem-native-extension/200022/3 "2011-02-24T12:43:06Z")

</div>

I was racking my brain around with this one for a while and finally got  
it working on Ubuntu 10.10…

$ cd /var/lib/gems/1.9.1/cache #it could be 1.9.1 or another directory  
#depending on how you intalled ruby

$ pwd #make damn sure you are in the right one  
😉  
/var/lib/gems/1.9.1/cache/

$ sudo rm \*

$ gem install mongrel -v 1.2.0.pre2 --pre --source [http://rubygems.org](http://rubygems.org)

I am pretty sure the post above will work too i.e  
$ gem install mongrel --pre

I didn’t get a chance to try it but the key is if your having problems  
even with the --pre its because gems is looking in its cache files to  
save you time and thus --pre doesn’t help
