This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


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

Warning: /usr/lib/libc.so.1 not found by ld




Hi folks,

I get a strange warning from ld that it can't
find /usr/lib/libc.so.1 when it's indeed there
as -rwxr-xr-x and so is /usr/lib.

Trying to compile netpbm-9.13 using binutils-2.10.1
and gcc 2.95.3.

    http://download.sourceforge.net/netpbm/


Host           i586-sco-sysv5uw7.1.1


The way I compiled binutils-2.10 was very bare bones:
gmake          3.79.1
native         everything else like ar, as, ld, cc, etc..
configure      --enable-shared





The author showed me the trick to doing

          LD="gcc --verbose" ./configure




--------------------------------------------------------
gmake[2]: Leaving directory `/home/matthew/Uber/Dev/netpbm-9.13'

gcc --verbose -shared -Wl,-soname,libpbm.so.9 -o libpbm.so.9.13 libpbm1.o 
libpbm2.o libpbm3.o libpbm4.o libpbm5.o  ../shhopt/shhopt.o \
          `../libopt ` -lc

Reading specs from /usr/local/lib/gcc-lib/i586-sco-sysv5uw7.1.1/2.95.3/specs
gcc version 2.95.3 20010315 (release)
 /usr/local/lib/gcc-lib/i586-sco-sysv5uw7.1.1/2.95.3/collect2 -V -G -dy -z 
text-Y P,/usr/ccs/lib:/usr/lib -Qy -o libpbm.so.9.13 /usr/ccs/lib/crti.o 
/usr/ccs/lib/values-Xa.o
/usr/local/lib/gcc-lib/i586-sco-sysv5uw7.1.1/2.95.3/crtbegin.o -L/usr/local/lib/gcc-lib/i586-sco-sysv5uw7.1.1/2.95.3 
-L/usr/local/i586-sco-sysv5uw7.1.1/lib -L/usr/ccs/bin -L/usr/ccs/lib 
-L/usr/local/lib -soname libpbm.so.9 libpbm1.o libpbm2.o libpbm3.o libpbm4.o 
libpbm5.o ../shhopt/shhopt.o -lc -lgcc -lgcc 
/usr/local/lib/gcc-lib/i586-sco-sysv5uw7.1.1/2.95.3/crtend.o 
/usr/ccs/lib/crtn.o

GNU ld version 2.10.1 (with BFD 2.10.1)
  Supported emulations:
   elf_i386

rm -f libpbm.so.9
ln -s libpbm.so.9.13 libpbm.so.9
rm -f libpbm.so
ln -s libpbm.so.9 libpbm.so

gcc --verbose -o atktopbm atktopbm.o `../libopt libpbm.so` 
-Wl,--rpath,/usr/local/lib -g

Reading specs from /usr/local/lib/gcc-lib/i586-sco-sysv5uw7.1.1/2.95.3/specs
gcc version 2.95.3 20010315 (release)
 /usr/local/lib/gcc-lib/i586-sco-sysv5uw7.1.1/2.95.3/collect2 -V 
-Y P,/usr/ccs/lib:/usr/lib -Qy -o atktopbm /usr/ccs/lib/crt1.o 
/usr/ccs/lib/crti.o /usr/ccs/lib/values-Xa.o 
/usr/local/lib/gcc-lib/i586-sco-sysv5uw7.1.1/2.95.3/crtbegin.o -L.
-L/usr/local/lib/gcc-lib/i586-sco-sysv5uw7.1.1/2.95.3 
-L/usr/local/i586-sco-sysv5uw7.1.1/lib -L/usr/ccs/bin -L/usr/ccs/lib 
-L/usr/local/lib atktopbm.o -lpbm --rpath /usr/local/lib -lgcc -lc -lcrt -lgcc
/usr/local/lib/gcc-lib/i586-sco-sysv5uw7.1.1/2.95.3/crtend.o 
/usr/ccs/lib/crtn.o

/usr/local/bin/ld: warning: /usr/lib/libc.so.1, needed by ./libpbm.so, not found
 (try using -rpath or -rpath-link)
GNU ld version 2.10.1 (with BFD 2.10.1)
  Supported emulations:
   elf_i386
------------------------------------------------------------------------------


Now I realize that this is only a warning, but it's not one
I think I should be seeing.  

First:

  $ ls -l /usr/lib/libc.so*
  -rwxr-xr-x    2 bin      bin          513524 Nov  1  2000 /usr/lib/libc.so.1

  $ ls -ld /usr/lib
  drwxr-xr-x   60 bin      bin            6144 May  5 15:51 /usr/lib




Next, let's take a look at atktopbm and do an ldd on it:

  $ cd pbm
  $ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.
  $ ldd atktopbm
  atktopbm needs:
          libpbm.so.9 => ./libpbm.so.9
          /usr/lib/libc.so.1


So it shows something, I'm not sure of the significance
of the absolute path as versus the => notation.

Now let's take a look at libpbm.so.9 itself:

-------------------------------------------------------------
$ dump -Lv libpbm.so.9

libpbm.so.9:

  **** DYNAMIC SECTION INFORMATION ****
.dynamic :
[INDEX] Tag      Value
[1]     NEEDED   /usr/lib/libc.so.1
[2]     SONAME   libpbm.so.9
[3]     RPATH    /usr/lib:/usr/local/lib:/usr/ccs/lib:/usr/local/BerkeleyDB/lib
[4]     INIT     0x2250
[5]     FINI     0x6fb0
[6]     HASH     0x94
[7]     STRTAB   0xd20
[8]     SYMTAB   0x4c0
[9]     STRSZ    0x550
[10]    SYMENT   0x10
[11]    PLTGOT   0xea80
[12]    PLTSZ    0x1a8
[13]    PLTREL   0x11
[14]    JMPREL   0x20a0
[15]    REL      0x1270
[16]    RELSZ    0xe30
[17]    RELENT   0x8
------------------------------------------------------------


So libpbm.so.9 shows that it has an interlibrary dependency
on -lc, and shows the RPATH as pointing to it.


Next,  if we look again at the verbose output of the linker 
command to create atktopbm, we can see the -L/include/paths
that are listed:

-L/usr/local/lib/gcc-lib/i586-sco-sysv5uw7.1.1/2.95.3 
-L/usr/local/i586-sco-sysv5uw7.1.1/lib -L/usr/ccs/bin -L/usr/ccs/lib 
-L/usr/local/lib

but I don't see -L/usr/lib listed in there.  How does ld-2.10.1
not find /usr/lib/libc.so.1?


And finally, it seems that I can run atktopbm without errors:

 $./atktopbm --version
 atktopbm: Using libpbm from Netpbm Version: Netpbm 9.13
 atktopbm: Compiled Mon Apr 30 17:47:11 PDT 2001 by user "matthew"
 atktopbm: BSD defined
 atktopbm: RGB_ENV='RGBDEF'
 atktopbm: RGBENV= 'RGBDEF' (env vbl is unset)



Apologies for the lengthy post, especially if it's been
covered already.

Thanks,
Matthew


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