public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alexandre Oliva <oliva@dcc.unicamp.br>
To: Ian Lance Taylor <ian@cygnus.com>
Cc: tot@trema.com, egcs@cygnus.com
Subject: Re: Shared library runpath trouble in Solaris.
Date: Tue, 11 Nov 1997 12:28:00 -0000	[thread overview]
Message-ID: <orn2jbb2yi.fsf@grupiara.dcc.unicamp.br> (raw)
In-Reply-To: <199711111710.MAA13467@subrogation.cygnus.com>

Ian Lance Taylor writes:

> Note that if we always use a -R /usr/lib option, it will break certain
> uses of LD_LIBRARY_PATH.

Now this is a very good reason for not adding -R arguments.

So, it seems to me that the only remaining alternative is to hardcode
the full pathname of the library in the library itself.  So, if one
does not use a shared libstdc++, this is not an issue.  If one uses,
the library will know how to find itself.  I know this makes it
impossible to move the library to another directory, but there's no
such thing as a free lunch, after all.

Unfortunately, AFAIK, hardcoding library paths is not that portable,
and libtool has a lot of work trying to make this all transparent to
users.  Maybe we should borrow some shared-library knowledge from
libtool...

> What's wrong with the solution I described?
> (To repeat: do the library searching in collect2, add a -R option if a
> shared library will be used; I'm happy to make this a special case for
> libstdc++, but I think it would also be reasonable to act otherwise).

There's a problem when you're linking a program linked against a
shared library that was not installed yet.  If gcc automatically
hardcodes the library path where the library is sitting, it won't be
able to find it at run-time.

IMO, gcc should only take care of libstdc++ by itself if linking is
performed with g++ and -nostdlib is not issued.  Otherwise, let the
user take care of that by himself.

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil

  reply	other threads:[~1997-11-11 12:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-11-10  6:04 Teemu Torma
1997-11-10  8:42 ` Ian Lance Taylor
1997-11-10  9:08   ` Teemu Torma
1997-11-10  9:08     ` Ian Lance Taylor
1997-11-10 13:47       ` Alexandre Oliva
1997-11-10 13:47         ` Ian Lance Taylor
1997-11-10 18:41           ` Alexandre Oliva
1997-11-10 19:19             ` Ian Lance Taylor
1997-11-10 19:57               ` Alexandre Oliva
1997-11-11  9:10                 ` Ian Lance Taylor
1997-11-11 12:28                   ` Alexandre Oliva [this message]
1997-11-11 22:42                     ` Alexandre Oliva
1997-11-12  4:01                   ` Teemu Torma
1997-11-11  2:26             ` Swen Thuemmler
1997-11-10 10:17   ` Jeffrey A Law

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=orn2jbb2yi.fsf@grupiara.dcc.unicamp.br \
    --to=oliva@dcc.unicamp.br \
    --cc=egcs@cygnus.com \
    --cc=ian@cygnus.com \
    --cc=tot@trema.com \
    /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).