This is the mail archive of the 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]
Other format: [Raw text]

A question about RPATH

So for those that look at this list, you all know I am grinding away on trying to get
a nice clean result for GCC 4.7.2 and am somewhat relentless about it.  The very
best I have thus far is this one :

So great, a plate of cookies and some milk for me. 

I was somewhat dismayed when I saw that there was no RPATH in the output elf 
object : 

sedna $ greadelf -d /usr/local/gcc4/bin/x86_64-unknown-linux-gnu-gcc-4.7.2

Dynamic section at offset 0x8b368 contains 23 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: []
 0x0000000000000001 (NEEDED)             Shared library: []
 0x0000000000000001 (NEEDED)             Shared library: []
 0x0000000000000001 (NEEDED)             Shared library: []
 0x000000000000000c (INIT)               0x402340
 0x000000000000000d (FINI)               0x43e968
 0x0000000000000004 (HASH)               0x400240
 0x0000000000000005 (STRTAB)             0x401208
 0x0000000000000006 (SYMTAB)             0x4005d8
 0x000000000000000a (STRSZ)              1174 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000003 (PLTGOT)             0x68b538
 0x0000000000000002 (PLTRELSZ)           2784 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x401860
 0x0000000000000007 (RELA)               0x4017e8
 0x0000000000000008 (RELASZ)             120 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffffe (VERNEED)            0x4017a8
 0x000000006fffffff (VERNEEDNUM)         1
 0x000000006ffffff0 (VERSYM)             0x40169e
 0x0000000000000000 (NULL)               0x0

This is a problem because of this : 

sedna $ ldd /usr/local/gcc4/bin/x86_64-unknown-linux-gnu-gcc-4.7.2 =>  (0x00007fff0c28e000) => /usr/local/lib/ (0x00007f3e08790000) => /usr/local/lib/ (0x00007f3e084a0000) => /lib64/ (0x00000039fa400000) => /lib64/ (0x00000039fa000000)
        /lib64/ (0x00000039f9c00000)

The libs fir libiconv and GNU gettext are in /usr/local/lib and not anywhere to
be found in the system lib areas : 

sedna $ unset LD_LIBRARY_PATH
sedna $ ldd /usr/local/gcc4/bin/x86_64-unknown-linux-gnu-gcc-4.7.2 =>  (0x00007fffd2f20000) => not found => not found => /lib64/ (0x00000039fa400000) => /lib64/ (0x00000039fa000000)
        /lib64/ (0x00000039f9c00000)

I am a firm believer that LD_LIBRARY_PATH is evil, certainly at least dangerous and the
output binary from any compile should have an RPATH set to ensure that the correct
libs are found that the developer wanted. 

Having said all that, is there a magic LD_OPTIONS_INCANTATION=-Wl,-rpath=/usr/local/lib type thing to set to ensure I get my RPATH ?  I should point out this is trivial to do in the Solaris world and perhaps I am missing something really obvious here.


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