# Some default ruby extensions don't get -L/path/to/lib/dir

**URL:** <https://www.ruby-forum.com/t/some-default-ruby-extensions-dont-get-l-path-to-lib-dir/68863>\
**Category:** Ruby\
**Created:** [September 15, 2006, 11:30pm UTC](https://www.ruby-forum.com/t/some-default-ruby-extensions-dont-get-l-path-to-lib-dir/68863 "2006-09-15T23:30:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![enchanter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ce7236/32.png) [@enchanter](https://www.ruby-forum.com/u/enchanter)\
**Post date:** [September 15, 2006, 11:30pm UTC](https://www.ruby-forum.com/t/some-default-ruby-extensions-dont-get-l-path-to-lib-dir/68863/1 "2006-09-15T23:30:04Z")

</div>

All-

I’m brand new to ruby, but have plenty of experiencing with UNIX,  
autoconf & configure, building software, etc. I’m trying to build ruby  
1.8.5 on my x86\_64-sun-solaris2.10 box, using the Sun Workshop 11  
compiler and development toolchain. I am building in 64-bit mode.

Before I configure ruby, I add a few include directories to CFLAGS and  
CPPFLAGS, so that configure can find headers installed in nonstandard  
places. I add a few library directories to LDFLAGS, e.g.

LDFLAGS=’-L/local/openssl/lib -L/local/gnu/lib/64  
-L/local/BerkeleyDB/lib/64’  
export LDFLAGS

The problem is that most of the extensions under ext ignore the settings  
for LDFLAGS, so any of the extensions that require additional libraries  
(like gdbm, or readline) are skipped.

Oddly, that doesn’t happen for the openssl extension – it does have

DLDFLAGS = -L/local/openssl/lib

in the Makefile, and the extension builds.

Looking at the ‘mkmf.log’ for an extension like gdbm, I see, as the  
first line:

have\_library: checking for gdbm\_open() in -lgdbm… --------------------  
no

The DLDFLAGS settings in ext/gdbm/Makefile is empty.

So, any tips to explain why this is happening? It looks like the  
extension build procedure uses an ‘mkmf’ extension, so I’m guessing the  
fault is with that, but since I’m brand new to ruby, I can’t exactly  
debug what’s going on in mkmf.rb. I’m suspicious that ‘mkmf’ can’t find  
the libraries that are installed in a library directory that’s a  
“lib/64” directory, but that’s just a first guess.

Suggestions appreciated.

Tim

---

<div class="post-metadata">

**Author:** ![enchanter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ce7236/32.png) [@enchanter](https://www.ruby-forum.com/u/enchanter)\
**Post date:** [September 16, 2006, 8:03am UTC](https://www.ruby-forum.com/t/some-default-ruby-extensions-dont-get-l-path-to-lib-dir/68863/2 "2006-09-16T08:03:58Z")

</div>

Hi,

At Sat, 16 Sep 2006 06:30:59 +0900,  
Tim Mooney wrote in [ruby-talk:214683]:

> Before I configure ruby, I add a few include directories to CFLAGS and  
> CPPFLAGS, so that configure can find headers installed in nonstandard  
> places. I add a few library directories to LDFLAGS, e.g.
> 
> LDFLAGS=’-L/local/openssl/lib -L/local/gnu/lib/64  
> -L/local/BerkeleyDB/lib/64’  
> export LDFLAGS

$ configure  
–with-opt-lib=/local/openssl/lib:/local/gnu/lib/64:/local/BerkeleyDB/lib/64  
doesn’t help you?

---

<div class="post-metadata">

**Author:** ![enchanter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ce7236/32.png) [@enchanter](https://www.ruby-forum.com/u/enchanter)\
**Post date:** [September 25, 2006, 2:30pm UTC](https://www.ruby-forum.com/t/some-default-ruby-extensions-dont-get-l-path-to-lib-dir/68863/3 "2006-09-25T14:30:10Z")

</div>

On 9/16/06, Nobuyoshi N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > export LDFLAGS
> 
> $ configure --with-opt-lib=/local/openssl/lib:/local/gnu/lib/64:/local/BerkeleyDB/lib/64  
> doesn’t help you?

I use a patch for pulling libs from /sw.  
Ruby does not use LDFLAGS for some reason, not even in the tests.

At least it did not when I created the patch.

It may be that some weird option to configure would make it work as  
well. But I could not find out which, and I even looked at mkmf.rb to  
patch it.

— ruby-1.8.5/lib/mkmf.rb.orig 2006-08-17 07:47:50.000000000 +0200  
+++ ruby-1.8.5/lib/mkmf.rb 2006-08-29 16:24:38.000000000 +0200  
@@ -1400,7 +1400,7 @@  
$CFLAGS = with\_config(“cflags”, arg\_config(“CFLAGS”,  
config[“CFLAGS”])).dup  
$ARCH\_FLAG = with\_config(“arch\_flag”, arg\_config(“ARCH\_FLAG”,  
config[“ARCH\_FLAG”])).dup  
$CPPFLAGS = with\_config(“cppflags”, arg\_config(“CPPFLAGS”,  
config[“CPPFLAGS”])).dup

- $LDFLAGS = (with\_config(“ldflags”) || “”).dup

- $LDFLAGS = with\_config(“ldflags”, arg\_config(“LDFLAGS”,  
config[“LDFLAGS”])).dup  
$INCFLAGS = “-I$(topdir) -I$(hdrdir) -I$(srcdir)”  
$DLDFLAGS = with\_config(“dldflags”, arg\_config(“DLDFLAGS”,  
config[“DLDFLAGS”])).dup  
$LIBEXT = config[‘LIBEXT’].dup  
@@ -1501,7 +1501,7 @@

Thanks

MS
