public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Andrew Haley <aph@redhat.com>
Cc: Dennis Clarke <dclarke@blastwave.org>, gcc-help@gcc.gnu.org
Subject: Re: A question about RPATH
Date: Thu, 20 Dec 2012 11:40:00 -0000	[thread overview]
Message-ID: <CAH6eHdQ9Jo374_UJvxx6hkz8M5VtXKHxfLVAXrbuLUuq-yY-ig@mail.gmail.com> (raw)
In-Reply-To: <50D2DD73.6020905@redhat.com>

On 20 December 2012 09:42, Andrew Haley wrote:
>
> The disadvantages of RPATH are well-documented.  Perhaps its usage is
> common on Solaris, but we don't much use it on Linux.

Speak for yourself. Linux distros might not, but that doesn't mean users don't.

As I said at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32354#c9
"Whether you think LD_LIBRARY_PATH is more or less evil than RPATH is
your business, but I want to be able to make my own decision."

> Your problem is best solved by installing dependent libraries where
> ld.so can find them.  ldconfig can do this, but if these libraries
> are available as standard packages that's hugely preferable.

If I deploy code releases to dozens of production machines in
~produser/rel/appname/ver_x.y, at least once a week, should I keep
updating ld.so.conf to add ~produser/rel/appname/ver_x.y/lib for every
new appname/rel.x.y, and remove the paths to the older releases as
they get deleted off the boxes?  Or should I simply put executables in
~produser/rel/appname/ver_x.y/bin with RPATH=$ORIGIN/../lib and their
library dependencies in ~produser/rel/appname/ver_x.y/lib?  Using
RPATH with $ORIGIN ensures the right libs are found for a given
executable. The makefiles that build the code ensure
-Wl,-rpath,$ORIGIN/../lib is used and that's all that's needed, the
libraries will be found with no extra work, wherever they get
deployed, as long as the libs stay in ../lib relative to the exes..
Even if NFS was involved (it isn't) if the executables can be reached
then so can the libs, as they're on the same partition.
LD_LIBRARY_PATH would need to be constantly set to something different
if I want to use ~produser/rel/app1/ver_1.2 and
~produser/rel/app1/ver_1.3 and ~produser/rel/app2/ver_3.4 all at once,
let alone run multiple versions of the code in a dev or UAT env to
test and compare results. By using an RPATH containing $ORIGIN all
this can be done with only privs to write to ~produser, not superuser
privs or sudo access to ld.so.conf

ld.so obviously works best for packagers such as distros, or if people
deploying software to production have root access, or if you only have
one version of a library that all executables on the box want to use,
but RPATH is extremely useful for other (IMHO important) uses.

Rant over ;)

  parent reply	other threads:[~2012-12-20 11:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-19 23:08 Dennis Clarke
2012-12-19 23:21 ` Jim Rice
2012-12-19 23:57   ` Dennis Clarke
2012-12-20  0:15   ` Dennis Clarke
2012-12-20  0:19     ` Jonathan Wakely
2012-12-20  0:31       ` Dennis Clarke
2012-12-20  2:26       ` Dennis Clarke
2012-12-20  9:42 ` Andrew Haley
2012-12-20 11:01   ` Dennis Clarke
2012-12-20 14:51     ` Andrew Haley
2012-12-20 11:40   ` Jonathan Wakely [this message]
2012-12-20 14:54     ` Andrew Haley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAH6eHdQ9Jo374_UJvxx6hkz8M5VtXKHxfLVAXrbuLUuq-yY-ig@mail.gmail.com \
    --to=jwakely.gcc@gmail.com \
    --cc=aph@redhat.com \
    --cc=dclarke@blastwave.org \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).