'Cross Compile zlib for ARM

I try cross compile zlib for arm-poky-linux-gnueabi but I've an error when I launch make :

...:~/zlib-1.2.11$ AR=$HOST-ar CC=$HOST-gcc RANLIB=$HOST-ranlib ./configure --prefix=$HOME/zlibARM 
Checking for shared library support... 
Building shared library libz.so.1.2.11 with arm-poky-linux-gnueabi-gcc. 
Checking for size_t... Yes. 
Checking for off64_t... Yes. 
Checking for fseeko... Yes. 
Checking for strerror... Yes. 
Checking for unistd.h... Yes. 
Checking for stdarg.h... Yes. 
Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf(). 
Checking for vsnprintf() in stdio.h... Yes. 
Checking for return value of vsnprintf()... Yes. 
Checking for attribute(visibility) support... Yes.

...:~/zlib-1.2.11$ make
arm-poky-linux-gnueabi-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -I. -c -o example.o test/example.c
make: execvp: arm-poky-linux-gnueabi-gcc : Trop de niveaux de liens symboliques
Makefile:147: recipe for target 'example.o' failed
make: *** [example.o] Error 127

Can you help me ?



Solution 1:[1]

I know this post is already 7 months old, but I was able to successfully cross-compile zlib for ARM (on MacOS), with the following configure command:

CHOST=arm \
CC=<PATH_TO_CROSS_GCC> \
AR=<PATH_TO_CROSS_AR> \
RANLIB=<PATH_TO_CROSS_RANLIB> \
./configure \
--prefix=<INSTALL_PATH>

Where PATH_TO_CROSS_GCC, PATH_TO_CROSS_AR and PATH_TO_CROSS_GCC point to the cross compilation tools (In my case, I use crosstool-NG).

What eventually made it work for me was specifying the CHOST=arm, which caused it to actually use the specified ar.

Hopefully this could help someone down the line.

Solution 2:[2]

This is also worked for me.

# CROSS_PREFIX=<path-to-toolchain>- ./configure --prefix=<path-to-install>
# example:
CROSS_PREFIX=arm-unknown-linux-uclibcgnueabi- ./configure --prefix=~/rootfs/usr/local
make
make install

Edit:
I have exported my toolchain path, so I don't need to write full path of my toolchain.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 bouwerp
Solution 2 tirzasrwn