This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Problem linking
- From: Nix <nix at esperi dot org dot uk>
- To: ashley dot t dot griggs at counselsolutions dot com
- Cc: gcc-help at gcc dot gnu dot org
- Date: Mon, 05 Sep 2005 17:14:24 +0100
- Subject: Re: Problem linking
- References: <380-220058028173633109@M2W126.mail2web.com>
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