bug-libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Flag for propagating -R?


From: Todd Gamblin
Subject: Flag for propagating -R?
Date: Mon, 6 Dec 2010 16:14:52 -0800

Ralf,

This has come up a couple times before.  This time I have an actual proposal.  Right now, libtool does NOT propagate -R (runtime path) in dependency_libs, even though the documentation says it does, here:

http://www.gnu.org/software/libtool/manual/html_node/Link-mode.html#Link-mode

This is so that executables linked with libtools (e.g. in a distribution) do not inadvertently suck in external library dependencies, or at least that's the rationalization that you've explained in the past.  Things have been like this for at least a couple years now.

For some projects, especially in environments with a lot of packages in different directories, it's useful to have the -R propagated, so that users don't have to set a million things in their LD_LIBRARY_PATH.  Could we have a command line flag to libtool that enables this behavior?  It's a really simple fix:

-R propagation is nixed right here in the libtool script:

      # FIXME: Pedantically, this is the right thing to do, so
      #        that some nasty dependency loop isn't accidentally
      #        broken:
      #new_libs="$deplib $new_libs"
      # Pragmatically, this seems to cause very few problems in
      # practice:
      case $deplib in
      -L*) new_libs="$deplib $new_libs" ;;
      -R*) ;;
      *)

That is around line 7567.  That makes -R pretty useless, because you don't pick up the -R's for *all* dependency libs when linking executables.

All you have to do to propagate -R's through all of a program's dependencies is this:

      case $deplib in
      -L*) new_libs="$deplib $new_libs" ;;
      -R*) new_libs="$deplib $new_libs" ;;
      *)

Could you add a flag to libtool or a parameter to LT_INIT to do this conditionally?  It would be nice if you could supply an argument to configure, similar to --enable-shared or --disable-shared that controls this behavior.

I'm not sure what the best place to put the switch would be, but I'd really like to have this capability so that users can build projects and not worry about things like LD_LIBRARY_PATH for dependencies that may be all over the filesystem.

Is this doable?  Currently there's no way to get the above behavior, short of having my build run sed on libtool.  I'd be happy to try to contribute something like this, but you know better than me who will be affected by the change, so I'd like your opinion.

-Todd


reply via email to

[Prev in Thread] Current Thread [Next in Thread]