This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Shared library runpath trouble in Solaris.


Alexandre Oliva writes:

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

By the way, there's a problem in collect2 regarding this situation, on
SunOS 4.1.3

collect2 will mimic run-time library search when it is looking for
dynamic library dependencies of a program.  However, when the library
is stored in one directory and will be installed in another, collect2
won't find it.

Given that libfoo.so.1.0 is in .libs, and it will be installed in
/usr/foo/lib, if I try:

% egcs foo.o -Wl,-rpath,/usr/foo/lib -L.libs -lfoo
collect2: dynamic dependency libfoo.so.1.0 not found

I must set LD_LIBRARY_PATH=.libs in order to get this correctly
linked.  IMO, collect2 should look for libraries in directories
specified with -L, not with -R.  Does anyone disagree?

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]