1.8.2preview2 does not use LDFLAGS

Discussion in 'Ruby' started by Michal 'hramrach' Suchanek, Sep 7, 2004.

  1. 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']}
    Michal 'hramrach' Suchanek, Sep 7, 2004
    #1
    1. Advertising

  2. 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
    Nobuyoshi Nakada, Sep 8, 2004
    #2
    1. Advertising

  3. 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
    Michal 'hramrach' Suchanek, Sep 8, 2004
    #3
  4. Michal 'hramrach' Suchanek

    Guest

    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
    , Sep 9, 2004
    #4
  5. On Thu, Sep 09, 2004 at 11:48:44AM +0900, 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, Sep 9, 2004
    #5
  6. 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, Sep 9, 2004
    #6
  7. 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
    Michal 'hramrach' Suchanek, Sep 10, 2004
    #7
  8. Michal 'hramrach' Suchanek

    Guest

    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
    , Sep 12, 2004
    #8
  9. On Mon, Sep 13, 2004 at 01:02:05AM +0900, 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
    Michal 'hramrach' Suchanek, Sep 13, 2004
    #9
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Robert
    Replies:
    1
    Views:
    305
    Martin v. Löwis
    Apr 16, 2008
  2. Robin Becker

    LDFLAGS problem

    Robin Becker, Feb 21, 2011, in forum: Python
    Replies:
    0
    Views:
    189
    Robin Becker
    Feb 21, 2011
  3. Phi!
    Replies:
    1
    Views:
    168
  4. Michal 'hramrach' Suchanek

    ruby and LDFLAGS

    Michal 'hramrach' Suchanek, Oct 29, 2004, in forum: Ruby
    Replies:
    3
    Views:
    234
  5. Robert
    Replies:
    3
    Views:
    125
    Ben Bullock
    Apr 17, 2008
Loading...

Share This Page