ruby and LDFLAGS

Discussion in 'Ruby' started by Michal 'hramrach' Suchanek, Oct 29, 2004.

  1. 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
    Michal 'hramrach' Suchanek, Oct 29, 2004
    #1
    1. Advertising

  2. 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.

    --
    Nobu Nakada
    Nobuyoshi Nakada, Oct 31, 2004
    #2
    1. Advertising

  3. On Mon, Nov 01, 2004 at 02:24:30AM +0900, Nobuyoshi Nakada wrote:
    > 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
    Michal 'hramrach' Suchanek, Nov 1, 2004
    #3
  4. Michal 'hramrach' Suchanek

    Guest

    Hi,

    At Mon, 1 Nov 2004 19:12:33 +0900,
    Michal 'hramrach' Suchanek wrote in [ruby-talk:118550]:
    > > > 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?


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

    --
    Nobu Nakada
    , Nov 10, 2004
    #4
    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. Robin Becker

    LDFLAGS problem

    Robin Becker, Feb 21, 2011, in forum: Python
    Replies:
    0
    Views:
    189
    Robin Becker
    Feb 21, 2011
  2. Michal 'hramrach' Suchanek

    1.8.2preview2 does not use LDFLAGS

    Michal 'hramrach' Suchanek, Sep 7, 2004, in forum: Ruby
    Replies:
    8
    Views:
    162
    Michal 'hramrach' Suchanek
    Sep 13, 2004
  3. anne001
    Replies:
    1
    Views:
    391
  4. roschler
    Replies:
    0
    Views:
    174
    roschler
    Oct 16, 2006
  5. Nicholas
    Replies:
    3
    Views:
    374
    Ryan Davis
    Jan 28, 2007
Loading...

Share This Page