# Compile in static library with mkmf

**URL:** <https://www.ruby-forum.com/t/compile-in-static-library-with-mkmf/87452>\
**Category:** Ruby\
**Created:** [March 27, 2006, 6:29am UTC](https://www.ruby-forum.com/t/compile-in-static-library-with-mkmf/87452 "2006-03-27T06:29:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [March 27, 2006, 6:29am UTC](https://www.ruby-forum.com/t/compile-in-static-library-with-mkmf/87452/1 "2006-03-27T06:29:59Z")

</div>

I have the following directory structure.

~/pyastman/ruby/ #ruby build dir  
~/pyastman/ #code and library to wrap

The library is libast\_man.a, which I want to link into my ruby  
extension module at compile time. I’m not sure if this can be done  
with a static library. It’s not clear to me from the instructions. I  
tried

require ‘mkmf’  
dir\_config(“ast\_man”)  
have\_library(“ast\_man”,“ast\_connect”)  
create\_makefile(“rb\_astman”)

ruby extconf.rb --with-ast\_man-lib=~/pyastman

It can’t find the library. I tried various permutations on the names  
as well. The next best thing would be to just tell it where the object  
file is or even recompile the library. But I couldn’t figure out how  
to do this with mkmf either.

Thanks.
