How to build an RPATH into gcc?

llewelly@xmission.com llewelly@xmission.com
Mon May 3 04:18:00 GMT 2004


Adrian Bunk <bunk@fs.tum.de> writes:

> On Sun, May 02, 2004 at 05:35:28PM -0600, llewelly@xmission.com wrote:
> > Adrian Bunk <bunk@fs.tum.de> writes:
> > 
> > > Hi,
> > > 
> > > if the following problem is a RTFM, I'd be glad if someone could give me
> > > a pointer to the corresponting "M"....
> > > 
> > > I have the following problem when building gcc 3.3.3 or 3.4.0 on a 
> > > sparc-unknown-netbsdelf1.5 system:
> > > 
> > > The build works fine, using
> > >   ../configure
> > >   make bootstrap
> > > but the binary doesn't run:
> > > 
> > > <--  snip  -->
> > > 
> > > $ ./gcc
> > > Shared object "libintl.so.5" not found
> > > $ objdump -p gcc
> > > ...
> > > Dynamic Section:
> > >   NEEDED      libintl.so.5
> > >   NEEDED      libiconv.so.4
> > >   NEEDED      libc.so.12
> > >   INIT        0x10de0
> > > ...
> > > 
> > > <--  snip  -->
> > > 
> > > libintl and libiconv are in /usr/local/lib.
> > > 
> > >   LDFLAGS="-L/usr/local/lib -R/usr/local/lib" ../configure
> > > didn't work
> > > 
> > >   LD_LIBRARY_PATH=/usr/local/lib ./gcc
> > > works but isn't optimal.
> > > 
> > > It might be very simple, but I don't find the solution myself...
> > [snip]
> > 
> > You have 3 alternatives;
> > 
> >     (0) build gcc staticly linked,
> 
> Can I link only libintl and libiconv (but not libc) statically?
> If yes, how?

I don't think this can be done without serious hacking of the gcc
    configure and build system.

You might try setting LDFLAGS to 
    '/usr/local/libintl.a /usr/local/libiconv.a' before running
    configure, but I don't think that will work.

> 
> >     (1) use LD_LIBRARY_PATH,
> 
> That's what I want to avoid, e.g. because this sometimes makes it 
> non-trivial to compile other software.

I forgot to mention that you could also use LD_PRELOAD, but that has
    a similar disadvantage. But LD_PRELOAD allows you to list only
    specific libraries, instead of whole directories.

Maybe a wrapper script using LD_PRELOAD or LD_LIBRARY_PATH would be
    appropriate. 



More information about the Gcc-help mailing list