# Gem install extension in sub-directory under lib?

**URL:** <https://www.ruby-forum.com/t/gem-install-extension-in-sub-directory-under-lib/82302>\
**Category:** Ruby\
**Created:** [January 19, 2007, 1:55am UTC](https://www.ruby-forum.com/t/gem-install-extension-in-sub-directory-under-lib/82302 "2007-01-19T01:55:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![reidm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/0ea827/32.png) [@reidm](https://www.ruby-forum.com/u/reidm)\
**Post date:** [January 19, 2007, 1:55am UTC](https://www.ruby-forum.com/t/gem-install-extension-in-sub-directory-under-lib/82302/1 "2007-01-19T01:55:02Z")

</div>

I am in the process of setting up the Gem install packages for Ruby WMQ.

The challenge is that I need to put the extension library wmq.so into a  
sub-directory under lib. E.g.  
lib/wmq/wmq.so

The Gem spec is complete and includes all the required .rb files. The  
gem successfully builds and creates the necessary documentation. The  
other Ruby files are all copied across correctly into the Gem cache.  
E.g. lib/wmq/wmq\_const.rb

After building the extension through extconf.rb, the Gem install process  
moves the wmq.so file under the lib directory.

Is there some way to tell the Gem installer to put the file wmq.so into  
lib/wmq rather than just under lib?

Thank you  
Reid

---

<div class="post-metadata">

**Author:** ![reidm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/0ea827/32.png) [@reidm](https://www.ruby-forum.com/u/reidm)\
**Post date:** [January 19, 2007, 5:16am UTC](https://www.ruby-forum.com/t/gem-install-extension-in-sub-directory-under-lib/82302/2 "2007-01-19T05:16:34Z")

</div>

Reid Morrison wrote:

> I am in the process of setting up the Gem install packages for Ruby WMQ.
> 
> The challenge is that I need to put the extension library wmq.so into a  
> sub-directory under lib. E.g.  
> lib/wmq/wmq.so
> 
> The Gem spec is complete and includes all the required .rb files. The  
> gem successfully builds and creates the necessary documentation. The  
> other Ruby files are all copied across correctly into the Gem cache.  
> E.g. lib/wmq/wmq\_const.rb
> 
> After building the extension through extconf.rb, the Gem install process  
> moves the wmq.so file under the lib directory.
> 
> Is there some way to tell the Gem installer to put the file wmq.so into  
> lib/wmq rather than just under lib?
> 
> Thank you  
> Reid

Finally found the solution by digging through other projects on  
RubyForge.

Turns out it was not Gem, but extconf.rb that needed to be modified.

I.e. The following line in extconf.rb:  
create\_makefile(‘wmq’)  
Needed to be modified to:  
create\_makefile(‘wmq/wmq’)
