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

T

Tim Mooney

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
 
N

Nobuyoshi Nakada

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?
 
M

Michal Suchanek

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?

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,230
Latest member
LifeBoostCBD

Latest Threads

Top