1.8.2preview2 does not use LDFLAGS

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

Michal 'hramrach' Suchanek

Hello

It looks like a little bug in mkmf.rb
DLDFLAGS comes out empty in the Makefile

There is code that is too complex to for writing just an empty string:
--- ruby-1.8.2/lib/mkmf.rb Tue Sep 7 17:30:59 2004
+++ /sw/src/ruby18-1.8.2-0preview2/ruby-1.8.2/lib/mkmf.rb Tue Sep 7 21:22:21 2004
@@ -738,9 +738,9 @@
LIBRUBYARG_STATIC = #$LIBRUBYARG_STATIC

CFLAGS = #{CONFIG['CCDLFLAGS'] unless $static} #$CFLAGS #$ARCH_FLAG
-CPPFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir) #{$defs.join(" ")} #{$CPPFLAGS}
+CPPFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir) #{$defs.join(" ")} #{CONFIG['CPPFLAGS']}
CXXFLAGS = $(CFLAGS) #{CONFIG['CXXFLAGS']}
-DLDFLAGS = #$LDFLAGS #$DLDFLAGS #$ARCH_FLAG
+DLDFLAGS = #{CONFIG['LDFLAGS']} #{CONFIG['DLDFLAGS']} #{CONFIG['ARCH_FLAG']}
LDSHARED = #{CONFIG['LDSHARED']}
AR = #{CONFIG['AR']}
EXEEXT = #{CONFIG['EXEEXT']}
 
N

Nobuyoshi Nakada

Hi,

At Wed, 8 Sep 2004 04:29:41 +0900,
Michal 'hramrach' Suchanek wrote in [ruby-talk:111782]:
It looks like a little bug in mkmf.rb
DLDFLAGS comes out empty in the Makefile

DLDFLAGS is different from LDFLAGS. Use DLDFLAGS to pass
options to the linker for shared objects.
 
M

Michal 'hramrach' Suchanek

Hi,

At Wed, 8 Sep 2004 04:29:41 +0900,
Michal 'hramrach' Suchanek wrote in [ruby-talk:111782]:
It looks like a little bug in mkmf.rb
DLDFLAGS comes out empty in the Makefile

DLDFLAGS is different from LDFLAGS. Use DLDFLAGS to pass
options to the linker for shared objects.

I know it is different and I do not use it directly, it is used when
building the bundled ruby extensions.

And the problem is it is empty which is definitely bad given how complex
expression was used to construct the empty string.

Thanks

Michal Suchanek
 
N

nobu.nokada

Hi,

At Wed, 8 Sep 2004 23:24:20 +0900,
Michal 'hramrach' Suchanek wrote in [ruby-talk:111872]:
I know it is different and I do not use it directly, it is used when
building the bundled ruby extensions.

And the problem is it is empty which is definitely bad given how complex
expression was used to construct the empty string.

$ ./configure DLDFLAGS="..."

Or, you can override it by --with-dldflags option at running
extconf.rb.
 
M

Michal 'hramrach' Suchanek

Hi,

At Wed, 8 Sep 2004 23:24:20 +0900,
Michal 'hramrach' Suchanek wrote in [ruby-talk:111872]:
I know it is different and I do not use it directly, it is used when
building the bundled ruby extensions.

And the problem is it is empty which is definitely bad given how complex
expression was used to construct the empty string.

$ ./configure DLDFLAGS="..."

Or, you can override it by --with-dldflags option at running
extconf.rb.
No, you cannot. Or at least should not.
That is the problem.
Look at the original mail with the patch and description. It makes the
DLDFLAGS actually contain something.

Thanks
Michal Suchanek
 
M

Michal 'hramrach' Suchanek

Hello

It looks like a little bug in mkmf.rb
DLDFLAGS comes out empty in the Makefile

There is code that is too complex to for writing just an empty string:
--- ruby-1.8.2/lib/mkmf.rb Tue Sep 7 17:30:59 2004
+++ /sw/src/ruby18-1.8.2-0preview2/ruby-1.8.2/lib/mkmf.rb Tue Sep 7 21:22:21 2004
@@ -738,9 +738,9 @@
LIBRUBYARG_STATIC = #$LIBRUBYARG_STATIC

