zlib with -fPIC patch [old problem, revised answer]

Ken Moffat ken at linuxfromscratch.org
Fri Jun 2 17:02:30 PDT 2006


Just found the real cause of this old problem, which was (on ppc,
and ppc64, and probably arm as well, judging from an old post google
found), that adding the zlib patch to enable shared and static in
the cross-compile blew out with the following message:

On Sat, Jan 14, 2006 at 02:08:55PM +0000, Ken Moffat wrote:
>  This patch introduces a problem for me (trying to build for ppc)
> 
> powerpc-unknown-linux-gnu-gcc -O3 -fPIC -DUSE_MMAP   -c -o inffast.o 
> inffast.c
> powerpc-unknown-linux-gnu-ar libz.a adler32.o compress.o crc32.o gzio.o 
> uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o 
> inffast.o
> powerpc-unknown-linux-gnu-ar: illegal option -- z

 Except that I'm now trying to cross-compile a 32-bit  static
openssh for ppc64, and I got the same error when building the static
libz.a without the patch.

 Turns out that configure was finding the correct cross- ar, but in
putting that into the Makefile it generated
AR = powerpc64-unknown-linux-ar
to replace the line that would otherwise have contained
AR = ar rc

 So, the correct fix for anybody who does need a cross-compiled
static libz.a (admit it, using a static libz.a of all libraries is
close to insanity!) is to pass

 CC="${CC} ${BUILD32}" AR="${AR} rc"

to the configure (or BUILD64, if appropriate)

Ken
-- 
das eine Mal als Tragödie, das andere Mal als Farce



More information about the cross-lfs mailing list