Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Ruby (http://www.velocityreviews.com/forums/f66-ruby.html)
-   -   1.8.2preview2 does not use LDFLAGS (http://www.velocityreviews.com/forums/t816574-1-8-2preview2-does-not-use-ldflags.html)

Michal 'hramrach' Suchanek 09-07-2004 07:29 PM

1.8.2preview2 does not use LDFLAGS
 
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']}




Nobuyoshi Nakada 09-08-2004 01:27 AM

Re: 1.8.2preview2 does not use LDFLAGS
 
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.

--
Nobu Nakada



Michal 'hramrach' Suchanek 09-08-2004 02:24 PM

Re: 1.8.2preview2 does not use LDFLAGS
 
On Wed, Sep 08, 2004 at 10:27:59AM +0900, Nobuyoshi Nakada wrote:
> 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



nobu.nokada@softhome.net 09-09-2004 02:48 AM

Re: 1.8.2preview2 does not use LDFLAGS
 
Hi,

At Wed, 8 Sep 2004 23:24:20 +0900,
Michal 'hramrach' Suchanek wrote in [ruby-talk:111872]:
> > > 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.


$ ./configure DLDFLAGS="..."

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

--
Nobu Nakada



Michal 'hramrach' Suchanek 09-09-2004 08:21 AM

Re: 1.8.2preview2 does not use LDFLAGS
 
On Thu, Sep 09, 2004 at 11:48:44AM +0900, nobu.nokada@softhome.net wrote:
> Hi,
>
> At Wed, 8 Sep 2004 23:24:20 +0900,
> Michal 'hramrach' Suchanek wrote in [ruby-talk:111872]:
> > > > 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.

>
> $ ./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



Michal 'hramrach' Suchanek 09-09-2004 10:12 AM

Re: 1.8.2preview2 does not use LDFLAGS
 
On Wed, Sep 08, 2004 at 04:29:41AM +0900, Michal 'hramrach' Suchanek wrote:
> 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



Michal 'hramrach' Suchanek 09-10-2004 04:10 PM

Re: 1.8.2preview2 does not use LDFLAGS
 
On Thu, Sep 09, 2004 at 07:12:03PM +0900, Michal 'hramrach' Suchanek wrote:
>
> 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



nobu.nokada@softhome.net 09-12-2004 04:02 PM

Re: 1.8.2preview2 does not use LDFLAGS
 
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

--
Nobu Nakada



Michal 'hramrach' Suchanek 09-13-2004 09:48 AM

Re: 1.8.2preview2 does not use LDFLAGS
 
On Mon, Sep 13, 2004 at 01:02:05AM +0900, nobu.nokada@softhome.net wrote:
> 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






All times are GMT. The time now is 08:36 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.