CFLAGS = #{CONFIG['CCDLFLAGS'] unless $static} #$CFLAGS #$ARCH_FLAG
-CPPFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir) #{$defs.join(" ")} #{$CPPFLAGS}
+CPPFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir) #{$defs.join(" ")} #{CONFIG['CPPFLAGS']}
CXXFLAGS = $(CFLAGS) #{CONFIG['CXXFLAGS']}
-DLDFLAGS = #$LDFLAGS #$DLDFLAGS #$ARCH_FLAG
+DLDFLAGS = #{CONFIG['LDFLAGS']} #{CONFIG['DLDFLAGS']} #{CONFIG['ARCH_FLAG']}
LDSHARED = #{CONFIG['LDSHARED']}
AR = #{CONFIG['AR']}
EXEEXT = #{CONFIG['EXEEXT']}

A better fix adding LDFLAGS also for mkmf link tests:

--- ruby-1.8.2/lib/mkmf.rb~ Tue Sep 7 17:30:59 2004
+++ ruby-1.8.2/lib/mkmf.rb Thu Sep 9 11:08:59 2004
@@ -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

Thanks

Michal Suchanek
 
M

Michal 'hramrach' Suchanek

A better fix adding LDFLAGS also for mkmf link tests:

--- ruby-1.8.2/lib/mkmf.rb~ Tue Sep 7 17:30:59 2004
+++ ruby-1.8.2/lib/mkmf.rb Thu Sep 9 11:08:59 2004
@@ -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

Since nobody seems interested I should probably add some
explanation. I am in the situation that I have some set of libraries in
/usr/lib and other in /somewhere-else/lib.

The libraries in somewhere-else are newer than those in /usr and include
some that are not in /usr at all.

Now I run
CPPFLAGS=/somewhere-else/include LDFLAGS=/somewhere-else/lib ./configure
and make.
The CPPFLAGS are propagated into extension builds (by mkmf.rb) but the
ldflags are not.
One of the problems that results from this is caused by my other change
that removes the -undefined suppress or similar option that causes linker
to ignore unresolved symbols. Now if the lib is not found the extension
won't link.
I am not sure it is possible to suppress undefined symbols on all
platforms and in general I do not like the idea but this is mostly just
a matter of taste.

However, the ldflags aren't passed to test either. So the tests in
extensions will find only the libraries in /usr although they will see
the headers in /somewhere-else. This is going to cause linking with
different library than the one for which headers were included and
failure to detect libraries in /somewhere-else completely.

Thanks

Michal Suchanek
 
N

nobu.nokada

Hi,

At Sat, 11 Sep 2004 01:10:56 +0900,
Michal 'hramrach' Suchanek wrote in [ruby-talk:112183]:
CPPFLAGS=/somewhere-else/include LDFLAGS=/somewhere-else/lib ./configure

CPPFLAGS=/somewhere-else/include LDFLAGS=/somewhere-else/lib \
DLDFLAGS=/somewhere-else/lib ./configure
 
M

Michal 'hramrach' Suchanek

Hi,

At Sat, 11 Sep 2004 01:10:56 +0900,
Michal 'hramrach' Suchanek wrote in [ruby-talk:112183]:
CPPFLAGS=/somewhere-else/include LDFLAGS=/somewhere-else/lib ./configure

CPPFLAGS=/somewhere-else/include LDFLAGS=/somewhere-else/lib \
DLDFLAGS=/somewhere-else/lib ./configure

You seem to be fixated on DLDFLAGS :)
- you should not need that, that's what LDFLAGS are for
- DLDFLAGS are not touched in the later patch
- it is not going to fix the tests and so would not detect libraries in
/somewhere-else because afaict only LDFLAGS are used in the tests and
that are empty without the later patch.

Thanks

Michal Suchanek
 

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

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,228
Latest member
MikeMichal

Latest Threads

Top