# Repackaging a compiled gem as a binary

**URL:** <https://www.ruby-forum.com/t/repackaging-a-compiled-gem-as-a-binary/195405>\
**Category:** Ruby\
**Created:** [September 22, 2010, 8:25pm UTC](https://www.ruby-forum.com/t/repackaging-a-compiled-gem-as-a-binary/195405 "2010-09-22T20:25:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin\_DeMello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@Martin\_DeMello](https://www.ruby-forum.com/u/Martin_DeMello)\
**Post date:** [September 22, 2010, 8:25pm UTC](https://www.ruby-forum.com/t/repackaging-a-compiled-gem-as-a-binary/195405/1 "2010-09-22T20:25:00Z")

</div>

I’ve installed the qtbindings gem in an ARM emulator environment  
(scratchbox). I’d now like to repackage the compiled code as a  
“binary” gem that I can just install in my N900 without having to  
compile the C extensions again. How do I go about doing this?

martin

---

<div class="post-metadata">

**Author:** ![Martin\_DeMello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@Martin\_DeMello](https://www.ruby-forum.com/u/Martin_DeMello)\
**Post date:** [September 22, 2010, 8:32pm UTC](https://www.ruby-forum.com/t/repackaging-a-compiled-gem-as-a-binary/195405/2 "2010-09-22T20:32:37Z")

</div>

On Sep 22, 3:24 pm, Martin DeMello [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’ve installed the qtbindings gem in an ARM emulator environment  
> (scratchbox). I’d now like to repackage the compiled code as a  
> “binary” gem that I can just install in my N900 without having to  
> compile the C extensions again. How do I go about doing this?

Generate a newer gemspec, remove the extension definitions and include  
the resulting .so into the Gem::Specification.

Then, “gem build my.gemspec”

Don’t forget to adjust the gem specification platform to the ARM one  
so it clearly identifies as binary.

Read RubyGems Specification documentation for more details.

---

<div class="post-metadata">

**Author:** ![Martin\_DeMello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@Martin\_DeMello](https://www.ruby-forum.com/u/Martin_DeMello)\
**Post date:** [September 22, 2010, 10:14pm UTC](https://www.ruby-forum.com/t/repackaging-a-compiled-gem-as-a-binary/195405/3 "2010-09-22T22:14:29Z")

</div>

On Thu, Sep 23, 2010 at 12:00 AM, Luis L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Then, “gem build my.gemspec”
> 
> Don’t forget to adjust the gem specification platform to the ARM one  
> so it clearly identifies as binary.
> 
> Read RubyGems Specification documentation for more details.

Thanks! When I went to look for the gemspec I noticed that alongside  
it was already a qtbindingsnative.gemspec for that very purpose.

martin
