Problem linking

Nix nix@esperi.org.uk
Mon Sep 5 16:14:00 GMT 2005


On 28 Aug 2005, ashley announced authoritatively:
> Thanks for the help yesterday, I now have gcc built and working on my  
> system. Now I am running into the following problem when trying to build  
> some supporting libraries (in the example below, libpng):  

It tells you what to do:

> /ld:         /usr/local/lib/libz.a(crc32.o): 
> relocation R_X86_64_32 against `a local symbol'         can not be used
> when making a shared object; recompile with -fPIC 

Your problem here is that you don't have a shared-library version of libz,
so ld is trying to do as best it can and link the static version into the
libpng shared library. This doesn't always work (and, on some targets,
such as Solaris, can never work); here, it failed.

Solution: build a dynamically linked libz.

(There is generally no need to build a statically linked *anything* when
bootstrapping a new Linux system from the bare metal. Well, except for
ld-linux.so.2 of course. :) )

-- 
`... published last year in a limited edition... In one of the
 great tragedies of publishing, it was not a limited enough edition
 and so I have read it.' --- James Nicoll



More information about the Gcc-help mailing list