ruby and LDFLAGS

  • Thread starter Michal 'hramrach' Suchanek
  • Start date
M

Michal 'hramrach' Suchanek

Hello

Does anybody know why ruby does not support LDFLAGS?
I am again installing in an environment where libraries are mostly in a
non-standard location - BSD.
I found I can pass arguments to configure, one for each extension that
requires a library from /usr/pkg/lib. But that means I have to name all
the extensions and if one is later added I have to find the argument
name for it.

I think that LDFLAGS are much easier to use in this situation. Also
later extensions that are built separately from ruby can use the preset
LDFLAGS automatically, without the need the specify special extconf
flags again.

--- ruby-1.8.2.org/lib/mkmf.rb 2004-07-13 14:41:15.000000000 +0200
+++ ruby-1.8.2/lib/mkmf.rb 2004-10-29 23:40:28.000000000 +0200
@@ -960,7 +960,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)"
$DLDFLAGS = with_config("dldflags", arg_config("DLDFLAGS", config["DLDFLAGS"])).dup
$LIBEXT = config['LIBEXT'].dup
@@ -1033,7 +1033,7 @@
if CONFIG["DLEXT"] == $OBJEXT
"ld $(DLDFLAGS) -r -o $(DLLIB) $(OBJS)\n"
else
- "$(LDSHARED) $(DLDFLAGS) $(LIBPATH) #{OUTFLAG}$(DLLIB) " \
+ "$(LDSHARED) $(LIBPATH) $(DLDFLAGS) #{OUTFLAG}$(DLLIB) " \
"$(OBJS) $(LOCAL_LIBS) $(LIBS)"
end
LIBPATHFLAG = config_string('LIBPATHFLAG') || ' -L"%s"'

Thanks

Michal Suchanek
 
N

Nobuyoshi Nakada

Hi,

At Sat, 30 Oct 2004 07:34:27 +0900,
Michal 'hramrach' Suchanek wrote in [ruby-talk:118328]:
Does anybody know why ruby does not support LDFLAGS?
I am again installing in an environment where libraries are mostly in a
non-standard location - BSD.
I found I can pass arguments to configure, one for each extension that
requires a library from /usr/pkg/lib. But that means I have to name all
the extensions and if one is later added I have to find the argument
name for it.

Use DLDFLAGS for extensions instead of LDFLAGS. The latter is
for executable files, and some platforms require different
flags to link shared objects.
 
M

Michal 'hramrach' Suchanek

Hi,

At Sat, 30 Oct 2004 07:34:27 +0900,
Michal 'hramrach' Suchanek wrote in [ruby-talk:118328]:
Does anybody know why ruby does not support LDFLAGS?
I am again installing in an environment where libraries are mostly in a
non-standard location - BSD.
I found I can pass arguments to configure, one for each extension that
requires a library from /usr/pkg/lib. But that means I have to name all
the extensions and if one is later added I have to find the argument
name for it.

Use DLDFLAGS for extensions instead of LDFLAGS. The latter is
for executable files, and some platforms require different
flags to link shared objects.

And what flags do I use to propagate my favourite library paths into
mkmf link tests?

You know, there is no point having the library path added to the final
link if that never happens because extconf does not find the library in
the first place.

Thanks

Michal Suchanek
 
N

nobu.nokada

Hi,

At Mon, 1 Nov 2004 19:12:33 +0900,
Michal 'hramrach' Suchanek wrote in [ruby-talk:118550]:
And what flags do I use to propagate my favourite library paths into
mkmf link tests?

What you want is --with-opt-dir / --with-opt-include /
--with-opt-lib ?
 

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,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top